sleep.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. takeScreenshotOnFailure,
  8. findExecutionDialog,
  9. requireExecutionDialogStatus,
  10. getRootAndWait,
  11. getActionButton
  12. } from '../../lib/elements.js'
  13. describe('config: sleep', function () {
  14. before(async function () {
  15. await runner.start('sleep')
  16. })
  17. after(async () => {
  18. await runner.stop()
  19. })
  20. afterEach(function () {
  21. takeScreenshotOnFailure(this.currentTest, webdriver);
  22. });
  23. it('Sleep action kill', async function() {
  24. await getRootAndWait()
  25. const btnSleep = await getActionButton(webdriver, "Sleep")
  26. await btnSleep.click()
  27. await webdriver.sleep(1000)
  28. const dialog = await findExecutionDialog(webdriver)
  29. expect(await dialog.isDisplayed()).to.be.true
  30. await requireExecutionDialogStatus(webdriver, "Still running...")
  31. const killButton = await webdriver.findElement(By.id('execution-dialog-kill-action'))
  32. expect(killButton).to.not.be.undefined
  33. await killButton.click()
  34. await requireExecutionDialogStatus(webdriver, "Completed (Exit code: -1)")
  35. })
  36. })