mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-10-30 03:56:23 -05:00 
			
		
		
		
	remove redundant e2e tests
This commit is contained in:
		| @@ -94,51 +94,6 @@ test('should show a list of notes', async ({ page }) => { | |||||||
|   ).toHaveCount(4) |   ).toHaveCount(4) | ||||||
| }) | }) | ||||||
|  |  | ||||||
| test('should support note deletion', async ({ page }) => { |  | ||||||
|   await page.routeFromHAR(REQUESTS_HAR, { notFound: 'fallback' }) |  | ||||||
|   await page.goto('/documents/175/notes') |  | ||||||
|   await expect(page.locator('app-document-notes')).toBeVisible() |  | ||||||
|   const deletePromise = page.waitForRequest( |  | ||||||
|     (request) => |  | ||||||
|       request.method() === 'DELETE' && |  | ||||||
|       request.url().includes('/api/documents/175/notes/') |  | ||||||
|   ) |  | ||||||
|   await page |  | ||||||
|     .getByRole('button', { name: /delete note/i, includeHidden: true }) |  | ||||||
|     .first() |  | ||||||
|     .click() |  | ||||||
|   await deletePromise |  | ||||||
| }) |  | ||||||
|  |  | ||||||
| test('should support note insertion', async ({ page }) => { |  | ||||||
|   await page.routeFromHAR(REQUESTS_HAR, { notFound: 'fallback' }) |  | ||||||
|   await page.goto('/documents/175/notes') |  | ||||||
|   await expect(page.locator('app-document-notes')).toBeVisible() |  | ||||||
|   await expect( |  | ||||||
|     await page.getByRole('button', { |  | ||||||
|       name: /delete note/i, |  | ||||||
|       includeHidden: true, |  | ||||||
|     }) |  | ||||||
|   ).toHaveCount(4) |  | ||||||
|   await page.getByPlaceholder('Enter note').fill('This is a new note') |  | ||||||
|   const addPromise = page.waitForRequest((request) => { |  | ||||||
|     if (!request.url().includes('/notes/')) { |  | ||||||
|       // ignore other requests |  | ||||||
|       return true |  | ||||||
|     } else { |  | ||||||
|       const data = request.postDataJSON() |  | ||||||
|       const isValid = data['note'] === 'This is a new note' |  | ||||||
|       return ( |  | ||||||
|         isValid && |  | ||||||
|         request.method() === 'POST' && |  | ||||||
|         request.url().includes('/notes/') |  | ||||||
|       ) |  | ||||||
|     } |  | ||||||
|   }) |  | ||||||
|   await page.getByRole('button', { name: 'Add note' }).click() |  | ||||||
|   await addPromise |  | ||||||
| }) |  | ||||||
|  |  | ||||||
| test('should support quick filters', async ({ page }) => { | test('should support quick filters', async ({ page }) => { | ||||||
|   await page.routeFromHAR(REQUESTS_HAR2, { notFound: 'fallback' }) |   await page.routeFromHAR(REQUESTS_HAR2, { notFound: 'fallback' }) | ||||||
|   await page.goto('/documents/175/details') |   await page.goto('/documents/175/details') | ||||||
|   | |||||||
| @@ -1,58 +0,0 @@ | |||||||
| import { test, expect } from '@playwright/test' |  | ||||||
|  |  | ||||||
| const REQUESTS_HAR1 = 'e2e/manage/requests/api-manage1.har' |  | ||||||
| const REQUESTS_HAR2 = 'e2e/manage/requests/api-manage2.har' |  | ||||||
|  |  | ||||||
| test('should show a list of tags with bottom pagination as well', async ({ |  | ||||||
|   page, |  | ||||||
| }) => { |  | ||||||
|   await page.routeFromHAR(REQUESTS_HAR1, { notFound: 'fallback' }) |  | ||||||
|   await page.goto('/tags') |  | ||||||
|   await expect(page.getByRole('main')).toHaveText(/26 total tags/i) |  | ||||||
|   await expect(await page.locator('ngb-pagination')).toHaveCount(2) |  | ||||||
| }) |  | ||||||
|  |  | ||||||
| test('should show a list of correspondents without bottom pagination', async ({ |  | ||||||
|   page, |  | ||||||
| }) => { |  | ||||||
|   await page.routeFromHAR(REQUESTS_HAR2, { notFound: 'fallback' }) |  | ||||||
|   await page.goto('/correspondents') |  | ||||||
|   await expect(page.getByRole('main')).toHaveText(/4 total correspondents/i) |  | ||||||
|   await expect(await page.locator('ngb-pagination')).toHaveCount(1) |  | ||||||
| }) |  | ||||||
|  |  | ||||||
| test('should support quick filter Documents button', async ({ page }) => { |  | ||||||
|   await page.routeFromHAR(REQUESTS_HAR1, { notFound: 'fallback' }) |  | ||||||
|   await page.goto('/tags') |  | ||||||
|   await page |  | ||||||
|     .getByRole('row', { name: 'Inbox' }) |  | ||||||
|     .getByRole('button', { name: 'Documents' }) |  | ||||||
|     .click() |  | ||||||
|   await expect(page).toHaveURL(/tags__id__all=9/) |  | ||||||
| }) |  | ||||||
|  |  | ||||||
| test('should support item editing', async ({ page }) => { |  | ||||||
|   await page.routeFromHAR(REQUESTS_HAR1, { notFound: 'fallback' }) |  | ||||||
|   await page.goto('/tags') |  | ||||||
|   await page |  | ||||||
|     .getByRole('row', { name: 'Inbox' }) |  | ||||||
|     .getByRole('button', { name: 'Edit' }) |  | ||||||
|     .click() |  | ||||||
|   await expect(page.getByRole('dialog')).toBeVisible() |  | ||||||
|   await expect(page.getByLabel('Name')).toHaveValue('Inbox') |  | ||||||
|   await page.getByTitle('Color').getByRole('button').click() |  | ||||||
|   const color = await page.getByLabel('Color').inputValue() |  | ||||||
|  |  | ||||||
|   const updatePromise = page.waitForRequest((request) => { |  | ||||||
|     const data = request.postDataJSON() |  | ||||||
|     const isValid = data['color'] === color |  | ||||||
|     return ( |  | ||||||
|       isValid && |  | ||||||
|       request.method() === 'PUT' && |  | ||||||
|       request.url().includes('/api/tags/9/') |  | ||||||
|     ) |  | ||||||
|   }) |  | ||||||
|  |  | ||||||
|   await page.getByRole('button', { name: 'Save' }).click() |  | ||||||
|   await updatePromise |  | ||||||
| }) |  | ||||||
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							| @@ -101,65 +101,3 @@ test('should support tab direct navigation', async ({ page }) => { | |||||||
|     page.getByRole('tab', { name: 'Users & Groups' }) |     page.getByRole('tab', { name: 'Users & Groups' }) | ||||||
|   ).toHaveAttribute('aria-selected', 'true') |   ).toHaveAttribute('aria-selected', 'true') | ||||||
| }) | }) | ||||||
|  |  | ||||||
| test('should show a list of mail accounts & support creation', async ({ |  | ||||||
|   page, |  | ||||||
| }) => { |  | ||||||
|   await page.routeFromHAR(REQUESTS_HAR2, { notFound: 'fallback' }) |  | ||||||
|   await page.goto('/settings/mail') |  | ||||||
|   await expect( |  | ||||||
|     page.getByRole('listitem').filter({ hasText: 'imap.gmail.com' }) |  | ||||||
|   ).toHaveCount(1) |  | ||||||
|   await expect( |  | ||||||
|     page.getByRole('listitem').filter({ hasText: 'imap.domain.com' }) |  | ||||||
|   ).toHaveCount(1) |  | ||||||
|   await page.getByRole('button', { name: /Add Account/ }).click() |  | ||||||
|   await expect(page.getByRole('dialog')).toHaveCount(1) |  | ||||||
|   await page.getByLabel('Name', { exact: true }).fill('Test Account') |  | ||||||
|   await page.getByLabel('IMAP Server', { exact: true }).fill('imap.server.com') |  | ||||||
|   await page.getByLabel('IMAP Port', { exact: true }).fill('993') |  | ||||||
|   await page.getByLabel('Username', { exact: true }).fill('username') |  | ||||||
|   await page.getByLabel('Password', { exact: true }).fill('password') |  | ||||||
|   const createPromise = page.waitForRequest((request) => { |  | ||||||
|     const data = request.postDataJSON() |  | ||||||
|     const isValid = data['imap_server'] === 'imap.server.com' |  | ||||||
|     return ( |  | ||||||
|       isValid && |  | ||||||
|       request.method() === 'POST' && |  | ||||||
|       request.url().includes('/api/mail_accounts/') |  | ||||||
|     ) |  | ||||||
|   }) |  | ||||||
|   await page.getByRole('button', { name: 'Save' }).click() |  | ||||||
|   await createPromise |  | ||||||
| }) |  | ||||||
|  |  | ||||||
| test('should show a list of mail rules & support creation', async ({ |  | ||||||
|   page, |  | ||||||
| }) => { |  | ||||||
|   await page.routeFromHAR(REQUESTS_HAR3, { notFound: 'fallback' }) |  | ||||||
|   await page.goto('/settings/mail') |  | ||||||
|   await expect( |  | ||||||
|     page.getByRole('listitem').filter({ hasText: 'domain' }) |  | ||||||
|   ).toHaveCount(2) |  | ||||||
|   await expect( |  | ||||||
|     page.getByRole('listitem').filter({ hasText: 'gmail' }) |  | ||||||
|   ).toHaveCount(2) |  | ||||||
|   await page.getByRole('button', { name: /Add Rule/ }).click() |  | ||||||
|   await expect(page.getByRole('dialog')).toHaveCount(1) |  | ||||||
|   await page.getByLabel('Name', { exact: true }).fill('Test Rule') |  | ||||||
|   await page.getByTitle('Account').locator('span').first().click() |  | ||||||
|   await page.getByRole('option', { name: 'gmail' }).click() |  | ||||||
|   await page.getByLabel('Maximum age (days)').fill('0') |  | ||||||
|   const createPromise = page.waitForRequest((request) => { |  | ||||||
|     const data = request.postDataJSON() |  | ||||||
|     const isValid = data['name'] === 'Test Rule' |  | ||||||
|     return ( |  | ||||||
|       isValid && |  | ||||||
|       request.method() === 'POST' && |  | ||||||
|       request.url().includes('/api/mail_rules/') |  | ||||||
|     ) |  | ||||||
|   }) |  | ||||||
|   await page.getByRole('button', { name: 'Save' }).scrollIntoViewIfNeeded() |  | ||||||
|   await page.getByRole('button', { name: 'Save' }).click() |  | ||||||
|   await createPromise |  | ||||||
| }) |  | ||||||
|   | |||||||
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							| @@ -1,71 +0,0 @@ | |||||||
| import { test, expect } from '@playwright/test' |  | ||||||
|  |  | ||||||
| const REQUESTS_HAR = 'e2e/tasks/requests/api-tasks.har' |  | ||||||
|  |  | ||||||
| test('should show a list of dismissable tasks in tabs', async ({ page }) => { |  | ||||||
|   await page.routeFromHAR(REQUESTS_HAR, { notFound: 'fallback' }) |  | ||||||
|   await page.goto('/tasks') |  | ||||||
|   await expect(page.getByRole('tab', { name: /Failed/ })).toHaveText(/1/) |  | ||||||
|   await expect( |  | ||||||
|     page.getByRole('cell').filter({ hasText: 'Dismiss' }) |  | ||||||
|   ).toHaveCount(1) |  | ||||||
|   await expect(page.getByRole('tab', { name: /Complete/ })).toHaveText(/8/) |  | ||||||
|   await page.getByRole('tab', { name: /Complete/ }).click() |  | ||||||
|   await expect( |  | ||||||
|     page.getByRole('cell').filter({ hasText: 'Dismiss' }) |  | ||||||
|   ).toHaveCount(8) |  | ||||||
|   await page.getByRole('tab', { name: /Started/ }).click() |  | ||||||
|   await expect( |  | ||||||
|     page.getByRole('cell').filter({ hasText: 'Dismiss' }) |  | ||||||
|   ).toHaveCount(0) |  | ||||||
|   await page.getByRole('tab', { name: /Queued/ }).click() |  | ||||||
|   await expect( |  | ||||||
|     page.getByRole('cell').filter({ hasText: 'Dismiss' }) |  | ||||||
|   ).toHaveCount(0) |  | ||||||
| }) |  | ||||||
|  |  | ||||||
| test('should support dismissing tasks', async ({ page }) => { |  | ||||||
|   await page.routeFromHAR(REQUESTS_HAR, { notFound: 'fallback' }) |  | ||||||
|   await page.goto('/tasks') |  | ||||||
|   await page.getByRole('tab', { name: /Failed/ }).click() |  | ||||||
|   const dismissPromise = page.waitForRequest((request) => { |  | ||||||
|     const data = request.postDataJSON() |  | ||||||
|     const isValid = Array.isArray(data['tasks']) && data['tasks'].includes(255) |  | ||||||
|     return ( |  | ||||||
|       isValid && |  | ||||||
|       request.method() === 'POST' && |  | ||||||
|       request.url().includes('/api/acknowledge_tasks/') |  | ||||||
|     ) |  | ||||||
|   }) |  | ||||||
|   await page |  | ||||||
|     .getByRole('button', { name: 'Dismiss', exact: true }) |  | ||||||
|     .first() |  | ||||||
|     .click() |  | ||||||
|   await dismissPromise |  | ||||||
| }) |  | ||||||
|  |  | ||||||
| test('should support dismiss all tasks', async ({ page }) => { |  | ||||||
|   await page.routeFromHAR(REQUESTS_HAR, { notFound: 'fallback' }) |  | ||||||
|   await page.goto('/tasks') |  | ||||||
|   await expect(page.getByRole('button', { name: 'Dismiss all' })).toBeEnabled() |  | ||||||
|   await page.getByRole('button', { name: 'Dismiss all' }).click() |  | ||||||
|   const dismissPromise = page.waitForRequest((request) => { |  | ||||||
|     const data = request.postDataJSON() |  | ||||||
|     const isValid = Array.isArray(data['tasks']) |  | ||||||
|     return ( |  | ||||||
|       isValid && |  | ||||||
|       request.method() === 'POST' && |  | ||||||
|       request.url().includes('/api/acknowledge_tasks/') |  | ||||||
|     ) |  | ||||||
|   }) |  | ||||||
|   await page.getByRole('button', { name: /Dismiss/ }).click() |  | ||||||
|   await dismissPromise |  | ||||||
| }) |  | ||||||
|  |  | ||||||
| test('should warn on dismiss all tasks', async ({ page }) => { |  | ||||||
|   await page.routeFromHAR(REQUESTS_HAR, { notFound: 'fallback' }) |  | ||||||
|   await page.goto('/tasks') |  | ||||||
|   await expect(page.getByRole('button', { name: 'Dismiss all' })).toBeEnabled() |  | ||||||
|   await page.getByRole('button', { name: 'Dismiss all' }).click() |  | ||||||
|   await expect(page.getByRole('dialog')).toHaveCount(1) |  | ||||||
| }) |  | ||||||
		Reference in New Issue
	
	Block a user
	 shamoon
					shamoon