From 7978f3f0e65184e4084122a5d794f269d21c87c1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 2 Jun 2022 21:36:01 +0000 Subject: [PATCH 1/3] Bump cypress from 9.6.1 to 10.0.1 in /src-ui Bumps [cypress](https://github.com/cypress-io/cypress) from 9.6.1 to 10.0.1. - [Release notes](https://github.com/cypress-io/cypress/releases) - [Changelog](https://github.com/cypress-io/cypress/blob/develop/.releaserc.base.js) - [Commits](https://github.com/cypress-io/cypress/compare/v9.6.1...v10.0.1) --- updated-dependencies: - dependency-name: cypress dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- src-ui/package-lock.json | 16 ++++++++-------- src-ui/package.json | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src-ui/package-lock.json b/src-ui/package-lock.json index fe2b16e13..479fe2e84 100644 --- a/src-ui/package-lock.json +++ b/src-ui/package-lock.json @@ -16,12 +16,12 @@ "@angular/platform-browser": "~13.3.11", "@angular/platform-browser-dynamic": "~13.3.11", "@angular/router": "~13.3.11", - "@cypress/schematic": "^2.0.0", "@ng-bootstrap/ng-bootstrap": "^12.1.2", "@ng-select/ng-select": "^8.1.1", "@ngneat/dirty-check-forms": "^3.0.2", "@popperjs/core": "^2.11.5", "bootstrap": "^5.1.3", + "cypress": "~10.0.1", "file-saver": "^2.0.5", "ng2-pdf-viewer": "^9.0.0", "ngx-color": "^7.3.3", @@ -51,7 +51,7 @@ }, "optionalDependencies": { "@cypress/schematic": "^2.0.0", - "cypress": "~9.6.0" + "cypress": "~10.0.1" } }, "node_modules/@ampproject/remapping": { @@ -8101,9 +8101,9 @@ "dev": true }, "node_modules/cypress": { - "version": "9.6.1", - "resolved": "https://registry.npmjs.org/cypress/-/cypress-9.6.1.tgz", - "integrity": "sha512-ECzmV7pJSkk+NuAhEw6C3D+RIRATkSb2VAHXDY6qGZbca/F9mv5pPsj2LO6Ty6oIFVBTrwCyL9agl28MtJMe2g==", + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/cypress/-/cypress-10.0.1.tgz", + "integrity": "sha512-04vefCc6LrrgBS7Qhqn+9lqXTneLYZZwOokBaCJToI9DHu7/ywhywYNUg/Qy4xWOxlKvbvnELGCa7HZbSgeLfQ==", "hasInstallScript": true, "optional": true, "dependencies": { @@ -25674,9 +25674,9 @@ } }, "cypress": { - "version": "9.6.1", - "resolved": "https://registry.npmjs.org/cypress/-/cypress-9.6.1.tgz", - "integrity": "sha512-ECzmV7pJSkk+NuAhEw6C3D+RIRATkSb2VAHXDY6qGZbca/F9mv5pPsj2LO6Ty6oIFVBTrwCyL9agl28MtJMe2g==", + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/cypress/-/cypress-10.0.1.tgz", + "integrity": "sha512-04vefCc6LrrgBS7Qhqn+9lqXTneLYZZwOokBaCJToI9DHu7/ywhywYNUg/Qy4xWOxlKvbvnELGCa7HZbSgeLfQ==", "optional": true, "requires": { "@cypress/request": "^2.88.10", diff --git a/src-ui/package.json b/src-ui/package.json index 813c6d67e..d8ec02c49 100644 --- a/src-ui/package.json +++ b/src-ui/package.json @@ -55,6 +55,6 @@ }, "optionalDependencies": { "@cypress/schematic": "^2.0.0", - "cypress": "~9.6.0" + "cypress": "~10.0.1" } } From ef48762da560eede192668f9ef3ab6fe840779b3 Mon Sep 17 00:00:00 2001 From: Michael Shamoon <4887959+shamoon@users.noreply.github.com> Date: Thu, 2 Jun 2022 14:47:09 -0700 Subject: [PATCH 2/3] Migrate to cypress 10 --- src-ui/cypress.config.ts | 13 +++++++++++++ src-ui/cypress.json | 9 --------- .../documents/document-detail.cy.ts} | 0 .../documents/documents-list.cy.ts} | 0 .../documents/query-params.cy.ts} | 0 .../manage.spec.ts => e2e/manage/manage.cy.ts} | 0 .../settings/settings.cy.ts} | 0 src-ui/cypress/support/{index.ts => e2e.ts} | 0 8 files changed, 13 insertions(+), 9 deletions(-) create mode 100644 src-ui/cypress.config.ts delete mode 100644 src-ui/cypress.json rename src-ui/cypress/{integration/documents/document-detail.spec.ts => e2e/documents/document-detail.cy.ts} (100%) rename src-ui/cypress/{integration/documents/documents-list.spec.ts => e2e/documents/documents-list.cy.ts} (100%) rename src-ui/cypress/{integration/documents/query-params.spec.ts => e2e/documents/query-params.cy.ts} (100%) rename src-ui/cypress/{integration/manage/manage.spec.ts => e2e/manage/manage.cy.ts} (100%) rename src-ui/cypress/{integration/settings/settings.spec.ts => e2e/settings/settings.cy.ts} (100%) rename src-ui/cypress/support/{index.ts => e2e.ts} (100%) diff --git a/src-ui/cypress.config.ts b/src-ui/cypress.config.ts new file mode 100644 index 000000000..1be27d63e --- /dev/null +++ b/src-ui/cypress.config.ts @@ -0,0 +1,13 @@ +import { defineConfig } from 'cypress' + +export default defineConfig({ + videosFolder: 'cypress/videos', + screenshotsFolder: 'cypress/screenshots', + fixturesFolder: 'cypress/fixtures', + e2e: { + setupNodeEvents(on, config) { + return require('./cypress/plugins/index.ts')(on, config) + }, + baseUrl: 'http://localhost:4200', + }, +}) diff --git a/src-ui/cypress.json b/src-ui/cypress.json deleted file mode 100644 index 3a58fab3f..000000000 --- a/src-ui/cypress.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "integrationFolder": "cypress/integration", - "supportFile": "cypress/support/index.ts", - "videosFolder": "cypress/videos", - "screenshotsFolder": "cypress/screenshots", - "pluginsFile": "cypress/plugins/index.ts", - "fixturesFolder": "cypress/fixtures", - "baseUrl": "http://localhost:4200" -} diff --git a/src-ui/cypress/integration/documents/document-detail.spec.ts b/src-ui/cypress/e2e/documents/document-detail.cy.ts similarity index 100% rename from src-ui/cypress/integration/documents/document-detail.spec.ts rename to src-ui/cypress/e2e/documents/document-detail.cy.ts diff --git a/src-ui/cypress/integration/documents/documents-list.spec.ts b/src-ui/cypress/e2e/documents/documents-list.cy.ts similarity index 100% rename from src-ui/cypress/integration/documents/documents-list.spec.ts rename to src-ui/cypress/e2e/documents/documents-list.cy.ts diff --git a/src-ui/cypress/integration/documents/query-params.spec.ts b/src-ui/cypress/e2e/documents/query-params.cy.ts similarity index 100% rename from src-ui/cypress/integration/documents/query-params.spec.ts rename to src-ui/cypress/e2e/documents/query-params.cy.ts diff --git a/src-ui/cypress/integration/manage/manage.spec.ts b/src-ui/cypress/e2e/manage/manage.cy.ts similarity index 100% rename from src-ui/cypress/integration/manage/manage.spec.ts rename to src-ui/cypress/e2e/manage/manage.cy.ts diff --git a/src-ui/cypress/integration/settings/settings.spec.ts b/src-ui/cypress/e2e/settings/settings.cy.ts similarity index 100% rename from src-ui/cypress/integration/settings/settings.spec.ts rename to src-ui/cypress/e2e/settings/settings.cy.ts diff --git a/src-ui/cypress/support/index.ts b/src-ui/cypress/support/e2e.ts similarity index 100% rename from src-ui/cypress/support/index.ts rename to src-ui/cypress/support/e2e.ts From bed03b301b0652729dec607de794f373bd8b6e92 Mon Sep 17 00:00:00 2001 From: Michael Shamoon <4887959+shamoon@users.noreply.github.com> Date: Thu, 2 Jun 2022 15:00:41 -0700 Subject: [PATCH 3/3] use global fixtures in e2e tests --- .../e2e/documents/document-detail.cy.ts | 29 +--------- .../e2e/documents/documents-list.cy.ts | 22 +------ .../cypress/e2e/documents/query-params.cy.ts | 23 +------- src-ui/cypress/e2e/manage/manage.cy.ts | 12 +--- src-ui/cypress/e2e/settings/settings.cy.ts | 10 +--- src-ui/cypress/support/e2e.ts | 58 ++++++++++++++----- 6 files changed, 51 insertions(+), 103 deletions(-) diff --git a/src-ui/cypress/e2e/documents/document-detail.cy.ts b/src-ui/cypress/e2e/documents/document-detail.cy.ts index 8faf2412c..cc269655a 100644 --- a/src-ui/cypress/e2e/documents/document-detail.cy.ts +++ b/src-ui/cypress/e2e/documents/document-detail.cy.ts @@ -1,10 +1,9 @@ describe('document-detail', () => { beforeEach(() => { + // also uses global fixtures from cypress/support/e2e.ts + this.modifiedDocuments = [] - cy.intercept('http://localhost:8000/api/ui_settings/', { - fixture: 'ui_settings/settings.json', - }) cy.fixture('documents/documents.json').then((documentsJson) => { cy.intercept('GET', 'http://localhost:8000/api/documents/1/', (req) => { let response = { ...documentsJson } @@ -18,30 +17,6 @@ describe('document-detail', () => { req.reply({ result: 'OK' }) }).as('saveDoc') - cy.intercept('http://localhost:8000/api/documents/1/metadata/', { - fixture: 'documents/1/metadata.json', - }) - - cy.intercept('http://localhost:8000/api/documents/1/suggestions/', { - fixture: 'documents/1/suggestions.json', - }) - - cy.intercept('http://localhost:8000/api/saved_views/*', { - fixture: 'saved_views/savedviews.json', - }) - - cy.intercept('http://localhost:8000/api/tags/*', { - fixture: 'tags/tags.json', - }) - - cy.intercept('http://localhost:8000/api/correspondents/*', { - fixture: 'correspondents/correspondents.json', - }) - - cy.intercept('http://localhost:8000/api/document_types/*', { - fixture: 'document_types/doctypes.json', - }) - cy.viewport(1024, 1024) cy.visit('/documents/1/') }) diff --git a/src-ui/cypress/e2e/documents/documents-list.cy.ts b/src-ui/cypress/e2e/documents/documents-list.cy.ts index 6429dbc65..2dffe4e24 100644 --- a/src-ui/cypress/e2e/documents/documents-list.cy.ts +++ b/src-ui/cypress/e2e/documents/documents-list.cy.ts @@ -1,11 +1,9 @@ describe('documents-list', () => { beforeEach(() => { + // also uses global fixtures from cypress/support/e2e.ts + this.bulkEdits = {} - // mock API methods - cy.intercept('http://localhost:8000/api/ui_settings/', { - fixture: 'ui_settings/settings.json', - }) cy.fixture('documents/documents.json').then((documentsJson) => { // bulk edit cy.intercept( @@ -56,22 +54,6 @@ describe('documents-list', () => { }) }) - cy.intercept('http://localhost:8000/api/documents/1/thumb/', { - fixture: 'documents/lorem-ipsum.png', - }) - - cy.intercept('http://localhost:8000/api/tags/*', { - fixture: 'tags/tags.json', - }) - - cy.intercept('http://localhost:8000/api/correspondents/*', { - fixture: 'correspondents/correspondents.json', - }) - - cy.intercept('http://localhost:8000/api/document_types/*', { - fixture: 'document_types/doctypes.json', - }) - cy.viewport(1280, 1024) cy.visit('/documents') }) diff --git a/src-ui/cypress/e2e/documents/query-params.cy.ts b/src-ui/cypress/e2e/documents/query-params.cy.ts index b9f6bd30c..a31e43c8a 100644 --- a/src-ui/cypress/e2e/documents/query-params.cy.ts +++ b/src-ui/cypress/e2e/documents/query-params.cy.ts @@ -2,27 +2,8 @@ import { PaperlessDocument } from 'src/app/data/paperless-document' describe('documents query params', () => { beforeEach(() => { - cy.intercept('http://localhost:8000/api/ui_settings/', { - fixture: 'ui_settings/settings.json', - }) - cy.intercept('http://localhost:8000/api/remote_version/', { - fixture: 'remote_version/remote_version.json', - }) - cy.intercept('http://localhost:8000/api/correspondents/*', { - fixture: 'correspondents/correspondents.json', - }) - cy.intercept('http://localhost:8000/api/document_types/*', { - fixture: 'document_types/doctypes.json', - }) - cy.intercept('http://localhost:8000/api/saved_views/*', { - fixture: 'saved_views/savedviews.json', - }) - cy.intercept('http://localhost:8000/api/storage_paths/*', { - fixture: 'storage_paths/storage_paths.json', - }) - cy.intercept('http://localhost:8000/api/tags/*', { - fixture: 'tags/tags.json', - }) + // also uses global fixtures from cypress/support/e2e.ts + cy.fixture('documents/documents.json').then((documentsJson) => { // mock api filtering cy.intercept('GET', 'http://localhost:8000/api/documents/*', (req) => { diff --git a/src-ui/cypress/e2e/manage/manage.cy.ts b/src-ui/cypress/e2e/manage/manage.cy.ts index ef7e12723..9e29ac111 100644 --- a/src-ui/cypress/e2e/manage/manage.cy.ts +++ b/src-ui/cypress/e2e/manage/manage.cy.ts @@ -1,15 +1,5 @@ describe('manage', () => { - beforeEach(() => { - cy.intercept('http://localhost:8000/api/ui_settings/', { - fixture: 'ui_settings/settings.json', - }) - cy.intercept('http://localhost:8000/api/correspondents/*', { - fixture: 'correspondents/correspondents.json', - }) - cy.intercept('http://localhost:8000/api/tags/*', { - fixture: 'tags/tags.json', - }) - }) + // also uses global fixtures from cypress/support/e2e.ts it('should show a list of correspondents with bottom pagination as well', () => { cy.visit('/correspondents') diff --git a/src-ui/cypress/e2e/settings/settings.cy.ts b/src-ui/cypress/e2e/settings/settings.cy.ts index 16e706b63..7433d16f4 100644 --- a/src-ui/cypress/e2e/settings/settings.cy.ts +++ b/src-ui/cypress/e2e/settings/settings.cy.ts @@ -1,5 +1,7 @@ describe('settings', () => { beforeEach(() => { + // also uses global fixtures from cypress/support/e2e.ts + this.modifiedViews = [] // mock API methods @@ -42,14 +44,6 @@ describe('settings', () => { req.reply(response) }) }) - - cy.intercept('http://localhost:8000/api/documents/1/metadata/', { - fixture: 'documents/1/metadata.json', - }) - - cy.intercept('http://localhost:8000/api/documents/1/suggestions/', { - fixture: 'documents/1/suggestions.json', - }) }) cy.viewport(1024, 1024) diff --git a/src-ui/cypress/support/e2e.ts b/src-ui/cypress/support/e2e.ts index ac293b616..4004aa8a0 100644 --- a/src-ui/cypress/support/e2e.ts +++ b/src-ui/cypress/support/e2e.ts @@ -1,17 +1,43 @@ -// *********************************************************** -// This example support/index.js is processed and -// loaded automatically before your test files. -// -// This is a great place to put global configuration and -// behavior that modifies Cypress. -// -// You can change the location of this file or turn off -// automatically serving support files with the -// 'supportFile' configuration option. -// -// You can read more here: -// https://on.cypress.io/configuration -// *********************************************************** +// mock API methods -// When a command from ./commands is ready to use, import with `import './commands'` syntax -// import './commands'; +beforeEach(() => { + cy.intercept('http://localhost:8000/api/ui_settings/', { + fixture: 'ui_settings/settings.json', + }) + + cy.intercept('http://localhost:8000/api/remote_version/', { + fixture: 'remote_version/remote_version.json', + }) + + cy.intercept('http://localhost:8000/api/saved_views/*', { + fixture: 'saved_views/savedviews.json', + }) + + cy.intercept('http://localhost:8000/api/tags/*', { + fixture: 'tags/tags.json', + }) + + cy.intercept('http://localhost:8000/api/correspondents/*', { + fixture: 'correspondents/correspondents.json', + }) + + cy.intercept('http://localhost:8000/api/document_types/*', { + fixture: 'document_types/doctypes.json', + }) + + cy.intercept('http://localhost:8000/api/storage_paths/*', { + fixture: 'storage_paths/storage_paths.json', + }) + + cy.intercept('http://localhost:8000/api/documents/1/metadata/', { + fixture: 'documents/1/metadata.json', + }) + + cy.intercept('http://localhost:8000/api/documents/1/suggestions/', { + fixture: 'documents/1/suggestions.json', + }) + + cy.intercept('http://localhost:8000/api/documents/1/thumb/', { + fixture: 'documents/lorem-ipsum.png', + }) +})