MCPcopy
hub / github.com/ampproject/amphtml / setup

Method setup

build-system/tasks/e2e/describes-e2e.js:575–601  ·  view source on GitHub ↗

* @param {!Object} env * @param {BrowserNameDef} browserName * @param {number} retries * @return {Promise }

(env, browserName, retries = 0)

Source from the content-addressed store, hash-verified

573 * @return {Promise<void>}
574 */
575 async setup(env, browserName, retries = 0) {
576 const config = getConfig();
577 const driver = getDriver(config, browserName, this.spec.deviceName);
578 const controller = new SeleniumWebDriverController(driver);
579 const ampDriver = new AmpDriver(controller);
580 env.controller = controller;
581 env.ampDriver = ampDriver;
582 env.version = this.spec.version;
583
584 installBrowserAssertions(controller.networkLogger);
585
586 try {
587 await setUpTest(env, this.spec);
588 // Set env props that require the fixture to be set up.
589 if (env.environment === AmpdocEnvironment.VIEWER_DEMO) {
590 env.receivedMessages = await controller.evaluate(() => {
591 return window.parent.viewer?.receivedMessages;
592 });
593 }
594 } catch (ex) {
595 if (retries > 0) {
596 await this.setup(env, browserName, --retries);
597 } else {
598 throw ex;
599 }
600 }
601 }
602
603 /**
604 * @param {!Object} env

Callers 3

integrationFunction · 0.45
unitFunction · 0.45
doTemplateFunction · 0.45

Calls 5

evaluateMethod · 0.95
getDriverFunction · 0.85
installBrowserAssertionsFunction · 0.85
setUpTestFunction · 0.85
getConfigFunction · 0.70

Tested by

no test coverage detected