Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
cahrens committed Sep 26, 2024
1 parent aaf8c38 commit 6d0f7aa
Showing 1 changed file with 5 additions and 16 deletions.
21 changes: 5 additions & 16 deletions integration-tests/utils/integration-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,11 @@ const dismissNPSSurvey = async (page) => {
try {
console.log('dismissing NPS survey');
const iframe = await element.contentFrame();
const [closeButton] = await iframe.$$('.//*[normalize-space(.)="Ask Me Later"]');
const elements = await iframe.$$('div');
const closeButton = elements.find(async (element) => {
const text = await (await element.getProperty('textContent')).jsonValue();
return text.trim() === 'Ask Me Later';
});
await closeButton.evaluate((button) => button.click());
await delay(500); // delayed for survey to animate off
} catch (e) {
Expand Down Expand Up @@ -314,13 +318,6 @@ const findElement = (page, xpath, options) => {
return page.waitForSelector(`xpath/${xpath}`, defaultToVisibleTrue(options));
};

const findErrorPopup = (page, options) => {
return page.waitForSelector(
'(xpath///a | xpath///*[@role="button"] | xpath///button)[contains(@aria-label,"Dismiss")][contains(@aria-label,"error")]',
options
);
};

const heading = ({ level, text, textContains, isDescendant = false }) => {
const tag = `h${level}`;
const aria = `*[@role="heading" and @aria-level=${level}]`;
Expand Down Expand Up @@ -367,12 +364,6 @@ const findInDataTableRow = (page, entityName, text) => {
return findElement(page, elementInDataTableRow(entityName, text));
};

const findButtonInDialogByAriaLabel = (page, ariaLabelText) => {
return page.waitForSelector(`xpath///*[@role="dialog" and @aria-hidden="false"]//*[@role="button" and contains(@aria-label,"${ariaLabelText}")]`, {
visible: true,
});
};

/** Waits for a menu element to expand (or collapse if isExpanded=false) */
const waitForMenu = (page, { labelContains, isExpanded = true, ...options }) => {
const labelContainsSelector = `[aria-label*="${labelContains}"], [id="${labelContains}"], [aria-labelledby*="${labelContains}"]`;
Expand Down Expand Up @@ -616,9 +607,7 @@ module.exports = {
enablePageLogging,
fillIn,
fillInReplace,
findButtonInDialogByAriaLabel,
findElement,
findErrorPopup,
findHeading,
findIframe,
findInDataTableRow,
Expand Down

0 comments on commit 6d0f7aa

Please sign in to comment.