diff --git a/build-system/tasks/e2e/selenium-webdriver-controller.js b/build-system/tasks/e2e/selenium-webdriver-controller.js index 9df90f8f3b82..0e884a86c8bc 100644 --- a/build-system/tasks/e2e/selenium-webdriver-controller.js +++ b/build-system/tasks/e2e/selenium-webdriver-controller.js @@ -411,6 +411,18 @@ class SeleniumWebDriverController { this.getWaitFn_(() => webElement.isEnabled()) ); } + + /** + * @param {!ElementHandle} handle + * @return {!Promise} + */ + isElementDisplayed(handle) { + const webElement = handle.getElement(); + return new ControllerPromise( + webElement.isDisplayed(), + this.getWaitFn_(() => webElement.isDisplayed()) + ); + } /** * @return {!Promise>} */ diff --git a/extensions/amp-sidebar/1.0/test-e2e/test-bento-sidebar.js b/extensions/amp-sidebar/1.0/test-e2e/test-bento-sidebar.js new file mode 100644 index 000000000000..9268b43dffb3 --- /dev/null +++ b/extensions/amp-sidebar/1.0/test-e2e/test-bento-sidebar.js @@ -0,0 +1,35 @@ +describes.endtoend( + 'bento-sidebar', + { + version: '1.0', + fixture: 'bento/bento-sidebar.html', + environments: ['single'], + }, + (env) => { + let controller; + + beforeEach(() => { + controller = env.controller; + }); + + it('should be able to open and close', async () => { + // check if sidebar content is not visibile + const navLinkInSidebar = await controller.findElement('nav'); + await expect(controller.isElementDisplayed(navLinkInSidebar)).to.be.false; + + // Open sidebar + const openButton = await controller.findElement('#open-sidebar'); + controller.click(openButton); + + // check if sidebar content is visible + await expect(controller.isElementDisplayed(navLinkInSidebar)).to.be.true; + + // Close sidebar + const closeButton = await controller.findElement('#close-sidebar'); + controller.click(closeButton); + + // check if sidebar content is not visible + await expect(controller.isElementDisplayed(navLinkInSidebar)).to.be.false; + }); + } +); diff --git a/test/fixtures/e2e/bento/bento-sidebar.html b/test/fixtures/e2e/bento/bento-sidebar.html new file mode 100644 index 000000000000..aff5bf224dac --- /dev/null +++ b/test/fixtures/e2e/bento/bento-sidebar.html @@ -0,0 +1,133 @@ + + + + + Bento Sidebar + + + + + +

Sidebar

+ + + +
+
+ +
+

+ These are the voyages of the Starship Enterprise. Its continuing + mission, to explore strange new worlds, to seek out new life and new + civilizations, to boldly go where no one has gone before. We need to + neutralize the homing signal. Each unit has total environmental control, + gravity, temperature, atmosphere, light, in a protective field. Sensors + show energy readings in your area. We had a forced chamber explosion in + the resonator coil. Field strength has increased by 3,000 percent. +

+ +

+ Shields up. I recommend we transfer power to phasers and arm the photon + torpedoes. Something strange on the detector circuit. The weapons must + have disrupted our communicators. You saw something as tasty as meat, + but inorganically materialized out of patterns used by our transporters. + Captain, the most elementary and valuable statement in science, the + beginning of wisdom, is 'I do not know.' All transporters off. +

+ +

+ Communication is not possible. The shuttle has no power. Using the + gravitational pull of a star to slingshot back in time? We are going to + Starbase Montgomery for Engineering consultations prompted by minor + read-out anomalies. Probes have recorded unusual levels of geological + activity in all five planetary systems. Assemble a team. Look at records + of the Drema quadrant. Would these scans detect artificial transmissions + as well as natural signals? +

+ +

+ Deflector power at maximum. Energy discharge in six seconds. Warp + reactor core primary coolant failure. Fluctuate phaser resonance + frequencies. Resistance is futile. Recommend we adjust shield harmonics + to the upper EM band when proceeding. These appear to be some kind of + power-wave-guide conduits which allow them to work collectively as they + perform ship functions. Increase deflector modulation to upper frequency + band. +

+ +

+ Exceeding reaction chamber thermal limit. We have begun power-supply + calibration. Force fields have been established on all turbo lifts and + crawlways. Computer, run a level-two diagnostic on warp-drive systems. + Antimatter containment positive. Warp drive within normal parameters. I + read an ion trail characteristic of a freighter escape pod. The bomb had + a molecular-decay detonator. Detecting some unusual fluctuations in + subspace frequencies. +

+ +

+ Sensors indicate human life forms 30 meters below the planet's surface. + Stellar flares are increasing in magnitude and frequency. Set course for + Rhomboid Dronegar 006, warp seven. There's no evidence of an advanced + communication network. Total guidance system failure, with less than 24 + hours' reserve power. Shield effectiveness has been reduced 12 percent. + We have covered the area in a spherical pattern which a ship without + warp drive could cross in the given time. +

+ +

+ It indicates a synchronic distortion in the areas emanating triolic + waves. The cerebellum, the cerebral cortex, the brain stem, the entire + nervous system has been depleted of electrochemical energy. Any device + like that would produce high levels of triolic waves. These walls have + undergone some kind of selective molecular polarization. I haven't + determined if our phaser energy can generate a stable field. We could + alter the photons with phase discriminators. +

+
+ + + +