backpack.test.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import path from 'path';
  2. import SeleniumHelper from '../helpers/selenium-helper';
  3. const {
  4. clickText,
  5. getDriver,
  6. getLogs,
  7. loadUri
  8. } = new SeleniumHelper();
  9. const uri = path.resolve(__dirname, '../../build/index.html');
  10. let driver;
  11. describe('Working with the how-to library', () => {
  12. beforeAll(() => {
  13. driver = getDriver();
  14. });
  15. afterAll(async () => {
  16. await driver.quit();
  17. });
  18. test('Backpack is "Coming Soon" without backpack host param', async () => {
  19. await loadUri(uri);
  20. // Check that the backpack header is visible and wrapped in a coming soon tooltip
  21. await clickText('Backpack', '*[@data-for="backpack-tooltip"]');
  22. const logs = await getLogs();
  23. await expect(logs).toEqual([]);
  24. });
  25. test('Backpack can be expanded with backpack host param', async () => {
  26. await loadUri(`${uri}?backpack_host=https://backpack.scratch.mit.edu`);
  27. // Try activating the backpack from the costumes tab to make sure it isn't pushed off
  28. await clickText('Costumes');
  29. // Check that the backpack header is visible and wrapped in a coming soon tooltip
  30. await clickText('Backpack'); // Not wrapped in tooltip
  31. await clickText('Backpack is empty'); // Make sure it can expand, is empty
  32. const logs = await getLogs();
  33. await expect(logs).toEqual([]);
  34. });
  35. });