Преглед на файлове

Add retries for flaky e2e test (#3915)

Retry flaky test
Merlijn Vos преди 2 години
родител
ревизия
0c009dc8ff
променени са 1 файла, в които са добавени 23 реда и са изтрити 15 реда
  1. 23 15
      e2e/cypress/integration/dashboard-tus.spec.ts

+ 23 - 15
e2e/cypress/integration/dashboard-tus.spec.ts

@@ -25,24 +25,32 @@ describe('Dashboard with Tus', () => {
     cy.get('.uppy-StatusBar-statusPrimary').should('contain', 'Complete')
   })
 
-  it('should start exponential backoff when receiving HTTP 429', () => {
-    cy.get('@file-input').selectFile('cypress/fixtures/images/baboon.png', { force:true })
-    cy.get('.uppy-StatusBar-actionBtn--upload').click()
+  it(
+    'should start exponential backoff when receiving HTTP 429',
+    {
+      retries: {
+        runMode: 3, // retry flaky test
+      },
+    },
+    () => {
+      cy.get('@file-input').selectFile('cypress/fixtures/images/baboon.png', { force:true })
+      cy.get('.uppy-StatusBar-actionBtn--upload').click()
 
-    cy.intercept(
-      { method: 'PATCH', pathname: '/files/*', times: 2 },
-      { statusCode: 429, body: {} },
-    ).as('patch')
+      cy.intercept(
+        { method: 'PATCH', pathname: '/files/*', times: 2 },
+        { statusCode: 429, body: {} },
+      ).as('patch')
 
-    cy.wait('@patch')
-    cy.wait('@patch')
+      cy.wait('@patch')
+      cy.wait('@patch')
 
-    cy.window().then(({ uppy }) => {
-      expect(uppy.getPlugin<Tus>('Tus').requests.isPaused).to.equal(true)
-      cy.wait('@tus')
-      cy.get('.uppy-StatusBar-statusPrimary').should('contain', 'Complete')
-    })
-  })
+      cy.window().then(({ uppy }) => {
+        expect(uppy.getPlugin<Tus>('Tus').requests.isPaused).to.equal(true)
+        cy.wait('@tus')
+        cy.get('.uppy-StatusBar-statusPrimary').should('contain', 'Complete')
+      })
+    },
+  )
 
   it('should upload remote image with URL plugin', () => {
     cy.get('[data-cy="Url"]').click()