diff --git a/README.md b/README.md index 5db2c12ca..b80fcb2cf 100644 --- a/README.md +++ b/README.md @@ -10,12 +10,19 @@ Show your latest holiday photos and videos like in the movies. Show a glimpse of ## 🏗 Development setup 1. ☁ Clone this app into the `apps` folder of your Nextcloud: `git clone https://github.com/nextcloud/viewer.git` -2. 👩‍💻 In the folder of the app, run the command `make` to install dependencies and build the Javascript. +2. 👩‍💻 In the folder of the app, install dependencies with `npm ci` and build the Javascript with `npm run build`. 3. ✅ Enable the app through the app management of your Nextcloud 4. 🎉 Partytime! ### 🧙 Advanced development stuff -To build the Javascript whenever you make changes, instead of the full `make` you can also run `make build-js`. +To build the Javascript whenever you make changes, you can also run `npm run dev` for development builds. + +### 📷 Running cypress tests +To run e2e cypress tests, execute `npm run cypress`. + +The `visual-regression` tests require additional care as they depend on installation of fonts in the application. To achieve repeatable results run the tests using `npm run cypress:visual-regression`. This will build the app with the required fonts and run the tests. + +If changes are required to the reference (base) screenshots used by the `visual-regression` tests, run `cypress:update-snapshots` and commit the updated screenshots. ## API diff --git a/cypress/snapshots/base/visual-regression.cy.js/image.png b/cypress/snapshots/base/visual-regression.cy.js/image.png new file mode 100644 index 000000000..4fc61d093 Binary files /dev/null and b/cypress/snapshots/base/visual-regression.cy.js/image.png differ diff --git a/cypress/snapshots/base/visual-regression.cy.js/image2.png b/cypress/snapshots/base/visual-regression.cy.js/image2.png new file mode 100644 index 000000000..5d867df0f Binary files /dev/null and b/cypress/snapshots/base/visual-regression.cy.js/image2.png differ diff --git a/cypress/snapshots/base/visual-regression.cy.js/non-dav.png b/cypress/snapshots/base/visual-regression.cy.js/non-dav.png new file mode 100644 index 000000000..910dfc790 Binary files /dev/null and b/cypress/snapshots/base/visual-regression.cy.js/non-dav.png differ diff --git a/cypress/snapshots/base/visual-regression.cy.js/video.png b/cypress/snapshots/base/visual-regression.cy.js/video.png new file mode 100644 index 000000000..f4de2480e Binary files /dev/null and b/cypress/snapshots/base/visual-regression.cy.js/video.png differ diff --git a/package.json b/package.json index 40c2289ec..c159dba15 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,9 @@ "cypress": "npm run cypress:e2e", "cypress:e2e": "cypress run --e2e", "cypress:gui": "cypress open --e2e", - "cypress:update-snapshots": "TESTING=true cypress run --env type=base --spec cypress/e2e/visual-regression.cy.js --config screenshotsFolder=cypress/snapshots/base" + "cypress:pre-snapshots": "TESTING=true npm run dev", + "cypress:visual-regression": "npm run cypress:pre-snapshots && cypress run --spec cypress/e2e/visual-regression.cy.js", + "cypress:update-snapshots": "npm run cypress:pre-snapshots && cypress run --env type=base --spec cypress/e2e/visual-regression.cy.js --config screenshotsFolder=cypress/snapshots/base" }, "dependencies": { "@fontsource/roboto": "^4.5.8",