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 Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { test, expect, Page } from '@playwright/test'
import { LogInPage } from '../src/page-objects/COMM_LoginPage.js'
import { loginAsAdmin, loginAsUser } from '../src/steps';
import { ADMIN_EMAIL, KO_ADMIN_K, KO_USER_K, URL_IDHUB, URL_PASS_RESET, USER1_EMAIL} from '../src/constants/env_constants.js';
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)
expect(await loginPage.errorMessageIsValid()).toBeTruthy();
})
test('Navigate to Forgot password page from login page', async ({ page }) => {
const loginPage = new LogInPage(page)
await loginPage.visitForgotPassword(URL_PASS_RESET)
await expect(page).toHaveTitle('Password reset IdHub');
})
})
test.describe('User login functionality', () => {
test('Successful login as user', async ({ page }) => {
await loginAsUser(page, USER1_EMAIL, URL_IDHUB);
await expect(page).toHaveTitle('Dashboard IdHub');
})
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)
expect(await loginPage.errorMessageIsValid()).toBeTruthy();
})
})