|
| 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 | + localEngineer: users.localEngineer |
| 17 | +}; |
| 18 | + |
| 19 | +const notEditorExamples = { |
| 20 | + viewer: users.viewer, |
| 21 | +}; |
| 22 | + |
| 23 | +describe('Test Run List:', () => { |
| 24 | + const projectHelper: ProjectHelper = new ProjectHelper(); |
| 25 | + const testRuns: { build_1: TestRun, build_2: TestRun } = { |
| 26 | + build_1: { build_name: 'build_1' }, |
| 27 | + build_2: { build_name: 'build_2' } |
| 28 | + }; |
| 29 | + const suite: TestSuite = { name: 'Smoke' }; |
| 30 | + const milestones: { inactive: Milestone, active: Milestone } = { |
| 31 | + inactive: { name: '0.1.1', active: 0 }, |
| 32 | + active: { name: '0.1.2' } |
| 33 | + }; |
| 34 | + |
| 35 | + beforeAll(async () => { |
| 36 | + await projectHelper.init({ |
| 37 | + localEngineer: users.localEngineer, |
| 38 | + viewer: users.viewer, |
| 39 | + localAdmin: users.localAdmin, |
| 40 | + localManager: users.localManager |
| 41 | + }); |
| 42 | + milestones.active = await projectHelper.editorAPI.createMilestone(milestones.active); |
| 43 | + milestones.inactive = await projectHelper.editorAPI.createMilestone(milestones.inactive); |
| 44 | + testRuns.build_1 = (await projectHelper.importer |
| 45 | + .executeCucumberImport(suite.name, [cucumberImport], [`${testRuns.build_1.build_name}.json`]))[0]; |
| 46 | + testRuns.build_2 = (await projectHelper.importer |
| 47 | + .executeCucumberImport(suite.name, [cucumberImport], [`${testRuns.build_2.build_name}.json`]))[0]; |
| 48 | + testRuns.build_1.milestone_id = milestones.inactive.id; |
| 49 | + testRuns.build_1 = await projectHelper.editorAPI.createTestRun(testRuns.build_1); |
| 50 | + }); |
| 51 | + |
| 52 | + afterAll(async () => { |
| 53 | + return projectHelper.dispose(); |
| 54 | + }); |
| 55 | + |
| 56 | + using(editorExamples, (user, description) => { |
| 57 | + describe(`${description} role:`, () => { |
| 58 | + |
| 59 | + beforeAll(async () => { |
| 60 | + await logIn.logInAs(user.user_name, user.password); |
| 61 | + return projectHelper.openProject(); |
| 62 | + }); |
| 63 | + |
| 64 | + it('Can open Test Run List Page', async () => { |
| 65 | + await projectView.menuBar.testRuns(); |
| 66 | + return expect(testRunList.isOpened()).toBe(true, 'Should be able to open Test Run List!'); |
| 67 | + }); |
| 68 | + |
| 69 | + it('Can edit Test Run Milestone with only active milestones', async () => { |
| 70 | + return expect(testRunList.doesMilestonePresentInEdit(milestones.inactive.name, testRuns.build_2.build_name)) |
| 71 | + .toBe(false, 'Inactive milestones should not be available in edit!'); |
| 72 | + }); |
| 73 | + |
| 74 | + it('Can add Test Run Milestone', async () => { |
| 75 | + await testRunList.setMilestone(milestones.active.name, testRuns.build_2.build_name); |
| 76 | + return testRunList.notification.assertIsSuccess(); |
| 77 | + }); |
| 78 | + |
| 79 | + it('Can filter by inactive Milestone', async () => { |
| 80 | + await testRunList.filterByMilestone(milestones.inactive.name); |
| 81 | + await expect(testRunList.isTestRunRowDisplayed(testRuns.build_2.build_name)) |
| 82 | + .toBe(false, 'Test run with another milestone is still present'); |
| 83 | + return expect(testRunList.isTestRunRowDisplayed(testRuns.build_1.build_name)) |
| 84 | + .toBe(true, 'Test run with milestone is not present'); |
| 85 | + }); |
| 86 | + |
| 87 | + it('Can filter by active Milestone', async () => { |
| 88 | + await testRunList.filterByMilestone(milestones.active.name); |
| 89 | + await expect(testRunList.isTestRunRowDisplayed(testRuns.build_1.build_name)) |
| 90 | + .toBe(false, 'Test run with another milestone is still present'); |
| 91 | + return expect(testRunList.isTestRunRowDisplayed(testRuns.build_2.build_name)) |
| 92 | + .toBe(true, 'Test run with milestone is not present'); |
| 93 | + }); |
| 94 | + |
| 95 | + it('Can remove Test Run Milestone', async () => { |
| 96 | + await testRunList.setMilestone('Not Assigned', testRuns.build_2.build_name); |
| 97 | + return testRunList.notification.assertIsSuccess(); |
| 98 | + }); |
| 99 | + }); |
| 100 | + }); |
| 101 | + |
| 102 | + using(notEditorExamples, (user, description) => { |
| 103 | + describe(`${description} role:`, () => { |
| 104 | + |
| 105 | + beforeAll(async () => { |
| 106 | + testRuns.build_2.milestone_id = milestones.active.id; |
| 107 | + testRuns.build_2 = await projectHelper.editorAPI.createTestRun(testRuns.build_2); |
| 108 | + await logIn.logInAs(user.user_name, user.password); |
| 109 | + return projectHelper.openProject(); |
| 110 | + }); |
| 111 | + |
| 112 | + it('Can open Test Run List Page', async () => { |
| 113 | + await projectView.menuBar.testRuns(); |
| 114 | + return expect(testRunList.isOpened()).toBe(true, 'Should be able to open Test Run List!'); |
| 115 | + }); |
| 116 | + |
| 117 | + it('Can not edit Test Runs table', async () => { |
| 118 | + await projectView.menuBar.testRuns(); |
| 119 | + return expect(testRunList.isTableEditable()).toBe(false, 'Should not be able to edit Test Runs!'); |
| 120 | + }); |
| 121 | + |
| 122 | + it('Can filter by inactive Milestone', async () => { |
| 123 | + await testRunList.filterByMilestone(milestones.inactive.name); |
| 124 | + await expect(testRunList.isTestRunRowDisplayed(testRuns.build_2.build_name)) |
| 125 | + .toBe(false, 'Test run with another milestone is still present'); |
| 126 | + return expect(testRunList.isTestRunRowDisplayed(testRuns.build_1.build_name)) |
| 127 | + .toBe(true, 'Test run with milestone is not present'); |
| 128 | + }); |
| 129 | + |
| 130 | + it('Can filter by active Milestone', async () => { |
| 131 | + await testRunList.filterByMilestone(milestones.active.name); |
| 132 | + await expect(testRunList.isTestRunRowDisplayed(testRuns.build_1.build_name)) |
| 133 | + .toBe(false, 'Test run with another milestone is still present'); |
| 134 | + return expect(testRunList.isTestRunRowDisplayed(testRuns.build_2.build_name)) |
| 135 | + .toBe(true, 'Test run with milestone is not present'); |
| 136 | + }); |
| 137 | + }); |
| 138 | + }); |
| 139 | +}); |
0 commit comments