-
Notifications
You must be signed in to change notification settings - Fork 257
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4062 from ProjectMirador/flaky-viewer-test-debug
Fix CI testing flakiness
- Loading branch information
Showing
3 changed files
with
18 additions
and
13 deletions.
There are no files selected for viewing
3 changes: 0 additions & 3 deletions
3
__tests__/integration/mirador/mirador-configs/initial-viewer-config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,25 @@ | ||
import { expect, it } from 'vitest'; | ||
import { screen } from '@testing-library/react'; | ||
import { screen, waitFor } from '@testing-library/react'; | ||
import { setupIntegrationTestViewer } from '@tests/utils/test-utils'; | ||
import config from '../mirador-configs/initial-viewer-config'; | ||
|
||
describe('initialViewerConfig', () => { | ||
setupIntegrationTestViewer(config); | ||
|
||
it('allows initialViewerConfig to be passed', async (context) => { | ||
expect(await screen.findByRole('region', { name: /Window: Self-Portrait Dedicated to Paul Gauguin/i })).toBeInTheDocument(); | ||
describe('initialViewerConfig', () => { | ||
it('allows initialViewerConfig to be passed', async (context) => { | ||
expect(await screen.findByRole('region', { name: /Window: Self-Portrait Dedicated to Paul Gauguin/i })).toBeInTheDocument(); | ||
|
||
const { viewers } = context.miradorInstance.store.getState(); | ||
const viewerObject = viewers[Object.keys(viewers)[0]]; | ||
// You can see these values passed in initial-viewer-config.js | ||
expect(viewerObject.x).toBe(934); | ||
expect(viewerObject.y).toBe(782); | ||
expect(viewerObject.zoom).toBe(0.0007); | ||
let viewerObject; | ||
await waitFor(() => { | ||
const { viewers = {} } = context.miradorInstance.store.getState(); | ||
viewerObject = viewers[Object.keys(viewers)[0]]; | ||
expect(viewerObject?.x).toBe(934); | ||
}, { timeout: 3000 }); | ||
|
||
expect(viewerObject.x).toBe(934); | ||
expect(viewerObject.y).toBe(782); | ||
expect(viewerObject.zoom).toBe(0.0007); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters