sleep.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. import * as process from 'node:process'
  2. import { describe, it, before, after } from 'mocha'
  3. import { expect } from 'chai'
  4. import { By, Condition } from 'selenium-webdriver'
  5. import {
  6. takeScreenshot,
  7. findExecutionDialog,
  8. requireExecutionDialogStatus,
  9. getRootAndWait,
  10. getActionButton
  11. } from '../lib/elements.js'
  12. describe('config: sleep', function () {
  13. before(async function () {
  14. await runner.start('sleep')
  15. })
  16. after(async () => {
  17. await runner.stop()
  18. })
  19. it('Sleep action kill', async function() {
  20. await getRootAndWait()
  21. const btnSleep = await getActionButton(webdriver, "Sleep")
  22. const dialog = await findExecutionDialog(webdriver)
  23. expect(await dialog.isDisplayed()).to.be.false
  24. await btnSleep.click()
  25. expect(await dialog.isDisplayed()).to.be.true
  26. await requireExecutionDialogStatus(webdriver, "unknown")
  27. const killButton = await webdriver.findElement(By.id('execution-dialog-kill-action'))
  28. expect(killButton).to.not.be.undefined
  29. await killButton.click()
  30. console.log("env CI:", process.env.CI)
  31. if (process.env.CI !== 'true') {
  32. await requireExecutionDialogStatus(webdriver, "Non-Zero Exit")
  33. }
  34. })
  35. })