4
0

include.mjs 1.5 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: include', function () {
  10. this.timeout(30000)
  11. before(async function () {
  12. await runner.start('include')
  13. })
  14. after(async () => {
  15. await runner.stop()
  16. })
  17. afterEach(function () {
  18. takeScreenshotOnFailure(this.currentTest, webdriver);
  19. });
  20. it('Should load actions from base config and included files', async function () {
  21. await getRootAndWait()
  22. // Wait for the page to be ready
  23. await webdriver.wait(until.elementLocated(By.css('.action-button')), 10000)
  24. const buttons = await getActionButtons()
  25. // We should have:
  26. // 1. Base Action from config.yaml
  27. // 2. First Included Action from 00-first.yml
  28. // 3. Second Included Action from 01-second.yml
  29. expect(buttons.length).to.be.at.least(3, 'Should have at least 3 actions from base + includes')
  30. // Verify all actions are present
  31. const buttonTexts = await Promise.all(buttons.map(btn => btn.getText()))
  32. console.log('Found actions:', buttonTexts)
  33. // Text includes newline, so check with includes
  34. const allText = buttonTexts.join(' ')
  35. expect(allText).to.include('Base Action')
  36. expect(allText).to.include('First Included Action')
  37. expect(allText).to.include('Second Included Action')
  38. console.log('✓ Include directive loaded actions from all files')
  39. })
  40. })