Skip to content

Commit

Permalink
Bump @prestashop-core/ui-testing
Browse files Browse the repository at this point in the history
  • Loading branch information
Progi1984 committed Oct 17, 2024
1 parent 869685d commit 3ea8012
Show file tree
Hide file tree
Showing 10 changed files with 87 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ describe('BO - Shipping - Carriers : General Settings', async () => {
// Create images
await Promise.all([
utilsFile.generateImage(`${carrierData.name}.jpg`),
utilsFile.generateImage(`${carrierDataName.name}.jpg`),
]);
});

Expand All @@ -157,6 +158,7 @@ describe('BO - Shipping - Carriers : General Settings', async () => {
// Delete the generated images
await Promise.all([
utilsFile.deleteFile(`${carrierData.name}.jpg`),
utilsFile.deleteFile(`${carrierDataName.name}.jpg`),
]);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import type {BrowserContext, Page} from 'playwright';

const baseContext: string = 'functional_BO_shopParameters_customerSettings_titles_filterSortAndPaginationTitles';

describe('BO _ Shop Parameters - Customer Settings : Filter, sort and pagination titles', async () => {
describe('BO - Shop Parameters - Customer Settings : Filter, sort and pagination titles', async () => {
let browserContext: BrowserContext;
let page: Page;
let numberOfTitles: number = 0;
Expand Down
83 changes: 53 additions & 30 deletions tests/UI/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/UI/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
"mocha": "^10.7.3",
"mochawesome": "^7.1.3",
"mysql2": "^3.11.3",
"playwright": "^1.42.1"
"playwright": "^1.48.1"
},
"devDependencies": {
"@types/chai": "^4.3.11",
Expand Down
11 changes: 8 additions & 3 deletions tests/UI/pages/BO/catalog/suppliers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,8 @@ class Suppliers extends BOBasePage {
*/
async viewSupplier(page: Page, row: number = 1): Promise<void> {
await this.clickAndWaitForURL(page, this.viewRowLink(row));
// Move the mouse to avoid the tooltip on first row
await page.mouse.move(0, 0);
}

/**
Expand Down Expand Up @@ -252,8 +254,10 @@ class Suppliers extends BOBasePage {
*/
async resetFilter(page: Page): Promise<void> {
if (await this.elementVisible(page, this.filterResetButton, 2000)) {
await this.clickAndWaitForLoadState(page, this.filterResetButton);
await this.elementNotVisible(page, this.filterResetButton, 2000);
await page.locator(this.filterResetButton).click();
// Move the mouse to avoid the tooltip on first row
await page.mouse.move(0, 0);
await this.waitForHiddenSelector(page, this.filterResetButton, 5000);
}
}

Expand Down Expand Up @@ -297,7 +301,8 @@ class Suppliers extends BOBasePage {
// Do nothing
}
// click on search
await this.clickAndWaitForURL(page, this.filterSearchButton);
await page.locator(this.filterSearchButton).click();
await this.waitForVisibleSelector(page, this.filterResetButton);
}

/**
Expand Down
4 changes: 3 additions & 1 deletion tests/UI/pages/BO/customerService/orderMessages/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,9 @@ class OrderMessages extends BOBasePage {
*/
async filterTable(page: Page, filterBy: string, value: string): Promise<void> {
await this.setValue(page, this.filterColumn(filterBy), value);
await this.clickAndWaitForURL(page, this.filterSearchButton);
// click on search
await page.locator(this.filterSearchButton).click();
await this.waitForVisibleSelector(page, this.filterResetButton);
}

/* Column Methods */
Expand Down
7 changes: 5 additions & 2 deletions tests/UI/pages/BO/customers/addresses/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,9 @@ class Addresses extends BOBasePage {
async resetFilter(page: Page): Promise<void> {
if (await this.elementVisible(page, this.filterResetButton, 2000)) {
await page.locator(this.filterResetButton).click();
await this.elementNotVisible(page, this.filterResetButton, 2000);
// Move the mouse to avoid the tooltip on first row
await page.mouse.move(0, 0);
await this.waitForHiddenSelector(page, this.filterResetButton, 2000);
}
}

Expand Down Expand Up @@ -180,7 +182,8 @@ class Addresses extends BOBasePage {
// Do nothing
}
// click on search
await this.clickAndWaitForURL(page, this.filterSearchButton);
await page.locator(this.filterSearchButton).click();
await this.waitForVisibleSelector(page, this.filterResetButton);
}

/**
Expand Down
6 changes: 4 additions & 2 deletions tests/UI/pages/BO/shopParameters/contact/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@ class Contacts extends BOBasePage {
async resetFilter(page: Page): Promise<void> {
if (await this.elementVisible(page, this.filterResetButton, 2000)) {
await page.locator(this.filterResetButton).click();
await this.elementNotVisible(page, this.filterResetButton, 2000);
await page.mouse.move(0, 0);
await this.waitForHiddenSelector(page, this.filterResetButton, 2000);
}
}

Expand Down Expand Up @@ -155,7 +156,8 @@ class Contacts extends BOBasePage {
async filterContacts(page: Page, filterBy: string, value: string = ''): Promise<void> {
await this.setValue(page, this.contactFilterInput(filterBy), value.toString());
// click on search
await this.clickAndWaitForURL(page, this.filterSearchButton);
await page.locator(this.filterSearchButton).click();
await this.waitForVisibleSelector(page, this.filterResetButton);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,17 +171,18 @@ class Titles extends BOBasePage {
switch (filterType) {
case 'input':
await this.setValue(page, this.filterColumn(filterBy), value);
await this.clickAndWaitForURL(page, this.filterSearchButton);
break;

case 'select':
await this.selectByVisibleText(page, this.filterColumn(filterBy), value);
await this.clickAndWaitForURL(page, this.filterSearchButton);
break;

default:
throw new Error(`Filter ${filterBy} was not found`);
}
// click on search
await page.locator(this.filterSearchButton).click();
await this.elementVisible(page, this.filterResetButton);
}

/**
Expand All @@ -191,7 +192,10 @@ class Titles extends BOBasePage {
*/
async resetFilter(page: Page): Promise<void> {
if (!(await this.elementNotVisible(page, this.filterResetButton, 2000))) {
await this.clickAndWaitForURL(page, this.filterResetButton);
await page.locator(this.filterResetButton).click();
// Move the mouse to avoid the tooltip on first row
await page.mouse.move(0, 0);
await this.waitForHiddenSelector(page, this.filterResetButton, 5000);
}
await this.waitForVisibleSelector(page, this.filterSearchButton, 2000);
}
Expand Down
6 changes: 3 additions & 3 deletions tests/UI/pages/commonPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -599,10 +599,10 @@ export default class CommonPage {
* Get parent element from selector
* @param page {Frame|Page} Browser tab
* @param selector {string} String to locate the child element
* @return {Promise<ElementHandle>}
* @return {Promise<ElementHandle<HTMLElement> | JSHandle<HTMLElement | null | undefined>>>}
*/
getParentElement(page: Frame | Page, selector: string)
: Promise<ElementHandle<HTMLElement> | JSHandle<undefined> | JSHandle<null>> {
async getParentElement(page: Frame | Page, selector: string)
: Promise<ElementHandle<HTMLElement> | JSHandle<HTMLElement | null | undefined>> {
return page.evaluateHandle((sl: string) => document.querySelector(sl)?.parentElement, selector);
}

Expand Down

0 comments on commit 3ea8012

Please sign in to comment.