Skip to content

Commit

Permalink
LPD-33194 LPD-33427 playwright: Fix formatting and clean up steps + a…
Browse files Browse the repository at this point in the history
…ssert success
  • Loading branch information
oliv-yu authored and brianchandotcom committed Aug 15, 2024
1 parent 3d83bdd commit 4e9957f
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 20 deletions.
26 changes: 14 additions & 12 deletions modules/test/playwright/pages/portal-search-web/SearchPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import {FrameLocator, Locator, Page, expect} from '@playwright/test';

import {clickAndExpectToBeVisible} from '../../utils/clickAndExpectToBeVisible';
import {waitForSuccessAlert} from '../../utils/waitForSuccessAlert';

export class SearchPage {
readonly page: Page;
Expand Down Expand Up @@ -125,26 +126,22 @@ export class SearchPage {

async openSearchPortletConfiguration(
portletName: string,
order: number = 0
index: number = 0
) {
const portletTopper = this.page
.locator('.portlet-topper', {hasText: portletName})
.nth(index);

await this.page
.locator('.portlet', {
hasText: portletName,
})
.nth(order)
.nth(index)
.hover();

await expect(
this.page
.locator('.portlet-topper', {hasText: portletName})
.nth(order)
).toBeVisible();
await expect(portletTopper).toBeVisible();

await this.page
.locator('.portlet-topper', {hasText: portletName})
.nth(order)
.getByLabel('Options')
.click();
await portletTopper.getByLabel('Options').click();

await this.configurationMenuItem.click();

Expand All @@ -154,6 +151,11 @@ export class SearchPage {
async savePortletConfiguration() {
await this.modalIFrame.getByRole('button', {name: 'Save'}).click();

await waitForSuccessAlert(
this.modalIFrame,
'Success:You have successfully updated the setup.'
);

await this.modalIFrame.getByRole('button', {name: 'Cancel'}).click();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const test = mergeTests(
);

test.describe('Search Bar directs to correct page', () => {
test('retains impersonation parameter when suggestions is disabled @LPD-17509', async ({
test('Retains impersonation parameter when suggestions is disabled @LPD-17509', async ({
apiHelpers,
layout,
page,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import getRandomString from '../../utils/getRandomString';
export const test = mergeTests(loginTest(), searchPageTest, dataApiHelpersTest);

test.describe('Category facet configuration for vocabularies', () => {
test('lists 20+ sites available to the user @LPD-33194', async ({
test('Lists 20+ sites available to the user @LPD-33194', async ({
apiHelpers,
searchPage,
}) => {
Expand All @@ -29,15 +29,19 @@ test.describe('Category facet configuration for vocabularies', () => {
}
});

await test.step('Open category facet configurations', async () => {
await test.step('Navigate to search page', async () => {
await searchPage.goto();
});

await test.step('Search for keyword "Test"', async () => {
await searchPage.searchKeywordInNavBar('test');

await expect(searchPage.searchResultsTotalLabel).toHaveText(
/\d+ Results for test/
);
});

await test.step('Open category facet configurations', async () => {
await searchPage.openSearchPortletConfiguration('Category Facet');
});

Expand Down Expand Up @@ -124,7 +128,7 @@ test.describe('Clear and retain facet selections', () => {
await searchPage.savePortletConfiguration();
});

test('clears facet terms after new keyword search @LPD-19994', async ({
test('Clears facet terms after new keyword search @LPD-19994', async ({
searchPage,
}) => {

Expand All @@ -146,7 +150,7 @@ test.describe('Clear and retain facet selections', () => {
);
});

test('retains facet terms if search keyword has not changed @LPD-19994', async ({
test('Retains facet terms if search keyword has not changed @LPD-19994', async ({
page,
searchPage,
}) => {
Expand All @@ -171,7 +175,7 @@ test.describe('Clear and retain facet selections', () => {
await page.reload();
});

test('retains items per page after new keyword search @LPD-19994', async ({
test('Retains items per page after new keyword search @LPD-19994', async ({
searchPage,
}) => {

Expand Down Expand Up @@ -204,7 +208,7 @@ test.describe('Clear and retain facet selections', () => {
);
});

test('clears facet terms if performing an empty search @LPD-19994', async ({
test('Clears facet terms if performing an empty search @LPD-19994', async ({
page,
searchPage,
}) => {
Expand Down Expand Up @@ -242,7 +246,7 @@ test.describe('Clear and retain facet selections', () => {
);
});

test('retains facet terms if configured under search options @LPD-19994', async ({
test('Retains facet terms if configured under search options @LPD-19994', async ({
page,
searchPage,
}) => {
Expand Down

0 comments on commit 4e9957f

Please sign in to comment.