Skip to content

Commit 8464835

Browse files
committed
Set up a basic login flow. Need to figure out how to test a complex flow.
1 parent 11e096b commit 8464835

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

UI/Web/e2e-tests/environment.ts

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/**
2+
* This is public information - create a environment.local.ts file and use admin account there
3+
*/
4+
export const environment = {
5+
baseUrl: 'https://demo.kavitareader.com/',
6+
username: 'demouser',
7+
password: 'Demouser64',
8+
};

UI/Web/e2e-tests/tests/Login/login.spec.ts

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,25 @@
11
import { test, expect } from '@playwright/test';
22
import { LoginPage } from 'e2e-tests/pages/login-page';
3+
import {environment} from "../../environment";
34

45

5-
const url = 'https://demo.kavitareader.com/';
6-
76
test('has title', async ({ page }) => {
8-
await page.goto(url);
7+
await page.goto(environment.baseUrl);
98

109
// Expect a title "to contain" a substring.
1110
await expect(page).toHaveTitle(/Kavita/);
1211
});
1312

1413
test('login functionality', async ({ page }) => {
1514
// Navigate to the login page
16-
await page.goto(url);
15+
await page.goto(environment.baseUrl);
1716

1817
// Verify the page title
1918
await expect(page).toHaveTitle(/Kavita/);
2019

2120
const loginPage = new LoginPage(page);
22-
await loginPage.navigate();
23-
await loginPage.login('demouser', 'Demouser64');
21+
//await loginPage.navigate();
22+
await loginPage.login(environment.username, environment.password);
2423

2524
// Verify successful login by checking for Home on side nav
2625
await expect(page.locator('#null')).toBeVisible();

0 commit comments

Comments
 (0)