4
0

general.mjs 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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 { getRootAndWait, getActionButtons } from '../lib/elements.js'
  6. describe('config: general', function () {
  7. before(async function () {
  8. await runner.start('general')
  9. })
  10. after(async () => {
  11. await runner.stop()
  12. })
  13. it('Page title', async function () {
  14. await webdriver.get(runner.baseUrl())
  15. const title = await webdriver.getTitle()
  16. expect(title).to.be.equal("OliveTin")
  17. })
  18. it('Page title2', async function () {
  19. /*
  20. await webdriver.get(runner.baseUrl())
  21. const title = await webdriver.getTitle()
  22. expect(title).to.be.equal("OliveTin")
  23. */
  24. })
  25. it('Footer contains promo', async function () {
  26. const ftr = await webdriver.findElement(By.tagName('footer')).getText()
  27. expect(ftr).to.contain('Documentation')
  28. })
  29. it('Default buttons are rendered', async function() {
  30. await getRootAndWait()
  31. const buttons = await getActionButtons(webdriver)
  32. expect(buttons).to.have.length(8)
  33. })
  34. it('Start date action (popup)', async function() {
  35. await getRootAndWait()
  36. const buttons = await webdriver.findElements(By.css('[title="date-popup"]'))
  37. expect(buttons).to.have.length(1)
  38. const buttonDate = buttons[0]
  39. expect(buttonDate).to.not.be.null
  40. buttonDate.click()
  41. const dialog = await webdriver.findElement(By.id('execution-results-popup'))
  42. expect(await dialog.isDisplayed()).to.be.true
  43. const title = await webdriver.findElement(By.id('execution-dialog-title'))
  44. expect(await title.getAttribute('innerText')).to.be.equal('date-popup')
  45. const dialogErr = await webdriver.findElement(By.id('big-error'))
  46. expect(dialogErr).to.not.be.null
  47. expect(await dialogErr.isDisplayed()).to.be.false
  48. })
  49. it('Start date action (passive)', async function() {
  50. await getRootAndWait()
  51. const buttons = await webdriver.findElements(By.css('[title="date-passive"]'))
  52. expect(buttons).to.have.length(1)
  53. const buttonDate = buttons[0]
  54. expect(buttonDate).to.not.be.null
  55. buttonDate.click()
  56. const dialog = await webdriver.findElement(By.id('execution-results-popup'))
  57. expect(await dialog.isDisplayed()).to.be.false
  58. const title = await webdriver.findElement(By.id('execution-dialog-title'))
  59. expect(await title.getAttribute('innerText')).to.be.equal('?')
  60. const dialogErr = await webdriver.findElement(By.id('big-error'))
  61. expect(dialogErr).to.not.be.null
  62. expect(await dialogErr.isDisplayed()).to.be.false
  63. })
  64. })