mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-10-30 03:56:23 -05:00 
			
		
		
		
	Settings e2e tests
This commit is contained in:
		
							
								
								
									
										1
									
								
								src-ui/cypress/fixtures/settings/savedviews.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								src-ui/cypress/fixtures/settings/savedviews.json
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | |||||||
|  | {"count":3,"next":null,"previous":null,"results":[{"id":1,"name":"Inbox","show_on_dashboard":true,"show_in_sidebar":true,"sort_field":"created","sort_reverse":true,"filter_rules":[{"rule_type":6,"value":"18"}]},{"id":2,"name":"Recently Added","show_on_dashboard":true,"show_in_sidebar":false,"sort_field":"created","sort_reverse":true,"filter_rules":[]},{"id":11,"name":"Taxes","show_on_dashboard":false,"show_in_sidebar":true,"sort_field":"created","sort_reverse":true,"filter_rules":[{"rule_type":6,"value":"39"}]}]} | ||||||
							
								
								
									
										1
									
								
								src-ui/cypress/fixtures/settings/savedviews_saved.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								src-ui/cypress/fixtures/settings/savedviews_saved.json
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | |||||||
|  | {"count":3,"next":null,"previous":null,"results":[{"id":1,"name":"Inbox","show_on_dashboard":false,"show_in_sidebar":false,"sort_field":"created","sort_reverse":true,"filter_rules":[{"rule_type":6,"value":"18"}]},{"id":2,"name":"Recently Added","show_on_dashboard":true,"show_in_sidebar":false,"sort_field":"created","sort_reverse":true,"filter_rules":[]},{"id":11,"name":"Taxes","show_on_dashboard":false,"show_in_sidebar":true,"sort_field":"created","sort_reverse":true,"filter_rules":[{"rule_type":6,"value":"39"}]}]} | ||||||
							
								
								
									
										55
									
								
								src-ui/cypress/integration/settings.spec.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										55
									
								
								src-ui/cypress/integration/settings.spec.ts
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,55 @@ | |||||||
|  | describe('settings', () => { | ||||||
|  |   beforeEach(() => { | ||||||
|  |     cy.intercept('http://localhost:8000/api/saved_views/*', { | ||||||
|  |       fixture: 'settings/savedviews.json', | ||||||
|  |     }) | ||||||
|  |     cy.viewport(1024, 1024) | ||||||
|  |     cy.visit('/settings') | ||||||
|  |   }) | ||||||
|  |  | ||||||
|  |   it('should activate / deactivate save button when settings change and are saved', () => { | ||||||
|  |     cy.contains('button', 'Save').should('be.disabled') | ||||||
|  |     cy.contains('Use system settings').click() | ||||||
|  |     cy.contains('button', 'Save').should('not.be.disabled') | ||||||
|  |     cy.contains('button', 'Save').click() | ||||||
|  |     cy.contains('button', 'Save').should('be.disabled') | ||||||
|  |   }) | ||||||
|  |  | ||||||
|  |   it('should warn on unsaved changes', () => { | ||||||
|  |     cy.contains('Use system settings').click() | ||||||
|  |     cy.contains('a', 'Dashboard').click() | ||||||
|  |     cy.contains('You have unsaved changes') | ||||||
|  |     cy.contains('button', 'Cancel').click() | ||||||
|  |     cy.contains('button', 'Save').click() | ||||||
|  |     cy.visit('/dashboard') | ||||||
|  |     cy.contains('You have unsaved changes').should('not.exist') | ||||||
|  |   }) | ||||||
|  |  | ||||||
|  |   it('should apply appearance changes when set', () => { | ||||||
|  |     cy.contains('Use system settings').click() | ||||||
|  |     cy.get('body').should('not.have.class', 'color-scheme-system') | ||||||
|  |     cy.contains('Enable dark mode').click() | ||||||
|  |     cy.get('body').should('have.class', 'color-scheme-dark') | ||||||
|  |   }) | ||||||
|  |  | ||||||
|  |   it('should remove saved view from sidebar when unset', () => { | ||||||
|  |     cy.contains('a', 'Saved views').click() | ||||||
|  |     cy.get('#show_in_sidebar_1').click() | ||||||
|  |     cy.intercept('http://localhost:8000/api/saved_views/*', { | ||||||
|  |       fixture: 'settings/savedviews_saved.json', | ||||||
|  |     }) | ||||||
|  |     cy.contains('button', 'Save').click() | ||||||
|  |     cy.contains('li', 'Inbox').should('not.exist') | ||||||
|  |   }) | ||||||
|  |  | ||||||
|  |   it('should remove saved view from dashboard when unset', () => { | ||||||
|  |     cy.contains('a', 'Saved views').click() | ||||||
|  |     cy.get('#show_on_dashboard_1').click() | ||||||
|  |     cy.intercept('http://localhost:8000/api/saved_views/*', { | ||||||
|  |       fixture: 'settings/savedviews_saved.json', | ||||||
|  |     }) | ||||||
|  |     cy.contains('button', 'Save').click() | ||||||
|  |     cy.visit('/dashboard') | ||||||
|  |     cy.get('app-saved-view-widget').contains('Inbox').should('not.exist') | ||||||
|  |   }) | ||||||
|  | }) | ||||||
		Reference in New Issue
	
	Block a user
	 Michael Shamoon
					Michael Shamoon