topbarNavigation.mjs 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. import { By, until } from 'selenium-webdriver'
  2. import { expect } from 'chai'
  3. import {
  4. getRootAndWait,
  5. takeScreenshotOnFailure,
  6. } from '../../lib/elements.js'
  7. describe('config: sectionNavigationStyle topbar', function () {
  8. let originalWindowRect
  9. before(async function () {
  10. originalWindowRect = await webdriver.manage().window().getRect()
  11. await runner.start('topbarNavigation')
  12. })
  13. after(async () => {
  14. await webdriver.manage().window().setRect(originalWindowRect)
  15. await runner.stop()
  16. })
  17. afterEach(function () {
  18. takeScreenshotOnFailure(this.currentTest, webdriver)
  19. })
  20. it('shows dashboard links in the top bar', async () => {
  21. await webdriver.manage().window().setRect({ width: 1600, height: 900 })
  22. await getRootAndWait()
  23. const betaLink = await webdriver.wait(
  24. until.elementLocated(By.xpath("//nav[contains(@class, 'topbar')]//a[contains(., 'Beta')]")),
  25. 5000
  26. )
  27. await betaLink.click()
  28. await webdriver.wait(until.urlContains('Beta'), 5000)
  29. expect(await webdriver.getCurrentUrl()).to.contain('Beta')
  30. })
  31. })