From 05ad3a668bb7b190fd2513f5b11eaa52781d358f Mon Sep 17 00:00:00 2001 From: Alexis Date: Mon, 26 Feb 2024 13:42:50 +0100 Subject: [PATCH 1/4] fix lc status title check --- frontend/tests/utils/page-detail.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/frontend/tests/utils/page-detail.ts b/frontend/tests/utils/page-detail.ts index c5297b411..0043045a7 100644 --- a/frontend/tests/utils/page-detail.ts +++ b/frontend/tests/utils/page-detail.ts @@ -69,9 +69,17 @@ export class PageDetail extends BasePage { } else { for (const key in values) { if (await this.page.getByTestId(key.replaceAll('_', '-') + '-field-title').isVisible()) { - await expect + if (key === 'lc_status') { + //TODO replace this with a better solution + await expect .soft(this.page.getByTestId(key.replaceAll('_', '-') + '-field-title')) - .toHaveText(new RegExp(key.replaceAll('_', ' '), 'i')); + .toHaveText(new RegExp(key.replaceAll('_', ' ').replace('lc ', ''), 'i')); + } + else { + await expect + .soft(this.page.getByTestId(key.replaceAll('_', '-') + '-field-title')) + .toHaveText(new RegExp(key.replaceAll('_', ' '), 'i')); + } if (this.form.fields.get(key)?.type === FormFieldType.CHECKBOX) { await expect From fc7ba0a115ff145879f195a9341f529edd963705 Mon Sep 17 00:00:00 2001 From: Nassim Tabchiche Date: Mon, 26 Feb 2024 17:32:04 +0100 Subject: [PATCH 2/4] Fix calendar sidebar event permissions --- frontend/src/lib/components/SideBar/navData.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/frontend/src/lib/components/SideBar/navData.ts b/frontend/src/lib/components/SideBar/navData.ts index dd6a5b0a3..1de1386ee 100644 --- a/frontend/src/lib/components/SideBar/navData.ts +++ b/frontend/src/lib/components/SideBar/navData.ts @@ -30,7 +30,12 @@ export const navData = { name: 'calendar', fa_icon: 'fa-solid fa-calendar-days', href: '/calendar', - permissions: ['view_event'] + permissions: [ + 'view_securitymeasure', + 'view_riskacceptance', + 'view_riskassessment', + 'view_complianceassessment' + ] } ] }, From 5cd7d6195514cb3c155ea529f949e49297aa4a2f Mon Sep 17 00:00:00 2001 From: Alexis Date: Tue, 27 Feb 2024 11:34:02 +0100 Subject: [PATCH 3/4] test to log localItems to debug in CI --- frontend/tests/functional/nav.test.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/frontend/tests/functional/nav.test.ts b/frontend/tests/functional/nav.test.ts index 284443e6d..5620e37ae 100644 --- a/frontend/tests/functional/nav.test.ts +++ b/frontend/tests/functional/nav.test.ts @@ -30,6 +30,8 @@ test('sidebar navigation tests', async ({ logedPage, analyticsPage, sideBar, pag if (item.name in temporaryPageTitle) { await expect.soft(logedPage.pageTitle).toHaveText([temporaryPageTitle[item.name]]); } else { + console.log(localItems(languageTag())); + console.log(localItems(languageTag())[item.name]); await expect.soft(logedPage.pageTitle).toHaveText(localItems(languageTag())[item.name]); } } From 17aedd527ebc86479fcde60615d5304dea20cdae Mon Sep 17 00:00:00 2001 From: Alexis Date: Tue, 27 Feb 2024 12:35:10 +0100 Subject: [PATCH 4/4] fix locals being undefined and duplicated NIST library locators because of 2 different versions --- frontend/tests/functional/nav.test.ts | 6 +++--- frontend/tests/utils/page-content.ts | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/frontend/tests/functional/nav.test.ts b/frontend/tests/functional/nav.test.ts index 5620e37ae..860f95594 100644 --- a/frontend/tests/functional/nav.test.ts +++ b/frontend/tests/functional/nav.test.ts @@ -22,6 +22,8 @@ test('sidebar navigation tests', async ({ logedPage, analyticsPage, sideBar, pag 'Backup & restore': 'Backup restore' }; + const locals = localItems(languageTag()); + for await (const [key, value] of sideBar.items) { for await (const item of value) { if (item.href !== '/role-assignments') { @@ -30,9 +32,7 @@ test('sidebar navigation tests', async ({ logedPage, analyticsPage, sideBar, pag if (item.name in temporaryPageTitle) { await expect.soft(logedPage.pageTitle).toHaveText([temporaryPageTitle[item.name]]); } else { - console.log(localItems(languageTag())); - console.log(localItems(languageTag())[item.name]); - await expect.soft(logedPage.pageTitle).toHaveText(localItems(languageTag())[item.name]); + await expect.soft(logedPage.pageTitle).toHaveText(locals[item.name]); } } } diff --git a/frontend/tests/utils/page-content.ts b/frontend/tests/utils/page-content.ts index f8ca86fd1..eeefe2634 100644 --- a/frontend/tests/utils/page-content.ts +++ b/frontend/tests/utils/page-content.ts @@ -110,7 +110,8 @@ export class PageContent extends BasePage { ? this.page .getByRole('row', { name: value }) .filter({ has: this.page.getByText(additional).first() }) - : this.page.getByRole('row', { name: value }) + .first() + : this.page.getByRole('row', { name: value }).first() : this.page.getByRole('row').first(); }