mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-10-30 03:56:23 -05:00 
			
		
		
		
	use global fixtures in e2e tests
This commit is contained in:
		| @@ -1,10 +1,9 @@ | |||||||
| describe('document-detail', () => { | describe('document-detail', () => { | ||||||
|   beforeEach(() => { |   beforeEach(() => { | ||||||
|  |     // also uses global fixtures from cypress/support/e2e.ts | ||||||
|  |  | ||||||
|     this.modifiedDocuments = [] |     this.modifiedDocuments = [] | ||||||
|  |  | ||||||
|     cy.intercept('http://localhost:8000/api/ui_settings/', { |  | ||||||
|       fixture: 'ui_settings/settings.json', |  | ||||||
|     }) |  | ||||||
|     cy.fixture('documents/documents.json').then((documentsJson) => { |     cy.fixture('documents/documents.json').then((documentsJson) => { | ||||||
|       cy.intercept('GET', 'http://localhost:8000/api/documents/1/', (req) => { |       cy.intercept('GET', 'http://localhost:8000/api/documents/1/', (req) => { | ||||||
|         let response = { ...documentsJson } |         let response = { ...documentsJson } | ||||||
| @@ -18,30 +17,6 @@ describe('document-detail', () => { | |||||||
|       req.reply({ result: 'OK' }) |       req.reply({ result: 'OK' }) | ||||||
|     }).as('saveDoc') |     }).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.viewport(1024, 1024) | ||||||
|     cy.visit('/documents/1/') |     cy.visit('/documents/1/') | ||||||
|   }) |   }) | ||||||
|   | |||||||
| @@ -1,11 +1,9 @@ | |||||||
| describe('documents-list', () => { | describe('documents-list', () => { | ||||||
|   beforeEach(() => { |   beforeEach(() => { | ||||||
|  |     // also uses global fixtures from cypress/support/e2e.ts | ||||||
|  |  | ||||||
|     this.bulkEdits = {} |     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) => { |     cy.fixture('documents/documents.json').then((documentsJson) => { | ||||||
|       // bulk edit |       // bulk edit | ||||||
|       cy.intercept( |       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.viewport(1280, 1024) | ||||||
|     cy.visit('/documents') |     cy.visit('/documents') | ||||||
|   }) |   }) | ||||||
|   | |||||||
| @@ -2,27 +2,8 @@ import { PaperlessDocument } from 'src/app/data/paperless-document' | |||||||
|  |  | ||||||
| describe('documents query params', () => { | describe('documents query params', () => { | ||||||
|   beforeEach(() => { |   beforeEach(() => { | ||||||
|     cy.intercept('http://localhost:8000/api/ui_settings/', { |     // also uses global fixtures from cypress/support/e2e.ts | ||||||
|       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', |  | ||||||
|     }) |  | ||||||
|     cy.fixture('documents/documents.json').then((documentsJson) => { |     cy.fixture('documents/documents.json').then((documentsJson) => { | ||||||
|       // mock api filtering |       // mock api filtering | ||||||
|       cy.intercept('GET', 'http://localhost:8000/api/documents/*', (req) => { |       cy.intercept('GET', 'http://localhost:8000/api/documents/*', (req) => { | ||||||
|   | |||||||
| @@ -1,15 +1,5 @@ | |||||||
| describe('manage', () => { | describe('manage', () => { | ||||||
|   beforeEach(() => { |   // also uses global fixtures from cypress/support/e2e.ts | ||||||
|     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', |  | ||||||
|     }) |  | ||||||
|   }) |  | ||||||
|  |  | ||||||
|   it('should show a list of correspondents with bottom pagination as well', () => { |   it('should show a list of correspondents with bottom pagination as well', () => { | ||||||
|     cy.visit('/correspondents') |     cy.visit('/correspondents') | ||||||
|   | |||||||
| @@ -1,5 +1,7 @@ | |||||||
| describe('settings', () => { | describe('settings', () => { | ||||||
|   beforeEach(() => { |   beforeEach(() => { | ||||||
|  |     // also uses global fixtures from cypress/support/e2e.ts | ||||||
|  |  | ||||||
|     this.modifiedViews = [] |     this.modifiedViews = [] | ||||||
|  |  | ||||||
|     // mock API methods |     // mock API methods | ||||||
| @@ -42,14 +44,6 @@ describe('settings', () => { | |||||||
|           req.reply(response) |           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) |     cy.viewport(1024, 1024) | ||||||
|   | |||||||
| @@ -1,17 +1,43 @@ | |||||||
| // *********************************************************** | // mock API methods | ||||||
| // 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 |  | ||||||
| // *********************************************************** |  | ||||||
|  |  | ||||||
| // When a command from ./commands is ready to use, import with `import './commands'` syntax | beforeEach(() => { | ||||||
| // import './commands'; |   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', | ||||||
|  |   }) | ||||||
|  | }) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Michael Shamoon
					Michael Shamoon