@digital-ai/devops-page-object-release 0.0.1 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,12 +0,0 @@
1
-
2
- > @digital-ai/devops-page-object-release@0.0.1 build /home/runner/work/devops-page-objects/devops-page-objects/apps/release
3
- > parcel build --cache-dir .parcel-cache --dist-dir .dist
4
-
5
- Building...
6
- Bundling...
7
- Packaging & Optimizing...
8
- ✨ Built in 5.21s
9
-
10
- dist/main.js 81.08 KB 110ms
11
- dist/module.js 22.55 KB 110ms
12
- dist/types.d.ts 7.42 KB 96ms
@@ -1,11 +0,0 @@
1
-
2
- > @digital-ai/devops-page-object-release@0.0.1 lint /home/runner/work/devops-page-objects/devops-page-objects/apps/release
3
- > eslint . --ext .js,.jsx,.ts,.tsx
4
-
5
-
6
- /home/runner/work/devops-page-objects/devops-page-objects/apps/release/types/index.ts
7
- 34:18 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
8
- 41:10 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
9
-
10
- ✖ 2 problems (0 errors, 2 warnings)
11
-
@@ -1,4 +0,0 @@
1
-
2
- > @digital-ai/devops-page-object-release@0.0.1 tsc /home/runner/work/devops-page-objects/devops-page-objects/apps/release
3
- > tsc --noEmit
4
-
@@ -1,168 +0,0 @@
1
- import isUndefined from 'lodash/isUndefined';
2
- import each from 'lodash/each';
3
- import forEach from 'lodash/forEach';
4
- import defaults from 'lodash/defaults';
5
- import toPairs from 'lodash/toPairs';
6
-
7
- import { Container, Dashboard, Phase, Release, Task, Tile, Variable, VariableValueProvider } from '../types';
8
-
9
- export const initReleaseDefaults = (function () {
10
- const RELEASE_TYPE = 'xlrelease.Release';
11
- const PHASE_TYPE = 'xlrelease.Phase';
12
- const TEAM_TYPE = 'xlrelease.Team';
13
- const TASK_TYPE = 'xlrelease.Task';
14
- const COMMENT_TYPE = 'xlrelease.Comment';
15
- const CONDITION_TYPE = 'xlrelease.GateCondition';
16
- const DEPENDENCY_TYPE = 'xlrelease.Dependency';
17
- const LINK_TYPE = 'xlrelease.Link';
18
- const ATTACHMENT_TYPE = 'xlrelease.Attachment';
19
- const DASHBOARD_TYPE = 'xlrelease.Dashboard';
20
- const _TRIGGER_TYPE = 'xlrelease.ReleaseTrigger';
21
- const JIRA_TYPE = 'jira.CreateIssue';
22
- const DEFAULT_TASK_OWNER = 'Itchy';
23
-
24
- const processTasks = (task: Task, container: Container, index: number): void => {
25
- if (isUndefined(task.type)) task.type = TASK_TYPE;
26
- task.id = task.id || `${container.id}/Task${index}`;
27
- if (isUndefined(task.owner) && task.type !== JIRA_TYPE) task.owner = DEFAULT_TASK_OWNER;
28
- if (task.owner === null) delete task.owner;
29
-
30
- each(task.conditions, function (condition, idx) {
31
- condition.type = CONDITION_TYPE;
32
- condition.id = `${task.id}/GateCondition${idx}`;
33
- });
34
- each(task.dependencies, function (dependency, idx) {
35
- dependency.type = DEPENDENCY_TYPE;
36
- dependency.id = `${task.id}/Dependency${idx}`;
37
- });
38
- each(task.links, function (link, idx) {
39
- link.type = LINK_TYPE;
40
- link.id = `${task.id}/Link${idx}`;
41
- });
42
- each(task.comments, function (comment, idx) {
43
- comment.type = COMMENT_TYPE;
44
- comment.id = `${task.id}/Comment${idx}`;
45
- });
46
- each(task.tasks, function (subTask, idx) {
47
- processTasks(subTask, task, idx);
48
- });
49
- each(task.templateVariables, function (variable, idx) {
50
- defaults(variable, getVariableEntity(variable.value, variable.key, task.id, idx));
51
- });
52
- each(task.attachments, function (attachment, idx) {
53
- attachment.type = ATTACHMENT_TYPE;
54
- attachment.id = `${task.id}/Attachment${idx}`;
55
- });
56
- if (task.pythonScript) {
57
- const pythonScript = task.pythonScript;
58
- pythonScript.id = `${task.id}/PythonScript`;
59
- pythonScript.customScriptTask = task.id;
60
- }
61
- };
62
-
63
- const processPhases = (phase: Phase, release: Release, index: number): void => {
64
- phase.type = PHASE_TYPE;
65
- phase.id = `${release.id}/Phase${index}`;
66
-
67
- forEach(phase.tasks, (task, idx): void => {
68
- processTasks(task, phase, idx);
69
- });
70
- };
71
-
72
- const getVariableEntity = (
73
- value: string,
74
- key: string,
75
- containerId: string,
76
- index: number,
77
- password?: boolean,
78
- // eslint-disable-next-line max-params
79
- ): Variable => {
80
- const keyNoSyntax = key.replace('${', '').replace('}', '');
81
- return {
82
- title: '',
83
- id: `${containerId}/Variable${index}`,
84
- key: keyNoSyntax,
85
- requiresValue: true,
86
- showOnReleaseStart: true,
87
- type: password ? 'xlrelease.PasswordStringVariable' : 'xlrelease.StringVariable',
88
- value: value,
89
- };
90
- };
91
-
92
- const getValueProviderConfigurationEntity = function (containerId: string): VariableValueProvider {
93
- return {
94
- id: `${containerId}/valueProvider`,
95
- variable: containerId,
96
- };
97
- };
98
-
99
- const getDashboardExtension = (dashboard: Dashboard, releaseId: string): Dashboard => {
100
- const dashboardExtension: Dashboard = {
101
- id: `${releaseId}/summary`,
102
- type: DASHBOARD_TYPE,
103
- tiles: [],
104
- };
105
- if (dashboard.tiles) {
106
- forEach(dashboard.tiles, function (tile, index) {
107
- dashboardExtension.tiles.push(getTileEntity(tile, `${releaseId}/summary`, index));
108
- });
109
- }
110
- return dashboardExtension;
111
- };
112
-
113
- function getTileEntity(tile: Tile, containerId: string, index: number): Tile {
114
- tile.id = tile.id || `${containerId}/Tile${index}`;
115
- return tile;
116
- }
117
-
118
- return function (release: Release) {
119
- release.type = RELEASE_TYPE;
120
- if (release.id.indexOf('Applications/') === -1) {
121
- release.id = `Applications/${release.id}`;
122
- }
123
- if (release.startDate) {
124
- release.queryableStartDate = release.startDate;
125
- } else if (release.scheduledStartDate) {
126
- release.queryableStartDate = release.scheduledStartDate;
127
- }
128
- if (release.endDate) {
129
- release.queryableEndDate = release.endDate;
130
- } else if (release.dueDate) {
131
- release.queryableEndDate = release.dueDate;
132
- }
133
- if (isUndefined(release.owner)) release.owner = 'Itchy'; // default release manager
134
-
135
- forEach(release.phases, function (phase, index) {
136
- processPhases(phase, release, index);
137
- });
138
- forEach(release.teams, function (team, index) {
139
- team.type = TEAM_TYPE;
140
- team.id = `${release.id}/Team${index}`;
141
- });
142
- forEach(release.attachments, function (attachment, index) {
143
- attachment.type = ATTACHMENT_TYPE;
144
- attachment.id = `${release.id}/Attachment${index}`;
145
- });
146
- forEach(release.variables, function (variable: Variable, index) {
147
- defaults(variable, getVariableEntity(variable.value, variable.key, release.id, index));
148
- if (variable.valueProvider) {
149
- defaults(variable.valueProvider, getValueProviderConfigurationEntity(variable.id));
150
- }
151
- });
152
- forEach(toPairs(release.variableValues), function (keyValue, index) {
153
- if (!release.variables) release.variables = [];
154
- release.variables.push(getVariableEntity(keyValue[1], keyValue[0], release.id, 1000 + index));
155
- release.variableValues = undefined;
156
- });
157
- forEach(toPairs(release.passwordVariableValues), function (keyValue, index) {
158
- if (!release.variables) release.variables = [];
159
- release.variables.push(getVariableEntity(keyValue[1], keyValue[0], release.id, 1500 + index, true));
160
- release.passwordVariableValues = undefined;
161
- });
162
-
163
- if (release.summary) {
164
- release.extensions = [getDashboardExtension(release.summary, release.id)];
165
- release.summary = undefined;
166
- }
167
- };
168
- })();
package/fixtures/index.ts DELETED
@@ -1,191 +0,0 @@
1
- import { test as base, expect, Page, APIResponse } from '@playwright/test';
2
- import { execFile } from 'child_process';
3
- import { APIRequestContext } from 'playwright-core';
4
- import isNil from 'lodash/isNil';
5
- import { Navigation } from '../pages';
6
- import { LoginPage } from '../pages/LoginPage';
7
- import { ApplicationsPage } from '../pages/ApplicationsPage';
8
- import { PersonalAccessTokenPage } from '../pages/PersonalAccessTokenPage';
9
- import { initReleaseDefaults } from './helper';
10
- import * as process from 'process';
11
- import { FixtureConfiguration, FixtureFeature, FixtureRelease, FixtureTrigger, Release } from '../types';
12
-
13
- const adminHeaders = {
14
- Authorization: 'Basic YWRtaW46YWRtaW4=',
15
- Cookie: 'XSRF-TOKEN=1;',
16
- 'X-XSRF-TOKEN': '1',
17
- };
18
-
19
- type ReleaseFixtures = {
20
- applicationPage: ApplicationsPage;
21
- fixtures: Fixtures;
22
- loginPage: LoginPage;
23
- navigation: Navigation;
24
- personalAccessTokenPage: PersonalAccessTokenPage;
25
- };
26
-
27
- export const test = base.extend<ReleaseFixtures>({
28
- fixtures: async ({ request, page }, use) => {
29
- const fixtures = new Fixtures(request, page);
30
- await use(fixtures);
31
- return fixtures;
32
- },
33
- loginPage: async ({ page }, use) => {
34
- const loginPage = new LoginPage(page);
35
- await use(loginPage);
36
- return loginPage;
37
- },
38
- applicationPage: async ({ page }, use) => {
39
- const applicationPage = new ApplicationsPage(page);
40
- await use(applicationPage);
41
- return applicationPage;
42
- },
43
- personalAccessTokenPage: async ({ page }, use) => {
44
- const personalAccessTokenPage = new PersonalAccessTokenPage(page);
45
- await use(personalAccessTokenPage);
46
- return personalAccessTokenPage;
47
- },
48
- navigation: async ({ page }, use) => {
49
- const navigationPage = new Navigation(page);
50
- await use(navigationPage);
51
- return navigationPage;
52
- },
53
- });
54
-
55
- class Fixtures {
56
- private readonly request: APIRequestContext;
57
- private readonly page: Page;
58
-
59
- private releaseIds: Array<string> = [];
60
- private triggerIds: Array<string> = [];
61
- private configurationIds: Array<string> = [];
62
-
63
- constructor(request: APIRequestContext, page: Page) {
64
- this.request = request;
65
- this.page = page;
66
- }
67
-
68
- release(release: FixtureRelease): Promise<APIResponse> {
69
- this.initDefaults(release);
70
- this.releaseIds.push(release.id);
71
- return this.deleteRelease(release.id)
72
- .then(() => this.deleteArchivedRelease(release.id))
73
- .then(() => this.doPost('fixtures/release', release));
74
- }
75
-
76
- configuration(ci: FixtureConfiguration): Promise<APIResponse> {
77
- this.configurationIds.push(ci.id);
78
- return this.doPost('fixtures/shared', [ci]);
79
- }
80
-
81
- trigger(trigger: FixtureTrigger): Promise<APIResponse> {
82
- this.triggerIds.push(trigger.id);
83
- return this.doPost('fixtures/trigger', trigger);
84
- }
85
-
86
- deleteArchivedRelease(id: string): Promise<APIResponse> {
87
- const releaseId = id.includes('Applications/') ? id : `Applications/${id}`;
88
- return this.doDelete('fixtures/cis', [
89
- {
90
- id: releaseId,
91
- type: 'xlrelease.Release',
92
- },
93
- ]);
94
- }
95
-
96
- deleteRelease(id: string): Promise<APIResponse> {
97
- const releaseId = id.includes('Applications/') ? id : `Applications/${id}`;
98
- return this.doDelete(`fixtures/${releaseId}`);
99
- }
100
-
101
- deleteTrigger(id: string): Promise<APIResponse> {
102
- return this.doDelete(`fixtures/trigger/${id}`);
103
- }
104
-
105
- deleteConfiguration(id: string): Promise<APIResponse> {
106
- return this.doDelete(`fixtures/shared`, [id]);
107
- }
108
-
109
- cleanAll(): Promise<Awaited<APIResponse>[]> {
110
- const promises = [];
111
- for (const releaseId of this.releaseIds.reverse()) {
112
- promises.push(this.deleteRelease(releaseId));
113
- }
114
- for (const triggerId of this.triggerIds) {
115
- promises.push(this.deleteTrigger(triggerId));
116
- }
117
- for (const confId of this.configurationIds) {
118
- promises.push(this.deleteConfiguration(confId));
119
- }
120
- this.releaseIds = [];
121
- this.triggerIds = [];
122
- this.configurationIds = [];
123
- return Promise.all(promises);
124
- }
125
-
126
- async waitForReleaseStarted(releaseTitle: string): Promise<void> {
127
- await expect(async () => {
128
- const resp = await this.doPost('releases/search', {
129
- inProgress: true,
130
- paused: true,
131
- failing: true,
132
- failed: true,
133
- title: releaseTitle,
134
- });
135
- const page = await resp.json();
136
- await expect(page.cis.length).toBeGreaterThan(0);
137
- }).toPass();
138
- }
139
-
140
- async waitForFirstPoll(triggerId: string): Promise<void> {
141
- await expect(async () => {
142
- const resp = await this.doGet(`api/v1/triggers/${triggerId}`);
143
- const trigger = await resp.json();
144
- await expect(isNil(trigger.triggerState)).toBe(false);
145
- }).toPass();
146
- }
147
-
148
- exec(path: string): Promise<void> {
149
- return new Promise<void>((resolve, reject) => {
150
- execFile(path, (error) => {
151
- if (error === null) {
152
- return resolve();
153
- } else {
154
- return reject();
155
- }
156
- });
157
- });
158
- }
159
-
160
- getFakeApiUrl(): string {
161
- return this.getEnvVariable('ENV_FAKE_API') || 'http://localhost:5517';
162
- }
163
-
164
- getEnvVariable(name: string): string | undefined {
165
- return process.env[name];
166
- }
167
-
168
- async setFeatures(features: Array<FixtureFeature>): Promise<APIResponse> {
169
- return this.doPut('/settings/features', features);
170
- }
171
-
172
- private doPost(url: string, body: unknown): Promise<APIResponse> {
173
- return this.request.post(url, { data: body, headers: adminHeaders });
174
- }
175
-
176
- private doPut(url: string, body: unknown): Promise<APIResponse> {
177
- return this.request.put(url, { data: body, headers: adminHeaders });
178
- }
179
-
180
- private doGet(url: string): Promise<APIResponse> {
181
- return this.request.get(url, { headers: adminHeaders });
182
- }
183
-
184
- private doDelete(url: string, body?: unknown): Promise<APIResponse> {
185
- return this.request.delete(url, { data: body, headers: adminHeaders });
186
- }
187
-
188
- private initDefaults(ci: FixtureRelease): void {
189
- initReleaseDefaults(ci as Release);
190
- }
191
- }
package/index.ts DELETED
@@ -1 +0,0 @@
1
- export { test } from './fixtures';
@@ -1,32 +0,0 @@
1
- import { expect } from '@playwright/test';
2
- import { WithPage } from './WithPage';
3
-
4
- export class ApplicationsPage extends WithPage {
5
- async goToApplicationsPage(): Promise<this> {
6
- await this.page.goto('./#/applications');
7
- await expect(this.page).toHaveTitle('Applications - Digital.ai Release');
8
- return this;
9
- }
10
-
11
- async addNewApplication(applicationName: string): Promise<this> {
12
- await this.page.locator(`//button[normalize-space()='New application']`).click();
13
- await this.page.locator(`input[placeholder='Add name...']`).type(applicationName);
14
- await this.page.locator(`//button[normalize-space()='Save']`).click();
15
- return this;
16
- }
17
-
18
- async verifyApplicationisCreated(applicationName: string): Promise<this> {
19
- await this.page.waitForSelector(`div[title='${applicationName}'] strong`);
20
- return this;
21
- }
22
-
23
- async createApplicationAndLinkEnvironment(environmentName: string, applicationName: string): Promise<this> {
24
- await this.page.locator(`//button[normalize-space()='New application']`).click();
25
- await this.page.locator(`input[placeholder='Add name...']`).type(applicationName);
26
- await this.page.locator("input[placeholder='Filter environment name...']").type(environmentName);
27
- await this.page.locator(`div[title='${environmentName}']`).click();
28
- await this.page.locator(`//button[normalize-space()='Save']`).click();
29
- await this.page.locator('i.xl-icon.close-icon').click();
30
- return this;
31
- }
32
- }
@@ -1,25 +0,0 @@
1
- import { expect } from '@playwright/test';
2
- import { WithPage } from './WithPage';
3
-
4
- export class EnvironmentsPage extends WithPage {
5
- async goToEnvironmentsPage(): Promise<this> {
6
- await this.page.goto('./#/environments');
7
- await expect(this.page).toHaveTitle('Environments list / Environments - Digital.ai Release');
8
- return this;
9
- }
10
-
11
- async addNewEnvironment(environmentName: string, stageName: string): Promise<this> {
12
- await this.page.locator(`//button[normalize-space()='New environment']`).click();
13
- await this.page.locator(`input[placeholder='Add...']`).type(environmentName);
14
- await this.page.locator(`input[placeholder='Select stage...']`).click();
15
- await this.page.locator(`.yt-option[title='${stageName}']`).click();
16
- await this.page.locator(`//button[normalize-space()='Create']`).click();
17
- await this.page.locator('i.xl-icon.close-icon').click();
18
- return this;
19
- }
20
-
21
- async verifyEnvironmentIsCreated(environmentName: string): Promise<this> {
22
- await this.page.waitForSelector(`div[title='${environmentName}'] strong`);
23
- return this;
24
- }
25
- }
@@ -1,58 +0,0 @@
1
- import { expect } from '@playwright/test';
2
- import { WithPage } from './WithPage';
3
-
4
- export class FolderPage extends WithPage {
5
- async openFoldersPage(): Promise<this> {
6
- await this.page.goto('./#/folders');
7
- await expect(this.page).toHaveTitle('Folders - Digital.ai Release');
8
- return this;
9
- }
10
-
11
- async backToAllFolders(): Promise<this> {
12
- await this.page.locator('.icon-back.dot-i').click();
13
- await expect(this.page).toHaveTitle('Folders - Digital.ai Release');
14
- await this.page.locator('button.btn-add-folder').isVisible();
15
- return this;
16
- }
17
-
18
- async createFolder(folderName: string): Promise<this> {
19
- await this.page.locator('button.btn-add-folder').click();
20
- await this.page.locator('div.xl-react-component-input-wrapper').type(folderName);
21
- await this.page.locator('button.xl-react-button.button.primary').click();
22
- await this.page.locator(`//button[normalize-space()='Add release']`).isVisible();
23
- return this;
24
- }
25
-
26
- async openFolder(folderName: string): Promise<this> {
27
- await this.page.locator(`.folder-row-wrapper span:text-is('${folderName}')`).click();
28
- return this;
29
- }
30
-
31
- async openGroups(): Promise<this> {
32
- //await this.page.locator(`//p[normalize-space()='${tabName}']`).click()
33
- await this.page.getByTestId('sideNav-item-9').click();
34
- return this;
35
- }
36
-
37
- async createGroup(groupName: string): Promise<this> {
38
- await this.page.locator("//button[normalize-space()='New release group']").click();
39
- await this.page.locator('#title').type(groupName);
40
- await this.page.locator("button[type='submit']").click();
41
- return this;
42
- }
43
-
44
- async selectPlannedStatus(): Promise<this> {
45
- await this.page.locator('.remaining-tags').click();
46
- await this.page.locator('.xl-react-link:text-is("Clear all")').click();
47
- await this.page.locator('.react-tagsinput').click();
48
- await this.page.locator(`.yt-option[title=Planned]`).click();
49
- await this.page.locator("//span[normalize-space()='Status']").click();
50
- return this;
51
- }
52
-
53
- async expectReleaseGroupisDisplayed(title: string): Promise<this> {
54
- //await this.page.locator(`.fc-list-item-title-wrapper .fc-list-item-title strong:text-is('${title}`).isVisible()
55
- await this.page.waitForSelector(`.fc-list-item-title-wrapper .fc-list-item-title strong:text-is('${title}')`);
56
- return this;
57
- }
58
- }
@@ -1,18 +0,0 @@
1
- import { expect } from '@playwright/test';
2
- import { WithPage } from './WithPage';
3
-
4
- export class LoginPage extends WithPage {
5
- async login(userName: string, password: string): Promise<void> {
6
- await this.page.goto('./');
7
- await expect(this.page).toHaveTitle('Digital.ai Release');
8
- await this.page.locator('#inputLogin').fill(userName);
9
- await this.page.locator('#inputPassword').fill(password);
10
- await this.page.locator("button[type='submit']").click();
11
- await expect(this.page.locator('#releases-content')).toBeVisible();
12
- }
13
-
14
- async logout(): Promise<void> {
15
- await this.page.locator('button.dot-avatar').click();
16
- await this.page.getByText('Log out').click();
17
- }
18
- }
@@ -1,20 +0,0 @@
1
- import { expect } from '@playwright/test';
2
- import { WithPage } from './WithPage';
3
-
4
- export class PersonalAccessTokenPage extends WithPage {
5
- async openPersonalAccessTokenPage(): Promise<this> {
6
- // await this.page.locator("button.dot-avatar").click()
7
- // await this.page.locator("//div[normalize-space()='Access tokens']").click()
8
- await this.page.goto('./#/personal-access-token');
9
- await expect(this.page).toHaveTitle('Access tokens / Personal settings - Digital.ai Release');
10
- return this;
11
- }
12
-
13
- async addNewToken(tokenName: string): Promise<this> {
14
- //await expect(this.page).toHaveTitle('Access tokens / Personal settings - Digital.ai Release')
15
-
16
- await this.page.locator('#tokenText').fill(tokenName);
17
- await this.page.locator("button[type='submit']").click();
18
- return this;
19
- }
20
- }
@@ -1,74 +0,0 @@
1
- import { Page, Locator, expect } from '@playwright/test';
2
- import { TriggersPage } from './TriggersPage';
3
- import { WithPage } from './WithPage';
4
- import { CustomScriptTaskModal } from './task-modal/CustomScriptTaskModal';
5
- import { ReleaseVariablesPage } from './ReleaseVariablesPage';
6
-
7
- export class ReleasePage extends WithPage {
8
- async openTriggers(): Promise<TriggersPage> {
9
- await this.openSubPage('Triggers');
10
- return new TriggersPage(this.page);
11
- }
12
-
13
- async abort(comment = 'Abort for testing'): Promise<void> {
14
- await this.page.locator('action-toolbar button', { hasText: 'Abort' }).click();
15
- await this.page.locator('.modal textarea').fill(comment);
16
- await this.page.locator('.modal .continue').click();
17
- }
18
-
19
- getPhase(phaseName: string): Phase {
20
- return new Phase(this.page, phaseName);
21
- }
22
-
23
- async start(): Promise<void> {
24
- await this.page.locator('action-toolbar button', { hasText: 'Start' }).click();
25
- await this.page.locator('.modal button.primary').click();
26
- }
27
-
28
- async waitForTaskCompleted(taskTitle: string): Promise<void> {
29
- await expect(this.page.locator('.task.completed').getByText(taskTitle, { exact: true })).toBeVisible();
30
- }
31
- async waitForTaskFailed(taskTitle: string): Promise<void> {
32
- await expect(this.page.locator('.task.failed').getByText(taskTitle, { exact: true })).toBeVisible();
33
- }
34
-
35
- /**
36
- * @deprecated Don't use this, use new TaskDrawer
37
- */
38
- async openCustomScriptTaskModal(taskName: string): Promise<CustomScriptTaskModal> {
39
- await this.page.locator('.task-header').getByText(taskName).click();
40
- return new CustomScriptTaskModal(this.page);
41
- }
42
-
43
- async openVariables(): Promise<ReleaseVariablesPage> {
44
- await this.openReleaseMenu('Variables');
45
- return new ReleaseVariablesPage(this.page);
46
- }
47
-
48
- async openReleaseMenu(menuItem: string): Promise<void> {
49
- await this.page.locator(`navigation-sidebar ul li`).getByText(menuItem, { exact: true }).click();
50
- }
51
-
52
- private async openSubPage(subpage: string): Promise<void> {
53
- await this.page.locator('ul.side-nav li', { hasText: subpage }).click();
54
- }
55
- }
56
-
57
- class Phase extends WithPage {
58
- private readonly phaseLocator: Locator;
59
-
60
- constructor(page: Page, phaseName: string) {
61
- super(page);
62
- this.phaseLocator = page.locator('.phase', { hasText: phaseName });
63
- }
64
-
65
- async addTask(taskName: string, taskGroup: string, taskType: string): Promise<void> {
66
- await this.phaseLocator.getByText('Add task').click();
67
- await this.phaseLocator.locator('.quick-title').fill(taskName);
68
- await this.phaseLocator.locator('.xlr-ctx-menu-toggle').click();
69
- await this.page.locator(`.xlr-ctx-menu-item`).getByTitle(taskGroup, { exact: true }).scrollIntoViewIfNeeded();
70
- await this.page.locator(`.xlr-ctx-menu-item`).getByTitle(taskGroup, { exact: true }).hover();
71
- await this.page.locator(`.xlr-ctx-menu.active`).getByTitle(taskType, { exact: true }).click();
72
- await this.phaseLocator.locator('.quick-controls-container a').getByText('Add', { exact: true }).click();
73
- }
74
- }
@@ -1,19 +0,0 @@
1
- import { expect } from '@playwright/test';
2
- import { WithPage } from './WithPage';
3
-
4
- export class ReleaseVariablesPage extends WithPage {
5
- async openVariable(variableKey: string): Promise<ReleaseVariableModal> {
6
- await this.page.locator(`.variables-list .variable`).getByText(variableKey).click();
7
- return new ReleaseVariableModal(this.page);
8
- }
9
- }
10
-
11
- class ReleaseVariableModal extends WithPage {
12
- async expectValueToBe(value: string): Promise<void> {
13
- await expect(this.page.locator('#modal .variable-value input')).toHaveValue(value);
14
- }
15
-
16
- async close(): Promise<void> {
17
- await this.page.locator('#modal .modal-header button.close').click();
18
- }
19
- }
@@ -1,18 +0,0 @@
1
- import { expect } from '@playwright/test';
2
- import { ReleasePage } from './ReleasePage';
3
- import { WithPage } from './WithPage';
4
-
5
- export class ReleasesListPage extends WithPage {
6
- async expectNumberOfReleases(releaseTitle: string, amount: number): Promise<void> {
7
- if (amount === 1) {
8
- await expect(this.page.locator('.release').getByText(releaseTitle)).toBeVisible();
9
- } else {
10
- await expect(this.page.locator('.release').getByText(releaseTitle).count()).toBe(amount);
11
- }
12
- }
13
-
14
- async openReleaseByName(releaseTitle: string): Promise<ReleasePage> {
15
- await this.page.locator('.release-line .row-wrapper .release-title-wrapper a', { hasText: releaseTitle }).click();
16
- return new ReleasePage(this.page);
17
- }
18
- }