Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ci/improve functional tests reliability #1129

Merged
merged 2 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion frontend/tests/functional/detailed/common.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ for (const key of testPages) {
page
}) => {
await pages[key].itemDetail.verifyItem(items[key].build);
await pages[key].checkForUndefinedText();
page.url().includes('evidences') ? await pages[key].page.waitForTimeout(1000) : null; // prevent crashing
});

Expand Down
1 change: 0 additions & 1 deletion frontend/tests/functional/detailed/login.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ test('login / logout process is working properly', async ({
}) => {
await loginPage.hasUrl(1);
await expect.soft(page.getByTestId('login')).toBeVisible();
await loginPage.checkForUndefinedText();
await loginPage.login();
await analyticsPage.hasUrl();
await sideBar.logout();
Expand Down
9 changes: 4 additions & 5 deletions frontend/tests/functional/nav.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,18 @@ test('sidebar navigation tests', async ({ logedPage, analyticsPage, sideBar, pag
await test.step('user profile panel is working properly', async () => {
await sideBar.moreButton.click();
await expect(sideBar.morePanel).not.toHaveAttribute('inert');
await logedPage.checkForUndefinedText();

await expect(sideBar.profileButton).toBeVisible();
await sideBar.profileButton.click();
await expect(sideBar.morePanel).not.toBeVisible();
await expect(page).toHaveURL('/my-profile');
await expect.soft(logedPage.pageTitle).toHaveText('My profile');
await logedPage.checkForUndefinedText();
});

await test.step('docs button is working properly and redirects to gitbook docs', async () => {
await sideBar.moreButton.click();
await expect(sideBar.morePanel).not.toHaveAttribute('inert');
await logedPage.checkForUndefinedText();

await expect(sideBar.docsButton).toBeVisible();
});

Expand All @@ -79,13 +78,13 @@ test('sidebar navigation tests', async ({ logedPage, analyticsPage, sideBar, pag
await test.step('about panel is working properly', async () => {
await sideBar.moreButton.click();
await expect(sideBar.morePanel).not.toHaveAttribute('inert');
await logedPage.checkForUndefinedText();

await expect(sideBar.aboutButton).toBeVisible();
await sideBar.aboutButton.click();
await expect(sideBar.morePanel).toHaveAttribute('inert');
await expect(logedPage.modalTitle).toBeVisible();
await expect.soft(logedPage.modalTitle).toHaveText('About CISO Assistant');
await logedPage.checkForUndefinedText();

await expect(logedPage.page.getByTestId('version-key')).toContainText('version', {
ignoreCase: true
});
Expand Down
6 changes: 0 additions & 6 deletions frontend/tests/utils/base-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,6 @@ export abstract class BasePage {
}
}

async checkForUndefinedText() {
await expect
.soft(this.page.getByText('undefined'), 'An undefined text is visible on the page')
.toHaveCount(0);
}

async waitUntilLoaded() {
const loadingFields = this.page.getByTestId('loading-field');
if ((await loadingFields.count()) > 0) {
Expand Down
4 changes: 2 additions & 2 deletions frontend/tests/utils/test-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ export default {
referenceControl: {
name: 'POL.PHYSICAL - Physical security policy',
category: 'policy',
csf_function: 'govern',
// csf_function: 'govern',
library: {
name: 'Documents and policies',
ref: 'doc-pol',
Expand All @@ -261,7 +261,7 @@ export default {
referenceControl2: {
name: 'DOC.CONTROLS - Controls accountability matrix',
category: 'process',
csf_function: 'protect',
// csf_function: 'protect',
library: {
name: 'Documents and policies',
ref: 'doc-pol',
Expand Down
18 changes: 9 additions & 9 deletions frontend/tests/utils/test-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ export const test = base.extend<Fixtures>({
{ name: 'name', type: type.TEXT },
{ name: 'description', type: type.TEXT },
{ name: 'category', type: type.SELECT },
{ name: 'csf_function', type: type.SELECT },
// { name: 'csf_function', type: type.SELECT },
{ name: 'provider', type: type.TEXT },
{ name: 'folder', type: type.SELECT_AUTOCOMPLETE }
]);
Expand Down Expand Up @@ -422,15 +422,15 @@ export class TestContent {
name: vars.referenceControlName,
description: vars.description,
category: 'Technical',
csf_function: 'protect',
// csf_function: 'protect',
provider: 'Test provider',
folder: vars.folderName
},
editParams: {
name: '',
description: '',
category: 'Physical',
csf_function: 'detect',
// csf_function: 'detect',
provider: ''
}
},
Expand All @@ -441,7 +441,7 @@ export class TestContent {
reference_control: {
value: 'Global/' + vars.referenceControl.name,
category: vars.referenceControl.category,
csf_function: vars.referenceControl.csf_function,
// csf_function: vars.referenceControl.csf_function,
request: {
url: 'reference-controls'
}
Expand All @@ -454,14 +454,14 @@ export class TestContent {
link: 'https://intuitem.com/',
effort: 'Large',
folder: vars.folderName,
category: vars.referenceControl.category,
csf_function: vars.referenceControl.csf_function
category: vars.referenceControl.category
// csf_function: vars.referenceControl.csf_function
},
editParams: {
reference_control: {
value: 'Global/' + vars.referenceControl2.name,
category: vars.referenceControl2.category,
csf_function: vars.referenceControl2.csf_function,
// csf_function: vars.referenceControl2.csf_function,
request: {
url: 'reference-controls'
}
Expand All @@ -473,8 +473,8 @@ export class TestContent {
expiry_date: '2026-02-25',
link: 'https://intuitem.com/community/',
effort: 'Medium',
category: vars.referenceControl2.category,
csf_function: vars.referenceControl2.csf_function
category: vars.referenceControl2.category
// csf_function: vars.referenceControl2.csf_function
}
},
complianceAssessmentsPage: {
Expand Down
Loading