Skip to content
Snippets Groups Projects
Select Git revision
  • 73bff104c91b1171fb78247fa0e33c7bbe874650
  • annotation-on-video default protected
  • demo_ci
  • 3-upstream-01022023
  • master
  • gh3538-captions
  • 16-adapt-for-images-annot
  • 15-api-for-annotations-on-video
  • 15-annotations-on-videos
  • video_for_annotations
  • wip-1-annotations-on-videos
  • 9-videoviewer-tests
  • 9_wip_videotests
  • 6-fix-tests-and-ci
  • _fix_ci
  • wip-webpack-from-git
16 results

invalid-api-response.test.js

Blame
  • invalid-api-response.test.js 1.51 KiB
    describe('Mirador Invalid API Response Handler Test', () => {
      /** */
      async function fetchManifest(uri) {
        await page.evaluate(() => {
          document.querySelector('#addBtn').click();
        });
    
        await page.evaluate(() => {
          document.querySelector('.mirador-add-resource-button').click();
        });
        await page.waitForTimeout(50);
        await expect(page).toFill('#manifestURL', uri);
    
        await expect(page).toClick('#fetchBtn');
      }
    
      beforeEach(async () => {
        await page.goto('http://127.0.0.1:4488/__tests__/integration/mirador/blank.html');
      });
      it('breaks Mirador', async () => {
        await fetchManifest('http://127.0.0.1:4488/invalid');
        await expect(page).toMatchElement('li', { text: 'http://127.0.0.1:4488/invalid', timeout: 2000 });
      }, 10000);
    
      it('renders an error message when a manifest cannot be loaded (and allows it to be dismissed)', async () => {
        await fetchManifest('http://127.0.0.1:4488/__tests__/fixtures/version-2/broken');
    
        await expect(page).toMatchElement('p', { text: 'The resource cannot be added:', timeout: 2000 });
        await expect(page).toMatchElement('p', { text: 'http://127.0.0.1:4488/__tests__/fixtures/version-2/broken' });
    
        await expect(page).toClick('button', { text: 'Dismiss' });
    
        await page.waitForFunction(() => !document.querySelector('li[data-manifestid="http://127.0.0.1:4488/__tests__/fixtures/version-2/broken"]'));
    
        await expect(page).not.toMatchElement(
          'p',
          { text: 'The resource cannot be added:', timeout: 2000 },
        );
      }, 10000);
    });