multipleDropdowns.js 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. import { describe, it, before, after } from 'mocha'
  2. import { expect } from 'chai'
  3. import { By, until, Condition } 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. // Wait for action buttons to be rendered
  22. await webdriver.wait(new Condition('wait for action buttons', async () => {
  23. const btns = await webdriver.findElements(By.css('.action-button button'))
  24. return btns.length >= 2
  25. }), 10000)
  26. const buttons = await getActionButtons()
  27. let button = null
  28. for (const b of buttons) {
  29. const title = await b.getAttribute('title')
  30. if (title === 'Test multiple dropdowns') {
  31. button = b
  32. }
  33. }
  34. expect(buttons).to.have.length(2)
  35. expect(button).to.not.be.null
  36. await button.click()
  37. // Wait for navigation to argument form page
  38. await webdriver.wait(new Condition('wait for argument form page', async () => {
  39. const url = await webdriver.getCurrentUrl()
  40. return url.includes('/actionBinding/') && url.includes('/argumentForm')
  41. }), 8000)
  42. const selects = await webdriver.findElements(By.css('main select'))
  43. expect(selects).to.have.length(2)
  44. expect(await selects[0].findElements(By.tagName('option'))).to.have.length(2)
  45. expect(await selects[1].findElements(By.tagName('option'))).to.have.length(3)
  46. })
  47. })