diff --git a/services/web/test/frontend/components/pdf-preview/pdf-js-viewer.spec.tsx b/services/web/test/frontend/components/pdf-preview/pdf-js-viewer.spec.tsx index bd133e7f51..f98882745b 100644 --- a/services/web/test/frontend/components/pdf-preview/pdf-js-viewer.spec.tsx +++ b/services/web/test/frontend/components/pdf-preview/pdf-js-viewer.spec.tsx @@ -6,6 +6,10 @@ import { getContainerEl } from 'cypress/react' import { unmountComponentAtNode } from 'react-dom' import { PdfPreviewProvider } from '../../../../frontend/js/features/pdf-preview/components/pdf-preview-provider' +// Unicode directional isolates, added around placeables by @fluent/bundle/esm/resolver +const FSI = '\u2068' +const PDI = '\u2069' + describe('', function () { beforeEach(function () { cy.interceptEvents() @@ -26,12 +30,12 @@ describe('', function () { ) - cy.waitForCompile() + cy.waitForCompile({ pdf: true }) - cy.findByLabelText('Page 1') - cy.findByLabelText('Page 2') - cy.findByLabelText('Page 3') - cy.findByLabelText('Page 4').should('not.exist') + cy.findByRole('region', { name: `Page ${FSI}1${PDI}` }) + cy.findByRole('region', { name: `Page ${FSI}2${PDI}` }) + cy.findByRole('region', { name: `Page ${FSI}3${PDI}` }) + cy.findByRole('region', { name: `Page ${FSI}4${PDI}` }).should('not.exist') cy.contains('Your Paper') }) @@ -53,7 +57,7 @@ describe('', function () { cy.waitForCompile() - cy.findByLabelText('Loading…') + cy.get('.page.loading') }) it('can be unmounted while loading a document', function () { @@ -91,9 +95,9 @@ describe('', function () { ) - cy.waitForCompile() + cy.waitForCompile({ pdf: true }) - cy.findByLabelText('Page 1') + cy.findByRole('region', { name: `Page ${FSI}1${PDI}` }) cy.then(() => unmountComponentAtNode(getContainerEl())) })