This repository has been archived on 2024-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
IdHub_E2E_testing/tests/00-COMM-loginFunctionality....

36 lines
1.5 KiB
TypeScript
Raw Permalink Normal View History

2024-03-04 19:57:54 +00:00
import { test, expect, Page } from '@playwright/test'
import { LogInPage } from '../src/page-objects/COMM_LoginPage.js'
import { loginAsAdmin, loginAsUser } from '../src/steps';
2024-03-07 10:52:37 +00:00
import { ADMIN_EMAIL, KO_ADMIN_K, KO_USER_K, URL_IDHUB, URL_PASS_RESET, USER1_EMAIL} from '../src/constants/env_constants.js';
2024-03-04 19:57:54 +00:00
test.describe('Admin login functionality', () => {
test('Successful login as admin', async ({ page }) => {
await loginAsAdmin(page, URL_IDHUB);
})
test('Unsuccessful login as admin', async ({ page }) => {
const loginPage = new LogInPage(page)
await loginPage.visit(URL_IDHUB);
await loginPage.login(ADMIN_EMAIL, KO_ADMIN_K)
2024-03-28 22:12:39 +00:00
expect(await loginPage.errorMessageIsValid()).toBeTruthy();
2024-03-04 19:57:54 +00:00
})
test('Navigate to Forgot password page from login page', async ({ page }) => {
const loginPage = new LogInPage(page)
await loginPage.visitForgotPassword(URL_PASS_RESET)
2024-03-13 11:59:57 +00:00
await expect(page).toHaveTitle('Password reset IdHub');
2024-03-04 19:57:54 +00:00
})
})
test.describe('User login functionality', () => {
test('Successful login as user', async ({ page }) => {
await loginAsUser(page, USER1_EMAIL, URL_IDHUB);
2024-03-13 11:59:57 +00:00
await expect(page).toHaveTitle('Dashboard IdHub');
2024-03-04 19:57:54 +00:00
})
test('Unsuccessful login as user', async ({ page }) => {
const loginPage = new LogInPage(page)
await loginPage.visit(URL_IDHUB);
await loginPage.login(USER1_EMAIL, KO_USER_K)
2024-03-28 21:57:12 +00:00
expect(await loginPage.errorMessageIsValid()).toBeTruthy();
2024-03-04 19:57:54 +00:00
})
})