how-tos.test.js 946 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. import path from 'path';
  2. import SeleniumHelper from '../helpers/selenium-helper';
  3. const {
  4. clickText,
  5. clickXpath,
  6. findByXpath,
  7. getDriver,
  8. getLogs,
  9. loadUri
  10. } = new SeleniumHelper();
  11. const uri = path.resolve(__dirname, '../../build/index.html');
  12. let driver;
  13. describe('Working with the how-to library', () => {
  14. beforeAll(() => {
  15. driver = getDriver();
  16. });
  17. afterAll(async () => {
  18. await driver.quit();
  19. });
  20. test('Choosing a how-to', async () => {
  21. await loadUri(uri);
  22. await clickText('Costumes');
  23. await clickXpath('//*[@aria-label="Tutorials"]');
  24. await clickText('Getting Started'); // Modal should close
  25. // Make sure YouTube video on first card appears
  26. await findByXpath('//div[contains(@class, "step-video")]');
  27. const logs = await getLogs();
  28. await expect(logs).toEqual([]);
  29. });
  30. // @todo navigating cards, etc.
  31. });