forked from ampproject/amphtml
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(bento-sidebar): added e2e test (ampproject#36644)
updated sidebar docs to remove async tag on bento.js added new selenium controller to see if element is displayed
- Loading branch information
1 parent
9f35056
commit a42379a
Showing
3 changed files
with
180 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
}); | ||
} | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<title>Bento Sidebar</title> | ||
<meta | ||
name="viewport" | ||
content="width=device-width,minimum-scale=1,initial-scale=1" | ||
/> | ||
<script src="https://cdn.ampproject.org/bento.js"></script> | ||
<script | ||
async | ||
src="https://cdn.ampproject.org/v0/bento-sidebar-1.0.js" | ||
></script> | ||
</head> | ||
<body> | ||
<h1>Sidebar</h1> | ||
<bento-sidebar> | ||
<nav> | ||
<button id="close-sidebar">Close sidebar</button> | ||
<h2>Navigation</h2> | ||
<ul> | ||
<li> | ||
<a href="#bridge">Bridge</a> | ||
</li> | ||
<li> | ||
<a href="#10forward">10 Forward</a> | ||
</li> | ||
<li> | ||
<a href="#sickbay">Sickbay</a> | ||
</li> | ||
<li> | ||
<a href="#engineering">Engineering</a> | ||
</li> | ||
<li> | ||
<a href="#arboretum">Arboretum</a> | ||
</li> | ||
<li> | ||
<a href="#cetacean-ops">Cetacean Ops</a> | ||
</li> | ||
<li> | ||
<a href="#shuttlebay">Shuttlebay</a> | ||
</li> | ||
</ul> | ||
</nav> | ||
</bento-sidebar> | ||
<main> | ||
<div class="buttons" style="margin-top: 8px"> | ||
<button id="open-sidebar">Open sidebar</button> | ||
</div> | ||
<p id="bridge"> | ||
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. | ||
</p> | ||
|
||
<p id="10forward"> | ||
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. | ||
</p> | ||
|
||
<p id="sickbay"> | ||
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? | ||
</p> | ||
|
||
<p id="engineering"> | ||
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. | ||
</p> | ||
|
||
<p id="arboretum"> | ||
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. | ||
</p> | ||
|
||
<p id="cetacean-ops"> | ||
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. | ||
</p> | ||
|
||
<p id="shuttlebay"> | ||
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. | ||
</p> | ||
</main> | ||
|
||
<script> | ||
(async () => { | ||
const sidebar = document.querySelector('bento-sidebar'); | ||
await customElements.whenDefined('bento-sidebar'); | ||
const api = await sidebar.getApi(); | ||
|
||
// set up button actions | ||
document.querySelector('#open-sidebar').onclick = () => api.open(); | ||
document.querySelector('#close-sidebar').onclick = () => api.close(); | ||
})(); | ||
</script> | ||
</body> | ||
</html> |