4
0

entityFilesWithLongIntsUseStandardForm.js 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. // Issue: https://github.com/OliveTin/OliveTin/issues/616
  2. import { describe, it, before, after } from 'mocha'
  3. import { expect } from 'chai'
  4. import { By, until, Condition } from 'selenium-webdriver'
  5. import {
  6. getRootAndWait,
  7. getActionButtons,
  8. takeScreenshotOnFailure,
  9. } from '../../lib/elements.js'
  10. describe('config: entities', function () {
  11. before(async function () {
  12. await runner.start('entityFilesWithLongIntsUseStandardForm')
  13. })
  14. after(async () => {
  15. await runner.stop()
  16. })
  17. afterEach(function () {
  18. takeScreenshotOnFailure(this.currentTest, webdriver);
  19. });
  20. it('Entity buttons are rendered', async function() {
  21. await getRootAndWait()
  22. const buttons = await getActionButtons()
  23. expect(buttons).to.not.be.null
  24. expect(buttons).to.have.length(5)
  25. // Entity buttons are in numeric key order (0,1,2,3,4); first row is "INT with 10 numbers"
  26. const buttonInt10 = await buttons[0]
  27. expect(await buttonInt10.getAttribute('title')).to.be.equal('Test me INT with 10 numbers')
  28. await buttonInt10.click()
  29. // Wait for navigation to execution view
  30. await webdriver.wait(new Condition('wait for execution view', async () => {
  31. const url = await webdriver.getCurrentUrl()
  32. return url.includes('/logs/') && !url.endsWith('/logs')
  33. }), 10000)
  34. // Wait for execution to complete - look for the execution status
  35. await webdriver.wait(new Condition('wait for execution status', async () => {
  36. const statusElement = await webdriver.findElements(By.id('execution-dialog-status'))
  37. return statusElement.length > 0
  38. }), 15000)
  39. // Check that the execution completed successfully by looking at the status
  40. const statusElement = await webdriver.findElement(By.id('execution-dialog-status'))
  41. const statusText = await statusElement.getText()
  42. // The status should indicate success (not "Executing..." or "Failed")
  43. expect(statusText).to.not.include('Executing')
  44. expect(statusText).to.not.include('Failed')
  45. // Verify that we're on the execution page by checking the URL
  46. const currentUrl = await webdriver.getCurrentUrl()
  47. expect(currentUrl).to.include('/logs/')
  48. expect(currentUrl).to.not.equal(runner.baseUrl() + '/logs')
  49. });
  50. });