|
| 1 | +import { test } from '@playwright/test'; |
| 2 | +import { LoginPage } from '../../../../Page objects/Login.page'; |
| 3 | +import { WorkflowCasesPage } from '../WorkflowCases.page'; |
| 4 | +import { testSorting } from '../../../../helper-functions'; |
| 5 | + |
| 6 | +let page; |
| 7 | + |
| 8 | +test.describe('Workflow cases - Sorting', () => { |
| 9 | + test.beforeAll(async ({ browser }) => { |
| 10 | + page = await browser.newPage(); |
| 11 | + const loginPage = new LoginPage(page); |
| 12 | + await loginPage.open('/auth'); |
| 13 | + await loginPage.login(); |
| 14 | + const workflowCasesPage = new WorkflowCasesPage(page); |
| 15 | + await workflowCasesPage.goToWorkflowCasesPage(); |
| 16 | + }); |
| 17 | + |
| 18 | + test.afterAll(async () => { |
| 19 | + await page.close(); |
| 20 | + }); |
| 21 | + |
| 22 | + test('should be able to sort by ID', async () => { |
| 23 | + await testSorting(page, 'thead > tr > th.mat-column-id', '#workflowCaseId', 'ID'); |
| 24 | + }); |
| 25 | + |
| 26 | + test('should be able to sort by date of incident', async () => { |
| 27 | + await testSorting( |
| 28 | + page, |
| 29 | + 'thead > tr > th.mat-column-dateOfIncident', |
| 30 | + '#workflowCaseDateOfIncident', |
| 31 | + 'date of incident', |
| 32 | + ); |
| 33 | + }); |
| 34 | + |
| 35 | + test('should be able to sort by incident type', async () => { |
| 36 | + await testSorting( |
| 37 | + page, |
| 38 | + 'thead > tr > th.mat-column-incidentType', |
| 39 | + '#workflowCaseIncidentType', |
| 40 | + 'incident type', |
| 41 | + ); |
| 42 | + }); |
| 43 | + |
| 44 | + test('should be able to sort by incident place', async () => { |
| 45 | + await testSorting( |
| 46 | + page, |
| 47 | + 'thead > tr > th.mat-column-incidentPlace', |
| 48 | + '#workflowCaseIncidentPlace', |
| 49 | + 'incident place', |
| 50 | + ); |
| 51 | + }); |
| 52 | + |
| 53 | + test('should be able to sort by description', async () => { |
| 54 | + await testSorting( |
| 55 | + page, |
| 56 | + 'thead > tr > th.mat-column-description', |
| 57 | + '#workflowCaseDescription', |
| 58 | + 'description', |
| 59 | + ); |
| 60 | + }); |
| 61 | + |
| 62 | + test('should be able to sort by action plan', async () => { |
| 63 | + await testSorting( |
| 64 | + page, |
| 65 | + 'thead > tr > th.mat-column-actionPlan', |
| 66 | + '#workflowCaseActionPlan', |
| 67 | + 'action plan', |
| 68 | + ); |
| 69 | + }); |
| 70 | +}); |
0 commit comments