Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enh/visual regression #589

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions .github/workflows/cypress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,6 @@ jobs:
with:
node-version: ${{ matrix.node-version }}

- name: Install dependencies & build app
run: |
npm ci
TESTING=true npm run build --if-present

- name: Wait for server
run: |
npm install -g wait-on
Expand All @@ -60,10 +55,19 @@ jobs:
with:
record: true
parallel: true
build: npm run build
# cypress env
ci-build-id: ${{ github.sha }}-${{ github.run_number }}
tag: ${{ github.event_name }}
env:
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
# https://github.com/cypress-io/github-action/issues/124
COMMIT_INFO_MESSAGE: ${{ github.event.pull_request.title }}
TESTING: true

- name: Upload snapshots
uses: actions/upload-artifact@v2
if: always()
with:
name: snapshots
path: cypress/snapshots
9 changes: 7 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@ yarn-error.log*
build/
coverage/

cypress/screenshots
cypress/snapshots
vendor
.php_cs.cache

# Cypress files
js/*roboto*
cypress/videos
cypress/screenshots
cypress/snapshots/actual
cypress/snapshots/diff
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ test-coverage:
npm run test:coverage

test-cypress:
./cypress/start.sh
npm run cypress
./cypress/stop.sh

test-cypress-gui:
./cypress/start.sh
npm run cypress:gui
./cypress/stop.sh
Expand Down
8 changes: 7 additions & 1 deletion cypress.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,11 @@
"projectId": "xysa6x",
"viewportWidth": 1280,
"viewportHeight": 720,
"defaultCommandTimeout": 6000
"defaultCommandTimeout": 6000,
"env": {
"failSilently": false,
"type": "actual"
},
"screenshotsFolder": "cypress/snapshots/actual",
"trashAssetsBeforeRuns": true
}
12 changes: 12 additions & 0 deletions cypress/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module.exports = {
env: {
jest: true,
"cypress/globals": true
},
extends: [
"plugin:cypress/recommended"
],
rules: {
'cypress/no-unnecessary-waiting': off
}
}
37 changes: 17 additions & 20 deletions cypress/integration/files-shares.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,6 @@ describe('See shared folder with link share', function() {
cy.get('#fileList tr').should('contain', 'Photos')
})

it('Does not have any visual regression 1', function() {
cy.matchImageSnapshot()
})

it('See shared files in the list', function() {
cy.openFile('Photos')
cy.get('#fileList tr[data-file="image1.jpg"]', { timeout: 10000 })
Expand All @@ -69,19 +65,20 @@ describe('See shared folder with link share', function() {
.should('contain', 'video1.mp4')
})

it('Does not have any visual regression 2', function() {
cy.matchImageSnapshot()
it('Take screenshot', function() {
cy.screenshot()
})

it('Share the Photos folder with a share link and access the share link', function() {
cy.createLinkShare('/Photos').then(token => {
cy.logout()
cy.visit(`/s/${token}`)
cy.wait(1000)
})
})

it('Does not have any visual regression 3', function() {
cy.matchImageSnapshot()
it('Does not have any visual regression 1', function() {
cy.compareSnapshot('files-1')
})

it('Open the viewer on file click', function() {
Expand Down Expand Up @@ -109,8 +106,8 @@ describe('See shared folder with link share', function() {
cy.get('#viewer-content a.next').should('be.visible')
})

it('Does not have any visual regression 4', function() {
cy.matchImageSnapshot()
it('Does not have any visual regression 2', function() {
cy.compareSnapshot('files-2')
})

it('Show image2 on next', function() {
Expand All @@ -127,8 +124,8 @@ describe('See shared folder with link share', function() {
.and('not.have.class', 'icon-loading')
})

it('Does not have any visual regression 5', function() {
cy.matchImageSnapshot()
it('Does not have any visual regression 3', function() {
cy.compareSnapshot('files-3')
})

it('Show image3 on next', function() {
Expand All @@ -145,8 +142,8 @@ describe('See shared folder with link share', function() {
.and('not.have.class', 'icon-loading')
})

it('Does not have any visual regression 6', function() {
cy.matchImageSnapshot()
it('Does not have any visual regression 4', function() {
cy.compareSnapshot('files-4')
})

it('Show image4 on next', function() {
Expand All @@ -163,8 +160,8 @@ describe('See shared folder with link share', function() {
.and('not.have.class', 'icon-loading')
})

it('Does not have any visual regression 7', function() {
cy.matchImageSnapshot()
it('Does not have any visual regression 5', function() {
cy.compareSnapshot('files-5')
})

it('Show video1 on next', function() {
Expand All @@ -184,8 +181,8 @@ describe('See shared folder with link share', function() {
.and('not.have.class', 'icon-loading')
})

it('Does not have any visual regression 8', function() {
cy.matchImageSnapshot()
it('Does not have any visual regression 6', function() {
cy.compareSnapshot('files-6')
})

it('Show image1 again on next', function() {
Expand All @@ -202,7 +199,7 @@ describe('See shared folder with link share', function() {
.and('not.have.class', 'icon-loading')
})

it('Does not have any visual regression 9', function() {
cy.matchImageSnapshot()
it('Does not have any visual regression 7', function() {
cy.compareSnapshot('files-7')
})
})
1 change: 1 addition & 0 deletions cypress/integration/files.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
*
*/


