Skip to content

Commit 5645b09

Browse files
authored
Merge pull request #190 from Progi1984/fix
Bump `@playwright/test` to `1.48.0`: Fixed some errors
2 parents 2b79eea + de6b501 commit 5645b09

File tree

10 files changed

+78
-42
lines changed

10 files changed

+78
-42
lines changed

.github/workflows/checks.yml

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ name: Lint And Typescript Checks
22

33
on:
44
pull_request:
5+
push:
6+
branches:
7+
- main
58

69
env:
710
NODE_VERSION: '16'

Makefile

+6
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,10 @@ test: ## Build and copy to the dependencies directory for the project
1111
cp -r dist $(filter-out $@,$(MAKECMDGOALS))/tests/UI/node_modules/@prestashop-core/ui-testing/
1212
cp package.json $(filter-out $@,$(MAKECMDGOALS))/tests/UI/node_modules/@prestashop-core/ui-testing/
1313

14+
gitclean: ## Rebase & Clean git
15+
git fetch upstream
16+
git rebase "upstream/main"
17+
git push origin
18+
git fetch --prune
19+
1420
.DEFAULT_GOAL := help

package-lock.json

+23-23
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"homepage": "https://github.com/PrestaShop/ui-testing-library#readme",
3030
"dependencies": {
3131
"@faker-js/faker": "^8.3.1",
32-
"@playwright/test": "^1.48.0",
32+
"@playwright/test": "^1.48.1",
3333
"@s3pweb/keycloak-admin-client-cjs": "^22.0.1",
3434
"@xmldom/xmldom": "^0.8.10",
3535
"csv-writer": "^1.6.0",

src/versions/develop/pages/BO/catalog/products/index.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -769,7 +769,10 @@ class ProductsPage extends BOBasePage implements BOProductsPageInterface {
769769
*/
770770
async resetFilter(page: Page): Promise<void> {
771771
if (!(await this.elementNotVisible(page, this.filterResetButton, 2000))) {
772-
await this.clickAndWaitForURL(page, this.filterResetButton);
772+
// Move the mouse to avoid the tooltip on first row
773+
await page.mouse.move(0, 0);
774+
await this.clickAndWaitForLoadState(page, this.filterResetButton);
775+
await this.waitForHiddenSelector(page, this.filterResetButton, 2000);
773776
}
774777
}
775778

src/versions/develop/pages/BO/international/languages/index.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,9 @@ class BOLanguagesPage extends BOBasePage implements BOLanguagesPageInterface {
157157
async resetFilter(page: Page): Promise<void> {
158158
if (!(await this.elementNotVisible(page, this.filterResetButton, 2000))) {
159159
await this.clickAndWaitForLoadState(page, this.filterResetButton);
160-
await this.elementNotVisible(page, this.filterResetButton, 2000);
160+
// Move the mouse to avoid the tooltip on first row
161+
await page.mouse.move(0, 0);
162+
await this.waitForHiddenSelector(page, this.filterResetButton, 2000);
161163
}
162164
}
163165

@@ -202,7 +204,8 @@ class BOLanguagesPage extends BOBasePage implements BOLanguagesPageInterface {
202204
// Do nothing
203205
}
204206
// click on search
205-
await this.clickAndWaitForURL(page, this.filterSearchButton);
207+
await page.locator(this.filterSearchButton).click();
208+
await this.waitForVisibleSelector(page, this.filterResetButton);
206209
}
207210

208211
/* Table methods */

src/versions/develop/pages/BO/modules/psgdpr/tabDataConsent.ts

+8-7
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class PsGdprTabDataConsentPage extends ModuleConfiguration implements ModulePsGd
2525

2626
private readonly checkboxModuleForm: (status: boolean) => string;
2727

28-
private readonly messageModuleForm: (nth: number) => string;
28+
private readonly messageModuleForm: (nth: number, idLang: number) => string;
2929

3030
private readonly saveButton: string;
3131

@@ -45,8 +45,8 @@ class PsGdprTabDataConsentPage extends ModuleConfiguration implements ModulePsGd
4545
+ ' button.dropdown-toggle';
4646
this.btnDropdownItemLangModuleForm = (idLang: number) => `div.open ul.dropdown-menu a[data-id="${idLang}"]`;
4747
this.checkboxModuleForm = (status: boolean) => `input[id^="switch_registered_module_"]${status ? '.yes' : '.no'}`;
48-
this.messageModuleForm = (nth: number) => `div:nth-child(${nth + 1} of [id^="registered_module_message"]) `
49-
+ 'div.translatable-field:not([style="display:none"]) iframe';
48+
this.messageModuleForm = (nth: number, idLang: number) => `div:nth-child(${nth + 1} of [id^="registered_module_message"]) `
49+
+ `div.translatable-field:not([style="display:none"]) iframe[id$="_${idLang}_ifr"]`;
5050
this.saveButton = '#submitDataConsent';
5151
}
5252

@@ -114,7 +114,7 @@ class PsGdprTabDataConsentPage extends ModuleConfiguration implements ModulePsGd
114114
*/
115115
async setNewsletterMessage(page: Page, message: string): Promise<void> {
116116
await this.setTinyMCEInputValue(
117-
page.locator(this.messageModuleForm(0)).contentFrame(),
117+
page.locator(this.messageModuleForm(0, dataLanguages.english.id)).contentFrame(),
118118
message,
119119
);
120120
}
@@ -139,7 +139,7 @@ class PsGdprTabDataConsentPage extends ModuleConfiguration implements ModulePsGd
139139
*/
140140
async setContactFormMessage(page: Page, message: string): Promise<void> {
141141
await this.setTinyMCEInputValue(
142-
page.locator(this.messageModuleForm(2)).contentFrame(),
142+
page.locator(this.messageModuleForm(2, dataLanguages.english.id)).contentFrame(),
143143
message,
144144
);
145145
}
@@ -164,7 +164,7 @@ class PsGdprTabDataConsentPage extends ModuleConfiguration implements ModulePsGd
164164
*/
165165
async setProductCommentsMessage(page: Page, message: string): Promise<void> {
166166
await this.setTinyMCEInputValue(
167-
page.locator(this.messageModuleForm(1)).contentFrame(),
167+
page.locator(this.messageModuleForm(1, dataLanguages.english.id)).contentFrame(),
168168
message,
169169
);
170170
}
@@ -191,7 +191,8 @@ class PsGdprTabDataConsentPage extends ModuleConfiguration implements ModulePsGd
191191
async setMailAlertsMessage(page: Page, message: string, idLang: number = dataLanguages.english.id): Promise<void> {
192192
await page.locator(this.btnDropdownLangModuleForm).nth(3).click();
193193
await page.locator(this.btnDropdownItemLangModuleForm(idLang)).click();
194-
await this.setTinyMCEInputValue(page.locator(this.messageModuleForm(3)).contentFrame(), message);
194+
await this.waitForVisibleSelector(page, this.messageModuleForm(3, idLang), 10000);
195+
await this.setTinyMCEInputValue(page.locator(this.messageModuleForm(3, idLang)).contentFrame(), message);
195196
}
196197

197198
/**

src/versions/develop/pages/BO/shopParameters/search/alias/create.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,7 @@ class AddAliasPage extends BOBasePage implements BOAliasCreatePageInterface {
4545
async setAlias(page: Page, aliasData: FakerSearchAlias): Promise<string> {
4646
await this.setValue(page, this.aliasInput, aliasData.alias);
4747
await this.setValue(page, this.resultInput, aliasData.result);
48-
49-
await this.clickAndWaitForURL(page, this.saveButton);
48+
await page.locator(this.saveButton).click();
5049
return this.getAlertSuccessBlockContent(page);
5150
}
5251
}

src/versions/develop/pages/FO/classic/category/index.ts

+6-5
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ class CategoryPage extends FOBasePage implements FoCategoryPageInterface {
9191

9292
protected closeOneFilter: (row: number) => string;
9393

94-
private readonly searchFilterPriceValues: string;
94+
private readonly searchFilterPriceValues: (facetType: string, facetLabel: string) => string;
9595

9696
protected clearAllFiltersLink: string;
9797

@@ -172,8 +172,9 @@ class CategoryPage extends FOBasePage implements FoCategoryPageInterface {
172172
this.searchFiltersDropdown = (facetType: string, facetLabel: string) => `${this.searchFilter(facetType, facetLabel)
173173
} .facet-dropdown`;
174174
this.searchFiltersSlider = (facetType: string, facetLabel: string) => `${this.searchFilter(facetType, facetLabel)
175-
}.faceted-slider`;
176-
this.searchFilterPriceValues = '[id*=facet_label]';
175+
}.faceted-slider .ui-slider`;
176+
this.searchFilterPriceValues = (facetType: string, facetLabel: string) => `${this.searchFilter(facetType, facetLabel)} `
177+
+ '[id*=facet_label]';
177178
this.clearAllFiltersLink = '#_desktop_search_filters_clear_all button.js-search-filters-clear-all';
178179
this.activeSearchFilters = '#js-active-search-filters';
179180
this.closeOneFilter = (row: number) => `#js-active-search-filters ul li:nth-child(${row}) a i`;
@@ -607,7 +608,7 @@ class CategoryPage extends FOBasePage implements FoCategoryPageInterface {
607608
* @return {Promise<number>}
608609
*/
609610
async getMaximumPrice(page: Page): Promise<number> {
610-
const test = await this.getTextContent(page, this.searchFilterPriceValues);
611+
const test = await this.getTextContent(page, this.searchFilterPriceValues('price', 'Price'));
611612

612613
return (parseInt(test.split('€')[2], 10));
613614
}
@@ -618,7 +619,7 @@ class CategoryPage extends FOBasePage implements FoCategoryPageInterface {
618619
* @return {Promise<number>}
619620
*/
620621
async getMinimumPrice(page: Page): Promise<number> {
621-
const test = await this.getTextContent(page, this.searchFilterPriceValues);
622+
const test = await this.getTextContent(page, this.searchFilterPriceValues('price', 'Price'));
622623

623624
return (parseInt(test.split('€')[1], 10));
624625
}

src/versions/develop/pages/FO/hummingbird/category/index.ts

+21-1
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,13 @@ class CategoryPage extends CategoryPageVersion implements FoCategoryPageInterfac
4040
this.searchFiltersLabel = `${this.searchFilters} label.form-check-label`;
4141
this.clearAllFiltersLink = `${this.searchFilters} button.js-search-filters-clear-all`;
4242
this.searchFilterPriceSlider = 'div.faceted-slider';
43-
this.searchFiltersSlider = () => `${this.searchFilters} div.faceted-slider`;
4443
this.closeOneFilter = (row: number) => `#js-active-search-filters ul li:nth-child(${row + 1}) a i`;
4544

4645
// Pagination selectors
4746
this.pagesList = 'ul.pagination';
47+
48+
// Filter selectors
49+
this.searchFiltersSlider = () => `${this.searchFilters} .faceted-slider`;
4850
}
4951

5052
/**
@@ -88,6 +90,24 @@ class CategoryPage extends CategoryPageVersion implements FoCategoryPageInterfac
8890
await page.waitForTimeout(2000);
8991
}
9092

93+
/**
94+
* Filter by price
95+
* @param page {Page} Browser tab
96+
* @param minPrice {number} Minimum price in the slider
97+
* @param maxPrice {number} Maximum price in the slider
98+
* @param filterFrom {number} The minimum value to filter
99+
* @param filterTo {number} The maximum value to filter
100+
* @return {Promise<void>}
101+
*/
102+
async filterByPrice(page: Page, minPrice: number, maxPrice: number, filterFrom: number, filterTo: number): Promise<void> {
103+
await page.locator(this.filterTypeButton('Price')).click();
104+
105+
await super.filterByPrice(page, minPrice, maxPrice, filterFrom, filterTo);
106+
107+
await page.locator(this.filterTypeButton('Price')).click();
108+
await page.waitForTimeout(2000);
109+
}
110+
91111
/**
92112
* Get product href
93113
* @param page {Page} Browser tab

0 commit comments

Comments
 (0)