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'; 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(); }) 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('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); }) test('LEFTMENU -> Templates', async ({ page }) => { //Navigate to "Templates" const leftMenu = new LeftMenuAdminPage(page); (await leftMenu.getTemplatesLink()).click(); await expect(page).toHaveTitle('Template management – IdHub'); }) 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'); }) })