Skip to content

Commit 918537a

Browse files
committed
Stop using findByRole for region
Fixes failing tests
1 parent cca86c7 commit 918537a

File tree

5 files changed

+6
-5
lines changed

5 files changed

+6
-5
lines changed

__tests__/integration/mirador/tests/annotations.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ describe('Annotations in Mirador', () => {
1313
setupIntegrationTestViewer(config);
1414

1515
it('Loads the manifest', async () => {
16-
const element = await screen.findByRole('region', { name: /Window: Self-Portrait Dedicated to Paul Gauguin/i });
16+
const element = await screen.findByLabelText(/Window: Self-Portrait Dedicated to Paul Gauguin/i)
1717
expect(element).toBeInTheDocument();
1818
});
1919

__tests__/integration/mirador/tests/minimalist.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ describe('Minimalist configuration to Mirador', () => {
77
setupIntegrationTestViewer(config);
88

99
it('Loads a manifest and displays it without some of the default controls', async () => {
10-
expect(await screen.findByRole('region', { name: /Window: Self-Portrait Dedicated to Paul Gauguin/i })).toBeInTheDocument();
10+
expect(await screen.findByLabelText(/Window: Self-Portrait Dedicated to Paul Gauguin/i)).toBeInTheDocument();
1111

1212
const infoButton = await screen.findByRole('tab', { name: /Information/i });
1313
expect(infoButton).toBeInTheDocument();

__tests__/integration/mirador/tests/thumbnail-navigation.test.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ describe('Canvas navigation by clicking thumbnails', () => {
1010
/* eslint-disable */
1111
it.skip('navigates a manifest using thumbnail navigation', async (context) => {
1212
// Make sure we have the manifest
13-
const windowElement = await screen.findByRole('region', { name: /Window: Bodleian Library MS. Ind. Inst. Misc. 22/i });
13+
const windowElement = await screen.findByLabelText(/Window: Bodleian Library MS. Ind. Inst. Misc. 22/i);
14+
1415
expect(windowElement).toBeInTheDocument();
1516

1617
const windowId = windowElement.getAttribute('id');

__tests__/integration/mirador/tests/viewer-config.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ describe('initialViewerConfig', () => {
88

99
describe('initialViewerConfig', () => {
1010
it('allows initialViewerConfig to be passed', async (context) => {
11-
expect(await screen.findByRole('region', { name: /Window: Self-Portrait Dedicated to Paul Gauguin/i })).toBeInTheDocument();
11+
expect(await screen.findByLabelText(/Window: Self-Portrait Dedicated to Paul Gauguin/i)).toBeInTheDocument();
1212

1313
let viewerObject;
1414
await waitFor(() => {

__tests__/integration/mirador/tests/window-actions.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ describe('Window actions', () => {
77
setupIntegrationTestViewer(config);
88

99
it('Closes a Mirador window', async () => {
10-
expect(await screen.findByRole('region', { name: /Window: Self-Portrait Dedicated to Paul Gauguin/i })).toBeInTheDocument();
10+
expect(await screen.findByLabelText(/Window: Self-Portrait Dedicated to Paul Gauguin/i)).toBeInTheDocument();
1111
const closeButton = screen.getByRole('button', { name: /Close window/i });
1212
fireEvent.click(closeButton);
1313
await waitFor(() => expect(screen.queryByRole('region', { name: /Window: Self-Portrait Dedicated to Paul Gauguin/i })).not.toBeInTheDocument());

0 commit comments

Comments
 (0)