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/01-AD-leftmenuNavigation.sp...

78 lines
3.1 KiB
TypeScript
Raw Normal View History

2024-03-04 19:57:54 +00:00
import { test, expect } from '@playwright/test'
import { LeftMenuAdminPage } from '../src/page-objects/AD_LeftMenuAdminPage'
import { ViewUsersPage } from '../src/page-objects/AD_ViewUsersPage';
import { BasicUserInfoSectionPage } from '../src/page-objects/AD_BasicUserInfoSectionInPage';
import { ViewRolesPage } from '../src/page-objects/AD_ViewRolesPage';
import { ViewServicesPage } from '../src/page-objects/AD_ViewServicesPage';
import { clickAddUserOnLeftMenu, clickDashboardOnLeftMenu, clickManageRolesOnLeftMenu, clickManageServicesOnLeftMenu, clickViewUsersOnLeftMenu, loginAsAdmin } from '../src/steps';
import { URL_IDHUB } from '../src/constants/env_constants';
/**
* Check the navigation options on the Left Menu
*/
test.describe('Leftside Menu navigation test', () => {
test.beforeEach(async ({ page }) => {
await loginAsAdmin(page, URL_IDHUB);
})
test('LEFTMENU -> Dashboard', async ({ page }) => {
await clickDashboardOnLeftMenu(page)
await expect(page).toHaveTitle('Dashboard IdHub');
})
test('LEFTMENU -> Users', async ({ page }) => {
await clickViewUsersOnLeftMenu(page);
await expect(page).toHaveTitle('User management IdHub');
//Check titles
const viewUsersPage = new ViewUsersPage(page);
expect(await viewUsersPage.getPrimaryTitle()).toEqual("User management");
expect(await viewUsersPage.getSecondaryTitle()).toEqual(" View users");
//Navigate to "Add user"
const basicInfoPage = new BasicUserInfoSectionPage(page);
await clickAddUserOnLeftMenu(page);
//Check titles
expect(await basicInfoPage.getPrimaryTitleText()).toEqual("User management");
expect(await basicInfoPage.getSecondaryTitleText()).toEqual(" Add user");
})
test('LEFTMENU -> Roles and Services', async ({ page }) => {
//Navigate to "Roles"
const leftMenu = new LeftMenuAdminPage(page);
(await leftMenu.getRolesLink()).click();
//Navigate to "Manage roles"
await clickManageRolesOnLeftMenu(page);
await expect(page).toHaveTitle('Access control management IdHub');
//Check titles
const viewRolesPage = new ViewRolesPage(page);
expect(await viewRolesPage.getPrimaryTitle()).toEqual("Access control management");
expect(await viewRolesPage.getSecondaryTitle()).toEqual("Manage roles");
//Navigate to "Manage services"
await clickManageServicesOnLeftMenu(page);
await expect(page).toHaveTitle('Access control management IdHub');
//Check titles
const viewServicesPage = new ViewServicesPage(page);
expect(await viewServicesPage.getPrimaryTitle()).toEqual("Access control management");
expect(await viewServicesPage.getSecondaryTitle()).toEqual("Manage services");
})
//TODO: credentials, templates....
test.skip('LEFTMENU -> Credentials', async ({ page }) => {
})
test.skip('LEFTMENU -> Templates', async ({ page }) => {
})
test.skip('LEFTMENU -> Data', async ({ page }) => {
})
})