describe('Files default view', function() {
before(function() {
cy.login('admin', 'admin')
Expand Down
2 changes: 1 addition & 1 deletion cypress/integration/image-small.png.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,6 @@ describe('Open image-small.png in viewer', function() {
})

it('Does not have any visual regression', function() {
cy.matchImageSnapshot()
cy.compareSnapshot('image-small')
})
})
1 change: 0 additions & 1 deletion cypress/integration/image.gif.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
*
*/


import { randHash } from '../utils/'
const randUser = randHash()

Expand Down
2 changes: 1 addition & 1 deletion cypress/integration/image.png.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,6 @@ describe('Open image.png in viewer', function() {
})

it('Does not have any visual regression', function() {
cy.matchImageSnapshot()
cy.compareSnapshot('image-png')
})
})
3 changes: 1 addition & 2 deletions cypress/integration/image.svg.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
*
*/


import { randHash } from '../utils/'
const randUser = randHash()

Expand Down Expand Up @@ -76,6 +75,6 @@ describe('Open image.svg in viewer', function() {
})

it('Does not have any visual regression', function() {
cy.matchImageSnapshot()
cy.compareSnapshot('image-svg')
})
})
12 changes: 6 additions & 6 deletions cypress/integration/images-custom-list-loadmore.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ describe('Open custom list of images in viewer with pagination', function() {
},
],
// This will be triggered when we get to the end of the list
loadMore: function() {
loadMore() {
// make sure we only loadMore once
if (loaded) {
return []
Expand Down Expand Up @@ -143,7 +143,7 @@ describe('Open custom list of images in viewer with pagination', function() {
})

it('Does not have any visual regression 1', function() {
cy.matchImageSnapshot()
cy.compareSnapshot('images-custom-list-loadmore-1')
})

it('Show image2 on next', function() {
Expand All @@ -161,7 +161,7 @@ describe('Open custom list of images in viewer with pagination', function() {
})

it('Does not have any visual regression 2', function() {
cy.matchImageSnapshot()
cy.compareSnapshot('images-custom-list-loadmore-2')
})

it('Show image3 on next', function() {
Expand All @@ -179,7 +179,7 @@ describe('Open custom list of images in viewer with pagination', function() {
})

it('Does not have any visual regression 3', function() {
cy.matchImageSnapshot()
cy.compareSnapshot('images-custom-list-loadmore-3')
})

it('Show image4 on next', function() {
Expand All @@ -197,7 +197,7 @@ describe('Open custom list of images in viewer with pagination', function() {
})

it('Does not have any visual regression 4', function() {
cy.matchImageSnapshot()
cy.compareSnapshot('images-custom-list-loadmore-4')
})

it('Show image1 again on next', function() {
Expand All @@ -215,6 +215,6 @@ describe('Open custom list of images in viewer with pagination', function() {
})

it('Does not have any visual regression 5', function() {
cy.matchImageSnapshot()
cy.compareSnapshot('images-custom-list-loadmore-5')
})
})
6 changes: 3 additions & 3 deletions cypress/integration/images-custom-list.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ describe('Open custom images list in viewer', function() {
})

it('Does not have any visual regression 1', function() {
cy.matchImageSnapshot()
cy.compareSnapshot('images-custom-list-1')
})

it('Show image3 on next', function() {
Expand All @@ -134,7 +134,7 @@ describe('Open custom images list in viewer', function() {
})

it('Does not have any visual regression 2', function() {
cy.matchImageSnapshot()
cy.compareSnapshot('images-custom-list-2')
})

it('Show image1 on next', function() {
Expand All @@ -158,6 +158,6 @@ describe('Open custom images list in viewer', function() {
})

it('Does not have any visual regression 3', function() {
cy.matchImageSnapshot()
cy.compareSnapshot('images-custom-list-3')
})
})
10 changes: 5 additions & 5 deletions cypress/integration/images.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ describe('Open images in viewer', function() {
})

it('Does not have any visual regression 1', function() {
cy.matchImageSnapshot()
cy.compareSnapshot('images-1')
})

it('Show image2 on next', function() {
Expand All @@ -99,7 +99,7 @@ describe('Open images in viewer', function() {
})

it('Does not have any visual regression 2', function() {
cy.matchImageSnapshot()
cy.compareSnapshot('images-2')
})

it('Show image3 on next', function() {
Expand All @@ -117,7 +117,7 @@ describe('Open images in viewer', function() {
})

it('Does not have any visual regression 3', function() {
cy.matchImageSnapshot()
cy.compareSnapshot('images-3')
})

it('Show image4 on next', function() {
Expand All @@ -136,7 +136,7 @@ describe('Open images in viewer', function() {
})

it('Does not have any visual regression 4', function() {
cy.matchImageSnapshot()
cy.compareSnapshot('images-4')
})

it('Show image1 again on next', function() {
Expand All @@ -154,6 +154,6 @@ describe('Open images in viewer', function() {
})

it('Does not have any visual regression 5', function() {
cy.matchImageSnapshot()
cy.compareSnapshot('images-5')
})
})
Loading