Skip to content

Commit

Permalink
Merge pull request #612 from amtrack/renovate/puppeteer-22.x
Browse files Browse the repository at this point in the history
fix(deps): update dependency puppeteer to v22
  • Loading branch information
amtrack authored Jul 25, 2024
2 parents 30aecb0 + 4436bd0 commit 961a41e
Show file tree
Hide file tree
Showing 7 changed files with 217 additions and 116 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"@mdapi-issues/listmetadata-standardvalueset": "2.0.3",
"@salesforce/sf-plugins-core": "4.1.1",
"p-retry": "4.6.2",
"puppeteer": "21.5.1"
"puppeteer": "22.14.0"
},
"devDependencies": {
"@salesforce/dev-config": "4.1.0",
Expand Down
2 changes: 1 addition & 1 deletion src/browserforce.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export class Browserforce {
// workaround for navigating frames https://github.com/puppeteer/puppeteer/issues/5123
'--disable-features=site-per-process'
],
headless: process.env.BROWSER_DEBUG === 'true' ? false : 'new'
headless: !(process.env.BROWSER_DEBUG === 'true')
});
const page = await this.getNewPage();
try {
Expand Down
16 changes: 8 additions & 8 deletions src/plugins/customer-portal/portals/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ type PortalProfileMembership = {
export class CustomerPortalSetup extends BrowserforcePlugin {
public async retrieve(): Promise<Config> {
const page = await this.browserforce.openPage(PATHS.LIST_VIEW);
await page.waitForXPath(SELECTORS.LIST_VIEW_PORTAL_LINKS_XPATH);
const customerPortalLinks = await page.$x(SELECTORS.LIST_VIEW_PORTAL_LINKS_XPATH);
await page.waitForSelector(`::-p-xpath(${SELECTORS.LIST_VIEW_PORTAL_LINKS_XPATH})`);
const customerPortalLinks = await page.$$(`xpath/.${SELECTORS.LIST_VIEW_PORTAL_LINKS_XPATH}`);
const response: Config = await page.evaluate(
(...links) => {
return links.map((a: HTMLAnchorElement) => {
Expand Down Expand Up @@ -195,8 +195,8 @@ export class CustomerPortalSetup extends BrowserforcePlugin {
const licenseValue = await page.evaluate(
(option: HTMLOptionElement) => option.value,
(
await page.$x(
`//select[@id="${SELECTORS.PORTAL_SELF_REG_USER_DEFAULT_LICENSE_ID}"]//option[text()="${portal.selfRegUserDefaultLicense}"]`
await page.$$(
`xpath/.//select[@id="${SELECTORS.PORTAL_SELF_REG_USER_DEFAULT_LICENSE_ID}"]//option[text()="${portal.selfRegUserDefaultLicense}"]`
)
)[0]
);
Expand All @@ -206,8 +206,8 @@ export class CustomerPortalSetup extends BrowserforcePlugin {
const roleValue = await page.evaluate(
(option: HTMLOptionElement) => option.value,
(
await page.$x(
`//select[@id="${SELECTORS.PORTAL_SELF_REG_USER_DEFAULT_ROLE_ID}"]//option[text()="${portal.selfRegUserDefaultRole}"]`
await page.$$(
`xpath/.//select[@id="${SELECTORS.PORTAL_SELF_REG_USER_DEFAULT_ROLE_ID}"]//option[text()="${portal.selfRegUserDefaultRole}"]`
)
)[0]
);
Expand All @@ -217,8 +217,8 @@ export class CustomerPortalSetup extends BrowserforcePlugin {
const profileValue = await page.evaluate(
(option: HTMLOptionElement) => option.value,
(
await page.$x(
`//select[@id="${SELECTORS.PORTAL_SELF_REG_USER_DEFAULT_PROFILE_ID}"]//option[text()="${portal.selfRegUserDefaultProfile}"]`
await page.$$(
`xpath/.//select[@id="${SELECTORS.PORTAL_SELF_REG_USER_DEFAULT_PROFILE_ID}"]//option[text()="${portal.selfRegUserDefaultProfile}"]`
)
)[0]
);
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/picklists/field-dependencies/pages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export class FieldDependencyPage {
0,
15
)}")]`;
const actionLinkHandles = await this.page.$x(xpath);
const actionLinkHandles = await this.page.$$(`xpath/.${xpath}`);
if (actionLinkHandles.length) {
this.page.on('dialog', async (dialog) => {
await dialog.accept();
Expand Down
14 changes: 7 additions & 7 deletions src/plugins/picklists/pages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export class PicklistPage {
// wait for New button in any related list
await this.page.waitForSelector('body table input[name="new"]');
const resolvePicklistValueNames = async (xpath) => {
const fullNameHandles = await this.page.$x(xpath);
const fullNameHandles = await this.page.$$(`xpath/.${xpath}`);
const innerTextJsHandles = await Promise.all<JSHandle<string>>(
fullNameHandles.map((handle) => handle.getProperty('innerText'))
);
Expand All @@ -47,8 +47,8 @@ export class PicklistPage {
public async clickNewActionButton(): Promise<void> {
const NEW_ACTION_BUTTON_XPATH =
'//tr[td[2]]//input[contains(@onclick, "/setup/ui/picklist_masteredit")][@value=" New "]';
await this.page.waitForXPath(NEW_ACTION_BUTTON_XPATH);
const newActionButton = (await this.page.$x(NEW_ACTION_BUTTON_XPATH))[0];
await this.page.waitForSelector(`::-p-xpath(${NEW_ACTION_BUTTON_XPATH})`);
const newActionButton = (await this.page.$$(`xpath/.${NEW_ACTION_BUTTON_XPATH}`))[0];
await Promise.all([this.page.waitForNavigation(), this.page.evaluate((e) => e.click(), newActionButton)]);
}

Expand All @@ -63,8 +63,8 @@ export class PicklistPage {
// deactivate: deleteType=1
// delete: deleteType=0 or no deleteType=1
const xpath = `//tr[td[2][text() = "${picklistValueApiName}"]]//td[1]//a[contains(@href, "/setup/ui/picklist_masterdelete.jsp") and not(contains(@href, "deleteType=1"))]`;
await this.page.waitForXPath(xpath);
const deleteLink = (await this.page.$x(xpath))[0];
await this.page.waitForSelector(`::-p-xpath(${xpath})`);
const deleteLink = (await this.page.$$(`xpath/.${xpath}`))[0];
this.page.on('dialog', async (dialog) => {
await dialog.accept();
});
Expand All @@ -85,8 +85,8 @@ export class PicklistPage {
// delete: deleteType=0 or no deleteType=1
xpath = `//tr[td[2][text() = "${picklistValueApiName}"]]//td[1]//a[contains(@href, "/setup/ui/picklist_masterdelete.jsp") and contains(@href, "deleteType=1")]`;
}
await this.page.waitForXPath(xpath);
const actionLink = (await this.page.$x(xpath))[0];
await this.page.waitForSelector(`::-p-xpath(${xpath})`);
const actionLink = (await this.page.$$(`xpath/.${xpath}`))[0];
this.page.on('dialog', async (dialog) => {
await dialog.accept();
});
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/record-types/pages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ export class RecordTypePage {

public async clickDeleteAction(recordTypeId: string): Promise<RecordTypeDeletePage> {
const xpath = `//a[contains(@href, "setup/ui/recordtypedelete.jsp?id=${recordTypeId.slice(0, 15)}")]`;
await this.page.waitForXPath(xpath);
const deleteLink = (await this.page.$x(xpath))[0];
await this.page.waitForSelector(`::-p-xpath(${xpath})`);
const deleteLink = (await this.page.$$(`xpath/.${xpath}`))[0];
await Promise.all([this.page.waitForNavigation(), this.page.evaluate((e) => e.click(), deleteLink)]);
return new RecordTypeDeletePage(this.page);
}
Expand Down
Loading

0 comments on commit 961a41e

Please sign in to comment.