dashboardsWithBasicFieldsets.js 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. import { describe, it, before, after } from 'mocha'
  2. import { expect } from 'chai'
  3. import { By, until, Condition } from 'selenium-webdriver'
  4. //import * as waitOn from 'wait-on'
  5. import {
  6. getRootAndWait,
  7. getActionButtons,
  8. openSidebar,
  9. getNavigationLinks,
  10. takeScreenshotOnFailure,
  11. } from '../lib/elements.js'
  12. describe('config: dashboards with basic fieldsets', function () {
  13. before(async function () {
  14. await runner.start('dashboardsWithBasicFieldsets')
  15. })
  16. after(async () => {
  17. await runner.stop()
  18. })
  19. afterEach(function () {
  20. takeScreenshotOnFailure(this.currentTest, webdriver);
  21. });
  22. it('Dashboards with basic fieldsets', async function () {
  23. await getRootAndWait()
  24. const title = await webdriver.getTitle()
  25. expect(title).to.be.equal("OliveTin » Test")
  26. const navigationLinks = await getNavigationLinks()
  27. expect(navigationLinks.length).to.be.equal(2, 'Expected the nav to only have 2 links')
  28. const firstLink = await navigationLinks[0]
  29. expect(await firstLink.getAttribute('id')).to.be.equal('showActions', 'Expected the first link to be the actions link')
  30. expect(await firstLink.isDisplayed()).to.be.false
  31. const secondLink = await navigationLinks[1]
  32. expect(await secondLink.getAttribute('href')).to.be.equal('http://localhost:1337/Test', 'Expected the second link to be the test dashboard with basic fieldsets link')
  33. const actionButtons = await getActionButtons('Test')
  34. expect(actionButtons).to.have.length(5, 'Expected 5 action buttons')
  35. const fieldsets = await webdriver.findElements(By.css('section[title="Test"] fieldset'))
  36. expect(fieldsets).to.have.length(3, 'Expected 3 fieldsets in the Test dashboard')
  37. })
  38. })