Просмотр исходного кода

Merge pull request #14405 from overleaf/ii-enable-tests

[web] Enable disabled tests

GitOrigin-RevId: 1b7199446849ccaf3febe51409f73d9305a93e9c
ilkin-overleaf 3 лет назад
Родитель
Сommit
1c66d2728c

+ 12 - 8
services/web/test/frontend/components/editor-left-menu/editor-left-menu.spec.tsx

@@ -14,8 +14,7 @@ describe('<EditorLeftMenu />', function () {
     cy.interceptCompile()
   })
 
-  // eslint-disable-next-line mocha/no-skipped-tests
-  describe.skip('for non-anonymous users', function () {
+  describe('for non-anonymous users', function () {
     const overallThemes: OverallThemeMeta[] = [
       {
         name: 'Overall Theme 1',
@@ -179,7 +178,7 @@ describe('<EditorLeftMenu />', function () {
             mathDisplay: 1,
             errors: 0,
           },
-        })
+        }).as('wordCount')
 
         const scope = mockScope({
           ui: {
@@ -194,6 +193,8 @@ describe('<EditorLeftMenu />', function () {
         )
 
         cy.findByRole('button', { name: 'Word Count' }).click()
+
+        cy.wait('@wordCount')
         cy.findByText('Total Words:')
         cy.findByText('781')
         cy.findByText('Headers:')
@@ -260,11 +261,11 @@ describe('<EditorLeftMenu />', function () {
         cy.intercept('GET', '/user/github-sync/status', {
           available: false,
           enabled: false,
-        })
+        }).as('user-status')
 
         cy.intercept('GET', '/project/*/github-sync/status', {
           enabled: false,
-        })
+        }).as('project-status')
 
         const scope = mockScope({
           ui: {
@@ -278,8 +279,11 @@ describe('<EditorLeftMenu />', function () {
           </EditorProviders>
         )
 
+        cy.wait('@compile')
         cy.findByRole('button', { name: 'GitHub' }).click()
         cy.findByText('GitHub Sync')
+
+        cy.wait(['@user-status', '@project-status'])
         cy.findByText('Push to GitHub, pull to Overleaf')
       })
     })
@@ -562,9 +566,9 @@ describe('<EditorLeftMenu />', function () {
               'editortheme-2',
               'editortheme-3',
               '—————————————————',
-              'legacytheme-1',
-              'legacytheme-2',
-              'legacytheme-3',
+              'legacytheme-1 (Legacy)',
+              'legacytheme-2 (Legacy)',
+              'legacytheme-3 (Legacy)',
             ])
           }
         )

+ 5 - 6
services/web/test/frontend/components/pdf-preview/pdf-preview.spec.tsx

@@ -95,8 +95,7 @@ describe('<PdfPreview/>', function () {
     cy.contains('Your Paper')
   })
 
-  // eslint-disable-next-line mocha/no-skipped-tests
-  it.skip('does not compile while compiling', function () {
+  it('does not compile while compiling', function () {
     let counter = 0
     cy.interceptDeferredCompile(() => counter++).then(
       resolveDeferredCompile => {
@@ -123,10 +122,10 @@ describe('<PdfPreview/>', function () {
           resolveDeferredCompile()
 
           // wait for the original compile to finish
-          cy.waitForCompile({ pdf: true })
-
-          // NOTE: difficult to assert that a second request won't be sent, at some point
-          expect(counter).to.equal(1)
+          cy.waitForCompile().then(() => {
+            // NOTE: difficult to assert that a second request won't be sent, at some point
+            expect(counter).to.equal(1)
+          })
         })
       }
     )

+ 1 - 2
services/web/test/frontend/features/history/components/change-list.spec.tsx

@@ -433,7 +433,6 @@ describe('change list', function () {
           }).click()
         })
       })
-      cy.findByRole('dialog').as('modal')
       cy.intercept('POST', '/project/*/labels', req => {
         req.reply(200, {
           id: '64633ee158e9ef7da614c000',
@@ -445,7 +444,7 @@ describe('change list', function () {
         })
       }).as('addLabel')
       const newLabel = 'my new label'
-      cy.get('@modal').within(() => {
+      cy.findByRole('dialog').within(() => {
         cy.findByRole('heading', { name: /add label/i })
         cy.findByRole('button', { name: /cancel/i })
         cy.findByRole('button', { name: /add label/i }).should('be.disabled')