Set up a basic login flow. Need to figure out how to test a complex flow.

This commit is contained in:
Joseph Milazzo 2024-12-09 07:25:16 -06:00
parent 11e096b69c
commit 8464835d27
2 changed files with 13 additions and 6 deletions

View 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',
};

View file

@ -1,11 +1,10 @@
import { test, expect } from '@playwright/test';
import { LoginPage } from 'e2e-tests/pages/login-page';
import {environment} from "../../environment";
const url = 'https://demo.kavitareader.com/';
test('has title', async ({ page }) => {
await page.goto(url);
await page.goto(environment.baseUrl);
// Expect a title "to contain" a substring.
await expect(page).toHaveTitle(/Kavita/);
@ -13,14 +12,14 @@ test('has title', async ({ page }) => {
test('login functionality', async ({ page }) => {
// Navigate to the login page
await page.goto(url);
await page.goto(environment.baseUrl);
// Verify the page title
await expect(page).toHaveTitle(/Kavita/);
const loginPage = new LoginPage(page);
await loginPage.navigate();
await loginPage.login('demouser', 'Demouser64');
//await loginPage.navigate();
await loginPage.login(environment.username, environment.password);
// Verify successful login by checking for Home on side nav
await expect(page.locator('#null')).toBeVisible();