multipleDropdowns.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. import { describe, it, before, after } from 'mocha'
  2. import { expect } from 'chai'
  3. import { By, until } from 'selenium-webdriver'
  4. import {
  5. getRootAndWait,
  6. getActionButtons,
  7. takeScreenshotOnFailure,
  8. } from '../lib/elements.js'
  9. describe('config: multipleDropdowns', function () {
  10. before(async function () {
  11. await runner.start('multipleDropdowns')
  12. })
  13. after(async () => {
  14. await runner.stop()
  15. })
  16. afterEach(function () {
  17. takeScreenshotOnFailure(this.currentTest, webdriver);
  18. });
  19. it('Multiple dropdowns are possible', async function() {
  20. await getRootAndWait()
  21. const buttons = await getActionButtons()
  22. let button = null
  23. for (const b of buttons) {
  24. const title = await b.getAttribute('title')
  25. if (title === 'Test multiple dropdowns') {
  26. button = b
  27. }
  28. }
  29. expect(buttons).to.have.length(2)
  30. expect(button).to.not.be.null
  31. await button.click()
  32. const dialog = await webdriver.findElement(By.id('argument-popup'))
  33. await webdriver.wait(until.elementIsVisible(dialog), 3500)
  34. const selects = await dialog.findElements(By.tagName('select'))
  35. expect(selects).to.have.length(2)
  36. expect(await selects[0].findElements(By.tagName('option'))).to.have.length(2)
  37. expect(await selects[1].findElements(By.tagName('option'))).to.have.length(3)
  38. })
  39. })