Skip to content

Commit

Permalink
📦 Update build-system devDependencies (#40066)
Browse files Browse the repository at this point in the history
* 📦 Update build-system devDependencies

* Override types

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Daniel Rozenberg <rodaniel@amp.dev>
  • Loading branch information
renovate[bot] and danielrozenberg authored Jun 25, 2024
1 parent 41bce1d commit 45ee58a
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 34 deletions.
32 changes: 16 additions & 16 deletions build-system/tasks/e2e/package-lock.json

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

4 changes: 2 additions & 2 deletions build-system/tasks/e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
"description": "amp e2e",
"devDependencies": {
"@babel/register": "7.24.6",
"@types/selenium-webdriver": "4.1.22",
"@types/selenium-webdriver": "4.1.23",
"babel-regenerator-runtime": "6.5.0",
"chromedriver": "119.0.1",
"geckodriver": "4.4.1",
"selenium-webdriver": "4.21.0"
"selenium-webdriver": "4.22.0"
}
}
42 changes: 26 additions & 16 deletions build-system/tasks/e2e/selenium-webdriver-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,13 @@ async function waitFor(driver, valueFn, condition, opt_mutate) {
return Boolean(condition(value));
};

/* TODO: fix incorrect typing. */
/** @type {any} */
const result = await driver.wait(
expectCondition(valueFn, conditionValue, opt_mutate)
);

return result.value; // Unbox the value.
return result;
}

class SeleniumWebDriverController {
Expand Down Expand Up @@ -156,7 +158,11 @@ class SeleniumWebDriverController {
throw e;
}
});
const webElements = await this.driver.wait(condition, ELEMENT_WAIT_TIMEOUT);
/* TODO: fix incorrect typing. */
/** @type {WebElement[]} */
const webElements = /** @type {?} */ (
await this.driver.wait(condition, ELEMENT_WAIT_TIMEOUT)
);
return webElements.map((webElement) => new ElementHandle(webElement));
}

Expand Down Expand Up @@ -192,19 +198,23 @@ class SeleniumWebDriverController {
async findElementsXPath(xpath) {
await this.maybeInstallXpath_();
const label = 'for at least one element to be located ' + xpath;
const webElements = await this.driver.wait(
new Condition(label, async () => {
const root = await this.getRoot_();
const results = await this.evaluate(
(xpath, root) => {
return window.queryXpath(xpath, root);
},
xpath,
root
);
return results;
}),
ELEMENT_WAIT_TIMEOUT
/* TODO: fix incorrect typing. */
/** @type {WebElement[]} */
const webElements = /** @type {?} */ (
await this.driver.wait(
new Condition(label, async () => {
const root = await this.getRoot_();
const results = await this.evaluate(
(xpath, root) => {
return window.queryXpath(xpath, root);
},
xpath,
root
);
return results;
}),
ELEMENT_WAIT_TIMEOUT
)
);
return webElements.map((webElement) => new ElementHandle(webElement));
}
Expand Down Expand Up @@ -295,7 +305,7 @@ class SeleniumWebDriverController {
*/
pasteFromClipboard() {
return this.driver
.actions()
.actions({async: false, bridge: undefined})
.keyDown(SeleniumKey.SHIFT)
.keyDown(SeleniumKey.INSERT)
.keyUp(SeleniumKey.SHIFT)
Expand Down

0 comments on commit 45ee58a

Please sign in to comment.