Skip to content

Commit 4365b43

Browse files
authored
Merge pull request #178 from Progi1984/bumpPlaywirght
Bump `@playwright/test` to `1.48.0`
2 parents 862d611 + 1f8d460 commit 4365b43

File tree

5 files changed

+46
-36
lines changed

5 files changed

+46
-36
lines changed

package-lock.json

+26-26
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.40.1",
32+
"@playwright/test": "^1.48.0",
3333
"@s3pweb/keycloak-admin-client-cjs": "^22.0.1",
3434
"@xmldom/xmldom": "^0.8.10",
3535
"csv-writer": "^1.6.0",

src/interfaces/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export interface CommonPageInterface {
2222
getNumberFromText(page: Page | Frame, selector: string, timeout?: number): Promise<number>;
2323
getPageTitle(page: Page): Promise<string>;
2424
getParentElement(page: Frame | Page, selector: string)
25-
: Promise<ElementHandle<HTMLElement> | JSHandle<undefined> | JSHandle<null>>;
25+
: Promise<ElementHandle<HTMLElement> | JSHandle<HTMLElement | null | undefined> | JSHandle<null>>;
2626
getPriceFromText(page: Frame|Page, selector: string, timeout?: number, waitForSelector?: boolean): Promise<number>;
2727
getTextContent(page: Page | Frame, selector: string, waitForSelector?: boolean, withTrim?: boolean): Promise<string>;
2828
goTo(page: Page, url: string): Promise<Response|null>;

src/pages/commonPage.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -597,8 +597,8 @@ export default class CommonPage implements CommonPageInterface {
597597
* @param selector {string} String to locate the child element
598598
* @return {Promise<ElementHandle>}
599599
*/
600-
getParentElement(page: Frame | Page, selector: string)
601-
: Promise<ElementHandle<HTMLElement> | JSHandle<undefined> | JSHandle<null>> {
600+
async getParentElement(page: Frame | Page, selector: string)
601+
: Promise<ElementHandle<HTMLElement> | JSHandle<HTMLElement | null | undefined> | JSHandle<null>> {
602602
return page.evaluateHandle((sl: string) => document.querySelector(sl)?.parentElement, selector);
603603
}
604604

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

+16-6
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: (idLang: number) => string;
28+
private readonly messageModuleForm: (nth: number) => string;
2929

3030
private readonly saveButton: string;
3131

@@ -45,7 +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 = (idLang: number) => `iframe[id^="psgdpr_registered_module_"][id$="_${idLang}_ifr"]`;
48+
this.messageModuleForm = (nth: number) => `div:nth-child(${nth + 1} of [id^="registered_module_message"]) `
49+
+ 'div.translatable-field:not([style="display:none"]) iframe';
4950
this.saveButton = '#submitDataConsent';
5051
}
5152

@@ -112,7 +113,10 @@ class PsGdprTabDataConsentPage extends ModuleConfiguration implements ModulePsGd
112113
* @returns {Promise<void>}
113114
*/
114115
async setNewsletterMessage(page: Page, message: string): Promise<void> {
115-
await this.setTinyMCEInputValue(page.frameLocator(this.messageModuleForm(dataLanguages.english.id)).nth(0), message);
116+
await this.setTinyMCEInputValue(
117+
page.locator(this.messageModuleForm(0)).contentFrame(),
118+
message,
119+
);
116120
}
117121

118122
/**
@@ -134,7 +138,10 @@ class PsGdprTabDataConsentPage extends ModuleConfiguration implements ModulePsGd
134138
* @returns {Promise<void>}
135139
*/
136140
async setContactFormMessage(page: Page, message: string): Promise<void> {
137-
await this.setTinyMCEInputValue(page.frameLocator(this.messageModuleForm(dataLanguages.english.id)).nth(2), message);
141+
await this.setTinyMCEInputValue(
142+
page.locator(this.messageModuleForm(2)).contentFrame(),
143+
message,
144+
);
138145
}
139146

140147
/**
@@ -156,7 +163,10 @@ class PsGdprTabDataConsentPage extends ModuleConfiguration implements ModulePsGd
156163
* @returns {Promise<void>}
157164
*/
158165
async setProductCommentsMessage(page: Page, message: string): Promise<void> {
159-
await this.setTinyMCEInputValue(page.frameLocator(this.messageModuleForm(dataLanguages.english.id)).nth(1), message);
166+
await this.setTinyMCEInputValue(
167+
page.locator(this.messageModuleForm(1)).contentFrame(),
168+
message,
169+
);
160170
}
161171

162172
/**
@@ -181,7 +191,7 @@ class PsGdprTabDataConsentPage extends ModuleConfiguration implements ModulePsGd
181191
async setMailAlertsMessage(page: Page, message: string, idLang: number = dataLanguages.english.id): Promise<void> {
182192
await page.locator(this.btnDropdownLangModuleForm).nth(3).click();
183193
await page.locator(this.btnDropdownItemLangModuleForm(idLang)).click();
184-
await this.setTinyMCEInputValue(page.frameLocator(this.messageModuleForm(idLang)).nth(3), message);
194+
await this.setTinyMCEInputValue(page.locator(this.messageModuleForm(3)).contentFrame(), message);
185195
}
186196

187197
/**

0 commit comments

Comments
 (0)