diff --git a/cypress/e2e/visual-regression.cy.ts b/cypress/e2e/visual-regression.cy.ts index 4488b4017..e29aa541c 100644 --- a/cypress/e2e/visual-regression.cy.ts +++ b/cypress/e2e/visual-regression.cy.ts @@ -20,7 +20,7 @@ * */ -describe('Visual regression tests ', function() { +describe('Visual regression tests', function() { let randUser before(function() { @@ -39,7 +39,6 @@ describe('Visual regression tests ', function() { }) it('See files in the list', function() { - // TODO: Do we care about the file name being split by a ' ' in the text property? cy.getFile('test-card.mp4', { timeout: 10000 }) .should('contain', 'test-card .mp4') cy.getFile('test-card.png', { timeout: 10000 }) @@ -47,7 +46,12 @@ describe('Visual regression tests ', function() { }) it('Open the viewer on file click', function() { + cy.intercept('GET', '**/core/preview*').as('image1') + cy.intercept('GET', '/remote.php/dav/files/*/test-card.mp4').as('video') cy.openFile('test-card.mp4') + cy.wait('@video') + // We preload images, so we can check its loading here and not when clicking next + cy.wait('@image1') cy.get('body > .viewer').should('be.visible') }) @@ -73,7 +77,7 @@ describe('Visual regression tests ', function() { .and('not.have.class', 'icon-loading') }) - it('Take test-card.mp4 screenshot', function() { + it('Take test-card.mp4 screenshot', { retries: 0 }, function() { cy.get('body > .viewer .modal-container .viewer__file.viewer__file--active video').then(video => { video.get(0).pause() video.get(0).currentTime = 1 @@ -99,14 +103,17 @@ describe('Visual regression tests ', function() { .and('not.have.class', 'icon-loading') }) - it('Take test-card.png screenshot', function() { + it('Take test-card.png screenshot', { retries: 0 }, function() { cy.compareSnapshot('image') }) it('Close and open image again', function() { cy.get('body > .viewer button.header-close').click() cy.get('body > .viewer').should('not.exist') + + // No need to intercept the request again, it's cached cy.openFile('test-card.png') + cy.get('body > .viewer').should('be.visible') cy.get('body > .viewer .modal-header__name').should('contain', 'test-card.png') cy.get('body > .viewer .modal-container img').should('have.length', 1) @@ -122,7 +129,7 @@ describe('Visual regression tests ', function() { .and('not.have.class', 'icon-loading') }) - it('Take test-card.png screenshot 2', function() { + it('Take test-card.png screenshot 2', { retries: 0 }, function() { cy.compareSnapshot('image2') }) @@ -136,13 +143,14 @@ describe('Visual regression tests ', function() { hasPreview: false, fileid: 123, } - + cy.intercept('GET', '/core/img/favicon.png').as('favicon') cy.window().then((win) => { win.OCA.Viewer.open({ fileInfo, list: [fileInfo], }) }) + cy.wait('@favicon') cy.get('body > .viewer .modal-container img').should('have.length', 1) cy.get('body > .viewer .modal-container img').should('have.attr', 'src') @@ -157,7 +165,7 @@ describe('Visual regression tests ', function() { .and('not.have.class', 'icon-loading') }) - it('Take non-dav logo.png screenshot', function() { + it('Take non-dav logo.png screenshot', { retries: 0 }, function() { cy.compareSnapshot('non-dav') }) }) diff --git a/cypress/snapshots/base/cypress/e2e/visual-regression.cy.ts/image.png b/cypress/snapshots/base/cypress/e2e/visual-regression.cy.ts/image.png index f7f686fa8..792e313bc 100644 Binary files a/cypress/snapshots/base/cypress/e2e/visual-regression.cy.ts/image.png and b/cypress/snapshots/base/cypress/e2e/visual-regression.cy.ts/image.png differ diff --git a/cypress/snapshots/base/cypress/e2e/visual-regression.cy.ts/image2.png b/cypress/snapshots/base/cypress/e2e/visual-regression.cy.ts/image2.png index 784cc490b..59e1d8c9f 100644 Binary files a/cypress/snapshots/base/cypress/e2e/visual-regression.cy.ts/image2.png and b/cypress/snapshots/base/cypress/e2e/visual-regression.cy.ts/image2.png differ diff --git a/cypress/snapshots/base/cypress/e2e/visual-regression.cy.ts/non-dav.png b/cypress/snapshots/base/cypress/e2e/visual-regression.cy.ts/non-dav.png index e1937b128..45457635f 100644 Binary files a/cypress/snapshots/base/cypress/e2e/visual-regression.cy.ts/non-dav.png and b/cypress/snapshots/base/cypress/e2e/visual-regression.cy.ts/non-dav.png differ diff --git a/cypress/snapshots/base/cypress/e2e/visual-regression.cy.ts/video.png b/cypress/snapshots/base/cypress/e2e/visual-regression.cy.ts/video.png index 2ab667725..5031270a6 100644 Binary files a/cypress/snapshots/base/cypress/e2e/visual-regression.cy.ts/video.png and b/cypress/snapshots/base/cypress/e2e/visual-regression.cy.ts/video.png differ