Skip to content
Snippets Groups Projects
Commit 7ec54f22 authored by Chris Beer's avatar Chris Beer
Browse files

waitFor is deprecated in favor of more specific functions

parent bb95c12d
Branches
No related tags found
No related merge requests found
Showing
with 14 additions and 14 deletions
...@@ -6,7 +6,7 @@ describe('Companion Windows', () => { ...@@ -6,7 +6,7 @@ describe('Companion Windows', () => {
await expect(page).toFill('#manifestURL', 'http://127.0.0.1:4488/__tests__/fixtures/version-2/001.json'); await expect(page).toFill('#manifestURL', 'http://127.0.0.1:4488/__tests__/fixtures/version-2/001.json');
await expect(page).toClick('#fetchBtn'); await expect(page).toClick('#fetchBtn');
await expect(page).toClick('[data-manifestid="http://127.0.0.1:4488/__tests__/fixtures/version-2/001.json"] button'); await expect(page).toClick('[data-manifestid="http://127.0.0.1:4488/__tests__/fixtures/version-2/001.json"] button');
await page.waitFor(300); await page.waitForTimeout(300);
await expect(page).toMatchElement('.mirador-window'); await expect(page).toMatchElement('.mirador-window');
}); });
......
...@@ -8,7 +8,7 @@ describe('Mirador Invalid API Response Handler Test', () => { ...@@ -8,7 +8,7 @@ describe('Mirador Invalid API Response Handler Test', () => {
await page.evaluate(() => { await page.evaluate(() => {
document.querySelector('.mirador-add-resource-button').click(); document.querySelector('.mirador-add-resource-button').click();
}); });
await page.waitFor(50); await page.waitForTimeout(50);
await expect(page).toFill('#manifestURL', uri); await expect(page).toFill('#manifestURL', uri);
await expect(page).toClick('#fetchBtn'); await expect(page).toClick('#fetchBtn');
...@@ -34,7 +34,7 @@ describe('Mirador Invalid API Response Handler Test', () => { ...@@ -34,7 +34,7 @@ describe('Mirador Invalid API Response Handler Test', () => {
await expect(page).toClick('button', { text: 'Dismiss' }); await expect(page).toClick('button', { text: 'Dismiss' });
await page.waitFor(() => !document.querySelector('li[data-manifestid="http://127.0.0.1:4488/__tests__/fixtures/version-2/broken"]')); await page.waitForFunction(() => !document.querySelector('li[data-manifestid="http://127.0.0.1:4488/__tests__/fixtures/version-2/broken"]'));
await expect(page).not.toMatchElement( await expect(page).not.toMatchElement(
'p', 'p',
......
...@@ -16,7 +16,7 @@ describe('Language Switching', () => { ...@@ -16,7 +16,7 @@ describe('Language Switching', () => {
await expect(page).toMatchElement('[aria-label="Start Here"]'); await expect(page).toMatchElement('[aria-label="Start Here"]');
await expect(page).not.toMatchElement('[aria-label="Hier starten"]'); await expect(page).not.toMatchElement('[aria-label="Hier starten"]');
await expect(page).toClick('li', { text: 'Deutsch' }); await expect(page).toClick('li', { text: 'Deutsch' });
await page.waitFor(1000); await page.waitForTimeout(1000);
await expect(page).not.toMatchElement('[aria-label="Start Here"]'); await expect(page).not.toMatchElement('[aria-label="Start Here"]');
await expect(page).toMatchElement('[aria-label="Hier starten"]'); await expect(page).toMatchElement('[aria-label="Hier starten"]');
}); });
......
...@@ -2,7 +2,7 @@ describe('add two plugins to <WorkspaceControlPanelButtons>', () => { ...@@ -2,7 +2,7 @@ describe('add two plugins to <WorkspaceControlPanelButtons>', () => {
beforeAll(async () => { beforeAll(async () => {
await page.goto('http://127.0.0.1:4488/__tests__/integration/mirador/plugins/add.html'); await page.goto('http://127.0.0.1:4488/__tests__/integration/mirador/plugins/add.html');
await expect(page).toMatchElement('.mirador-viewer'); await expect(page).toMatchElement('.mirador-viewer');
await page.waitFor(1000); await page.waitForTimeout(1000);
}); });
it('all add plugins will be added to <WorkspaceControlPanelButtons>', async () => { it('all add plugins will be added to <WorkspaceControlPanelButtons>', async () => {
......
...@@ -2,13 +2,13 @@ describe('add plugins for companion windows', () => { ...@@ -2,13 +2,13 @@ describe('add plugins for companion windows', () => {
beforeAll(async () => { beforeAll(async () => {
await page.goto('http://127.0.0.1:4488/__tests__/integration/mirador/plugins/companionWindow.html'); await page.goto('http://127.0.0.1:4488/__tests__/integration/mirador/plugins/companionWindow.html');
await expect(page).toMatchElement('.mirador-viewer'); await expect(page).toMatchElement('.mirador-viewer');
await page.waitFor(1000); await page.waitForTimeout(1000);
}); });
it('added a plugin to the window sidebar and companion window', async () => { it('added a plugin to the window sidebar and companion window', async () => {
await expect(page).toClick('button[aria-label="Toggle sidebar"]'); await expect(page).toClick('button[aria-label="Toggle sidebar"]');
await page.waitFor(1000); await page.waitForTimeout(1000);
await expect(page).toMatchElement('.mirador-companion-window-left.mirador-window-sidebar-info-panel'); await expect(page).toMatchElement('.mirador-companion-window-left.mirador-window-sidebar-info-panel');
await expect(page).toMatchElement('#add-plugin-companion-window-button'); await expect(page).toMatchElement('#add-plugin-companion-window-button');
......
...@@ -2,7 +2,7 @@ describe('try to apply 2 add plugins and 2 wrap plugins to <WorkspaceControlPane ...@@ -2,7 +2,7 @@ describe('try to apply 2 add plugins and 2 wrap plugins to <WorkspaceControlPane
beforeAll(async () => { beforeAll(async () => {
await page.goto('http://127.0.0.1:4488/__tests__/integration/mirador/plugins/priority.html'); await page.goto('http://127.0.0.1:4488/__tests__/integration/mirador/plugins/priority.html');
await expect(page).toMatchElement('.mirador-viewer'); await expect(page).toMatchElement('.mirador-viewer');
await page.waitFor(1000); await page.waitForTimeout(1000);
}); });
it('only apply the first wrap plugin', async () => { it('only apply the first wrap plugin', async () => {
......
...@@ -4,7 +4,7 @@ describe('how plugins relate to state', () => { ...@@ -4,7 +4,7 @@ describe('how plugins relate to state', () => {
beforeAll(async () => { beforeAll(async () => {
await page.goto('http://127.0.0.1:4488/__tests__/integration/mirador/plugins/state.html'); await page.goto('http://127.0.0.1:4488/__tests__/integration/mirador/plugins/state.html');
await expect(page).toMatchElement('.mirador-viewer'); await expect(page).toMatchElement('.mirador-viewer');
await page.waitFor(1000); await page.waitForTimeout(1000);
}); });
it('plugin can read from state', async () => { it('plugin can read from state', async () => {
......
...@@ -2,7 +2,7 @@ describe('pass valid and invalid plugins to <WorkspaceControlPanelButtons>', () ...@@ -2,7 +2,7 @@ describe('pass valid and invalid plugins to <WorkspaceControlPanelButtons>', ()
beforeAll(async () => { beforeAll(async () => {
await page.goto('http://127.0.0.1:4488/__tests__/integration/mirador/plugins/validate.html'); await page.goto('http://127.0.0.1:4488/__tests__/integration/mirador/plugins/validate.html');
await expect(page).toMatchElement('.mirador-viewer'); await expect(page).toMatchElement('.mirador-viewer');
await page.waitFor(1000); await page.waitForTimeout(1000);
}); });
it('valid plugins will be applied <WorkspaceControlPanelButtons>', async () => { it('valid plugins will be applied <WorkspaceControlPanelButtons>', async () => {
......
...@@ -2,7 +2,7 @@ describe('wrap <WorkspaceControlPanelButtons> by a plugin', () => { ...@@ -2,7 +2,7 @@ describe('wrap <WorkspaceControlPanelButtons> by a plugin', () => {
beforeAll(async () => { beforeAll(async () => {
await page.goto('http://127.0.0.1:4488/__tests__/integration/mirador/plugins/wrap.html'); await page.goto('http://127.0.0.1:4488/__tests__/integration/mirador/plugins/wrap.html');
await expect(page).toMatchElement('.mirador-viewer'); await expect(page).toMatchElement('.mirador-viewer');
await page.waitFor(1000); await page.waitForTimeout(1000);
}); });
it('wraps <WorkspaceControlPanelButtons>', async () => { it('wraps <WorkspaceControlPanelButtons>', async () => {
......
...@@ -12,7 +12,7 @@ describe('Thumbnail navigation', () => { ...@@ -12,7 +12,7 @@ describe('Thumbnail navigation', () => {
miradorInstance.store.getState().windows miradorInstance.store.getState().windows
)); ));
expect(Object.values(windows)[0].canvasId).toBe('https://iiif.harvardartmuseums.org/manifests/object/299843/canvas/canvas-47174892'); // test harness in index.html starts at 2 expect(Object.values(windows)[0].canvasId).toBe('https://iiif.harvardartmuseums.org/manifests/object/299843/canvas/canvas-47174892'); // test harness in index.html starts at 2
await page.waitFor(1000); await page.waitForTimeout(1000);
await expect(page).toClick('.mirador-thumbnail-nav-canvas-1 img'); await expect(page).toClick('.mirador-thumbnail-nav-canvas-1 img');
await expect(page).toMatchElement('.mirador-thumbnail-nav-canvas-1.mirador-current-canvas-grouping', { timeout: 1500 }); await expect(page).toMatchElement('.mirador-thumbnail-nav-canvas-1.mirador-current-canvas-grouping', { timeout: 1500 });
windows = await page.evaluate(() => ( windows = await page.evaluate(() => (
......
...@@ -12,12 +12,12 @@ describe('Window actions', () => { ...@@ -12,12 +12,12 @@ describe('Window actions', () => {
await expect(page).toClick('[data-manifestid="http://127.0.0.1:4488/__tests__/fixtures/version-2/sn904cj3429.json"] button'); await expect(page).toClick('[data-manifestid="http://127.0.0.1:4488/__tests__/fixtures/version-2/sn904cj3429.json"] button');
await expect(page).toMatchElement('.mirador-window'); await expect(page).toMatchElement('.mirador-window');
await page.waitFor(1000); await page.waitForTimeout(1000);
await expect(page).toClick('.mirador-window-close'); await expect(page).toClick('.mirador-window-close');
const numWindows = await page.evaluate(page => ( const numWindows = await page.evaluate(page => (
document.querySelectorAll('.mirador-window').length document.querySelectorAll('.mirador-window').length
)); // only default configed windows found )); // only default configed windows found
await page.waitFor(1000); await page.waitForTimeout(1000);
await expect(numWindows).toBe(0); await expect(numWindows).toBe(0);
}); });
}); });
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment