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...

100 lines
4.0 KiB
TypeScript
Raw Permalink 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, clickViewCredentialsOnLeftMenu, clickViewOrganizationWalletOnLeftMenu, clickViewUsersOnLeftMenu, loginAsAdmin } from '../src/steps';
2024-03-04 19:57:54 +00:00
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.afterEach(async ({ page }) => { //este se ejecutará despues de cada test
await page.click('.logout');
await page.close();
})
2024-03-04 19:57:54 +00:00
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 }) => {
2024-03-04 19:57:54 +00:00
//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');
2024-03-04 19:57:54 +00:00
//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('LEFTMENU -> Credentials', async ({ page }) => {
const leftMenu = new LeftMenuAdminPage(page);
(await leftMenu.getCredentialsLink()).click();
//Navigate to "View Credentials"
await clickViewCredentialsOnLeftMenu(page);
await expect(page).toHaveTitle('Credential management IdHub');
//Navigate to "Organization's wallet"
await clickViewOrganizationWalletOnLeftMenu(page);
2024-03-04 19:57:54 +00:00
})
test('LEFTMENU -> Templates', async ({ page }) => {
//Navigate to "Templates"
const leftMenu = new LeftMenuAdminPage(page);
(await leftMenu.getTemplatesLink()).click();
await expect(page).toHaveTitle('Template management IdHub');
2024-03-04 19:57:54 +00:00
})
test('LEFTMENU -> Data', async ({ page }) => {
//Navigate to "Data"
const leftMenu = new LeftMenuAdminPage(page);
(await leftMenu.getDataLink()).click();
await expect(page).toHaveTitle('Data file management IdHub');
2024-03-04 19:57:54 +00:00
})
})