Set up a basic login flow. Need to figure out how to test a complex flow.
This commit is contained in:
parent
11e096b69c
commit
8464835d27
2 changed files with 13 additions and 6 deletions
8
UI/Web/e2e-tests/environment.ts
Normal file
8
UI/Web/e2e-tests/environment.ts
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
/**
|
||||||
|
* This is public information - create a environment.local.ts file and use admin account there
|
||||||
|
*/
|
||||||
|
export const environment = {
|
||||||
|
baseUrl: 'https://demo.kavitareader.com/',
|
||||||
|
username: 'demouser',
|
||||||
|
password: 'Demouser64',
|
||||||
|
};
|
|
@ -1,11 +1,10 @@
|
||||||
import { test, expect } from '@playwright/test';
|
import { test, expect } from '@playwright/test';
|
||||||
import { LoginPage } from 'e2e-tests/pages/login-page';
|
import { LoginPage } from 'e2e-tests/pages/login-page';
|
||||||
|
import {environment} from "../../environment";
|
||||||
|
|
||||||
|
|
||||||
const url = 'https://demo.kavitareader.com/';
|
|
||||||
|
|
||||||
test('has title', async ({ page }) => {
|
test('has title', async ({ page }) => {
|
||||||
await page.goto(url);
|
await page.goto(environment.baseUrl);
|
||||||
|
|
||||||
// Expect a title "to contain" a substring.
|
// Expect a title "to contain" a substring.
|
||||||
await expect(page).toHaveTitle(/Kavita/);
|
await expect(page).toHaveTitle(/Kavita/);
|
||||||
|
@ -13,14 +12,14 @@ test('has title', async ({ page }) => {
|
||||||
|
|
||||||
test('login functionality', async ({ page }) => {
|
test('login functionality', async ({ page }) => {
|
||||||
// Navigate to the login page
|
// Navigate to the login page
|
||||||
await page.goto(url);
|
await page.goto(environment.baseUrl);
|
||||||
|
|
||||||
// Verify the page title
|
// Verify the page title
|
||||||
await expect(page).toHaveTitle(/Kavita/);
|
await expect(page).toHaveTitle(/Kavita/);
|
||||||
|
|
||||||
const loginPage = new LoginPage(page);
|
const loginPage = new LoginPage(page);
|
||||||
await loginPage.navigate();
|
//await loginPage.navigate();
|
||||||
await loginPage.login('demouser', 'Demouser64');
|
await loginPage.login(environment.username, environment.password);
|
||||||
|
|
||||||
// Verify successful login by checking for Home on side nav
|
// Verify successful login by checking for Home on side nav
|
||||||
await expect(page.locator('#null')).toBeVisible();
|
await expect(page.locator('#null')).toBeVisible();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue