|
| 1 | +import { logIn } from '../../pages/login.po'; |
| 2 | +import { projectView } from '../../pages/project/view.po'; |
| 3 | +import { ProjectHelper } from '../../helpers/project.helper'; |
| 4 | +import { TestSuite } from '../../../src/app/shared/models/testSuite'; |
| 5 | +import { testRunList } from '../../pages/testrun/list.po'; |
| 6 | +import { TestRun } from '../../../src/app/shared/models/testRun'; |
| 7 | +import { Milestone } from '../../../src/app/shared/models/milestone'; |
| 8 | +import users from '../../data/users.json'; |
| 9 | +import using from 'jasmine-data-provider'; |
| 10 | +import cucumberImport from '../../data/import/cucumber.json'; |
| 11 | + |
| 12 | +const editorExamples = { |
| 13 | + localAdmin: users.localAdmin, |
| 14 | + localManager: users.localManager, |
| 15 | + manager: users.manager, |
| 16 | +}; |
| 17 | + |
| 18 | +const notEditorExamples = { |
| 19 | + localEngineer: users.localEngineer |
| 20 | +}; |
| 21 | + |
| 22 | +describe('Test Run List: Bulk Delete:', () => { |
| 23 | + const projectHelper: ProjectHelper = new ProjectHelper(); |
| 24 | + const suite: TestSuite = { name: 'Smoke' }; |
| 25 | + let testRuns: TestRun[]; |
| 26 | + |
| 27 | + beforeAll(async () => { |
| 28 | + await projectHelper.init({ |
| 29 | + localAdmin: users.localAdmin, |
| 30 | + localManager: users.localManager, |
| 31 | + manager: users.manager, |
| 32 | + admin: users.autoAdmin, |
| 33 | + localEngineer: users.localEngineer |
| 34 | + }); |
| 35 | + }); |
| 36 | + |
| 37 | + afterAll(async () => { |
| 38 | + return projectHelper.dispose(); |
| 39 | + }); |
| 40 | + |
| 41 | + using(editorExamples, (user, description) => { |
| 42 | + describe(`${description} role:`, () => { |
| 43 | + |
| 44 | + beforeAll(async () => { |
| 45 | + testRuns = await projectHelper.importer |
| 46 | + .executeCucumberImport(suite.name, |
| 47 | + [cucumberImport,cucumberImport,cucumberImport,cucumberImport,cucumberImport], |
| 48 | + [`build_1.json`, `build_2.json`, `build_3.json`, `build_4.json`, `build_5.json`]); |
| 49 | + await logIn.logInAs(user.user_name, user.password); |
| 50 | + await projectHelper.openProject(); |
| 51 | + return projectView.menuBar.testRuns(); |
| 52 | + }); |
| 53 | + |
| 54 | + it('Can Cancel Bulk Delete', async () => { |
| 55 | + await testRunList.selectTestRun(testRuns[0].build_name, testRuns[1].build_name, testRuns[2].build_name); |
| 56 | + await testRunList.clickDeleteAll(); |
| 57 | + await expect(testRunList.modal.isVisible()).toBe(true, 'Modal was not opened on Delete All click'); |
| 58 | + await testRunList.modal.clickCancel(); |
| 59 | + await expect(testRunList.modal.isPresent()).toBe(false, 'Modal was not closed on Cancel click'); |
| 60 | + return expect(testRunList.areAllTestRunsDisplayed(testRuns[0].build_name, testRuns[1].build_name, testRuns[2].build_name)) |
| 61 | + .toBe(true, 'Test runs were removed after cancelling bulk delete'); |
| 62 | + }); |
| 63 | + |
| 64 | + it('Can Execute Bulk Delete', async () => { |
| 65 | + await testRunList.clickDeleteAll(); |
| 66 | + await testRunList.modal.clickSuccess(); |
| 67 | + await expect(testRunList.modal.isPresent()).toBe(false, 'Modal was not closed on Yes click'); |
| 68 | + await testRunList.notification.assertIsSuccess('Test runs were deleted.'); |
| 69 | + return expect(testRunList.areAllTestRunsDisplayed(testRuns[0].build_name, testRuns[1].build_name, testRuns[2].build_name)) |
| 70 | + .toBe(false, 'Test runs were not removed after bulk delete'); |
| 71 | + }); |
| 72 | + }); |
| 73 | + }); |
| 74 | + |
| 75 | + using(notEditorExamples, (user, description) => { |
| 76 | + describe(`${description} role:`, () => { |
| 77 | + |
| 78 | + beforeAll(async () => { |
| 79 | + testRuns = await projectHelper.importer |
| 80 | + .executeCucumberImport(suite.name, |
| 81 | + [cucumberImport], |
| 82 | + [`build_1.json`]); |
| 83 | + await logIn.logInAs(user.user_name, user.password); |
| 84 | + await projectHelper.openProject(); |
| 85 | + return projectView.menuBar.testRuns(); |
| 86 | + }); |
| 87 | + |
| 88 | + it('Table Row selector is not available', async () => { |
| 89 | + return expect(testRunList.isSelectorAvailable()).toBe(false, 'Selector is available!'); |
| 90 | + }); |
| 91 | + }); |
| 92 | + }); |
| 93 | +}); |
0 commit comments