From 9f7e1c0eb16e98ac29f6c380034df30285656243 Mon Sep 17 00:00:00 2001 From: Alf Eaton Date: Sun, 15 Sep 2024 22:03:04 +0100 Subject: [PATCH] Fix tests GitOrigin-RevId: 739e1c1fccaa583bd3e13da96802b8c6d4164ad8 --- .../pdf-preview/pdf-js-viewer.spec.tsx | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) 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())) })