@axinom/mosaic-e2e-page-model 0.17.7-rc.0 → 0.17.7-rc.10
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.
- package/dist/managed-services/index.d.ts +0 -1
- package/dist/managed-services/index.d.ts.map +1 -1
- package/dist/managed-services/index.js +0 -1
- package/dist/managed-services/index.js.map +1 -1
- package/dist/managed-services/managed-service-model.d.ts +2 -2
- package/dist/managed-services/managed-service-model.js +1 -1
- package/dist/page-model.d.ts +2 -4
- package/dist/page-model.d.ts.map +1 -1
- package/dist/page-model.js +1 -3
- package/dist/page-model.js.map +1 -1
- package/dist/ui-selectors/ui-shell-model.d.ts +1 -1
- package/dist/ui-selectors/ui-shell-model.js +1 -1
- package/package.json +3 -3
- package/src/managed-services/index.ts +0 -1
- package/src/managed-services/managed-service-model.ts +1 -1
- package/src/page-model.ts +2 -13
- package/src/ui-selectors/ui-shell-model.ts +1 -1
- package/dist/managed-services/monetization-service/claim-set-control.d.ts +0 -48
- package/dist/managed-services/monetization-service/claim-set-control.d.ts.map +0 -1
- package/dist/managed-services/monetization-service/claim-set-control.js +0 -74
- package/dist/managed-services/monetization-service/claim-set-control.js.map +0 -1
- package/dist/managed-services/monetization-service/index.d.ts +0 -4
- package/dist/managed-services/monetization-service/index.d.ts.map +0 -1
- package/dist/managed-services/monetization-service/index.js +0 -20
- package/dist/managed-services/monetization-service/index.js.map +0 -1
- package/dist/managed-services/monetization-service/monetization-service.d.ts +0 -211
- package/dist/managed-services/monetization-service/monetization-service.d.ts.map +0 -1
- package/dist/managed-services/monetization-service/monetization-service.js +0 -416
- package/dist/managed-services/monetization-service/monetization-service.js.map +0 -1
- package/dist/managed-services/monetization-service/payment-plan-recurrence-period-field.d.ts +0 -32
- package/dist/managed-services/monetization-service/payment-plan-recurrence-period-field.d.ts.map +0 -1
- package/dist/managed-services/monetization-service/payment-plan-recurrence-period-field.js +0 -48
- package/dist/managed-services/monetization-service/payment-plan-recurrence-period-field.js.map +0 -1
- package/dist/managed-services/monetization-service/payment-provider-settings-field.d.ts +0 -35
- package/dist/managed-services/monetization-service/payment-provider-settings-field.d.ts.map +0 -1
- package/dist/managed-services/monetization-service/payment-provider-settings-field.js +0 -65
- package/dist/managed-services/monetization-service/payment-provider-settings-field.js.map +0 -1
- package/src/managed-services/monetization-service/claim-set-control.ts +0 -84
- package/src/managed-services/monetization-service/index.ts +0 -3
- package/src/managed-services/monetization-service/monetization-service.ts +0 -552
- package/src/managed-services/monetization-service/payment-plan-recurrence-period-field.ts +0 -54
- package/src/managed-services/monetization-service/payment-provider-settings-field.ts +0 -75
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Accordion,
|
|
3
|
-
AccordionItem,
|
|
4
|
-
ComponentModel,
|
|
5
|
-
DynamicDataList,
|
|
6
|
-
Modal,
|
|
7
|
-
} from '@axinom/mosaic-e2e-ui-selectors';
|
|
8
|
-
import { FrameLocator, Locator, Page } from 'playwright-core';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* A model for the a claim row in the claims editor station. This model should not be used directly.
|
|
12
|
-
* It is used internally by methods of the `MonetizationService` model.
|
|
13
|
-
*/
|
|
14
|
-
export class ClaimRow extends ComponentModel {
|
|
15
|
-
/** Get a locator to the appropriate input element to select this claim. */
|
|
16
|
-
async getInput(): Promise<Locator> {
|
|
17
|
-
const radioLabel = this.getLocator('//label', -1);
|
|
18
|
-
const checkBox = this.getLocator('//input', -1);
|
|
19
|
-
return (await radioLabel.isVisible()) ? radioLabel : checkBox;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/** This method toggles the claim selection. */
|
|
23
|
-
async toggle(): Promise<void> {
|
|
24
|
-
const input = await this.getInput();
|
|
25
|
-
await input.check();
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* A model for the a claim group in the claims editor station. This model should not be used directly.
|
|
31
|
-
* It is used internally by methods of the `MonetizationService` model.
|
|
32
|
-
*/
|
|
33
|
-
export class ClaimGroup extends AccordionItem {
|
|
34
|
-
/** A model for the dynamic data list used to for claim multiple select. */
|
|
35
|
-
readonly dataList = new DynamicDataList(this);
|
|
36
|
-
|
|
37
|
-
/** A model for the modal opened by the dynamic data list. */
|
|
38
|
-
readonly explorerModal = new Modal(this).asSelectionExplorer();
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* This method will determine whether the claim group uses modal input.
|
|
42
|
-
* If this returns true, then claims should be selected with the `dataList` and `explorerModal` properties.
|
|
43
|
-
* If it returns false then the `getClaimRowByLabel` method should be used.
|
|
44
|
-
*/
|
|
45
|
-
async isDataListEntry(): Promise<boolean> {
|
|
46
|
-
return this.dataList.getLocator().isVisible();
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/** This method gets a claim row by label. */
|
|
50
|
-
getClaimRowByLabel(claimLabel: string): ClaimRow {
|
|
51
|
-
return new ClaimRow(
|
|
52
|
-
this,
|
|
53
|
-
`//*[contains(@data-test-id, "claim:") and .//*[@data-test-id="claim-label" and text()="${claimLabel}"]]`,
|
|
54
|
-
);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* A model for the claims editor station. This model should not be used directly.
|
|
60
|
-
* It is used internally by methods of the `MonetizationService` model.
|
|
61
|
-
*/
|
|
62
|
-
export class ClaimsEditor extends ComponentModel {
|
|
63
|
-
/**
|
|
64
|
-
* A model for an accordion component.
|
|
65
|
-
* @param parent The parent playwright page, frame or component model.
|
|
66
|
-
* @param xpath A relative xpath selector to this element from the parent.
|
|
67
|
-
*/
|
|
68
|
-
constructor(parent: Page | FrameLocator | ComponentModel, xpath = '//form') {
|
|
69
|
-
super(parent, xpath);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
private accordion = new Accordion(this.root, this.xpath);
|
|
73
|
-
|
|
74
|
-
/** This method gets a claim row by claim value. */
|
|
75
|
-
getClaimRow(claim: string): ClaimRow {
|
|
76
|
-
return new ClaimRow(this.accordion, `//*[@data-test-id="claim:${claim}"]`);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
/** This method gets a claim group by label. */
|
|
80
|
-
getClaimGroup(claimGroupLabel: string): ClaimGroup {
|
|
81
|
-
const accordionItem = this.accordion.getItemContainingText(claimGroupLabel);
|
|
82
|
-
return new ClaimGroup(this.root, accordionItem.xpath);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
@@ -1,552 +0,0 @@
|
|
|
1
|
-
import { ActionLabel } from '@axinom/mosaic-e2e-ui-selectors';
|
|
2
|
-
|
|
3
|
-
import { ManagedServiceModel } from '../managed-service-model';
|
|
4
|
-
import { ClaimsEditor } from './claim-set-control';
|
|
5
|
-
|
|
6
|
-
export interface SubscriptionPlanFilters {
|
|
7
|
-
subscriptionPlanTitle: string;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export interface ClaimSetFilters {
|
|
11
|
-
uniqueKey: string;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
/** A model for the managed monetization service. */
|
|
15
|
-
export class MonetizationService extends ManagedServiceModel {
|
|
16
|
-
/**
|
|
17
|
-
* This method navigates to the subscription plans explorer station.
|
|
18
|
-
* The management system must be loaded & signed in before using this method.
|
|
19
|
-
*
|
|
20
|
-
* The following steps will be taken:
|
|
21
|
-
* - Navigate to the home breadcrumb, then tiles: 'Monetization', 'Subscription Plans'
|
|
22
|
-
* - Wait for data to load
|
|
23
|
-
*/
|
|
24
|
-
async navigateToSubscriptionPlans(): Promise<void> {
|
|
25
|
-
const { uiShell, uiManagedWorkflows } = this;
|
|
26
|
-
await uiShell.goToNavigationPanelItemByTestIds(
|
|
27
|
-
'monetization-subscriptionplans',
|
|
28
|
-
'monetization',
|
|
29
|
-
);
|
|
30
|
-
|
|
31
|
-
await uiManagedWorkflows.list.waitForData();
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* This method navigates to the claim sets explorer station.
|
|
36
|
-
* The management system must be loaded & signed in before using this method.
|
|
37
|
-
*
|
|
38
|
-
* The following steps will be taken:
|
|
39
|
-
* - Navigate to the home breadcrumb, then tiles: 'Monetization', 'Claim Sets'
|
|
40
|
-
* - Wait for data to load
|
|
41
|
-
*/
|
|
42
|
-
async navigateToClaimSets(): Promise<void> {
|
|
43
|
-
const { uiShell, uiManagedWorkflows } = this;
|
|
44
|
-
await uiShell.goToNavigationPanelItemByTestIds(
|
|
45
|
-
'monetization-claimsets',
|
|
46
|
-
'monetization',
|
|
47
|
-
);
|
|
48
|
-
|
|
49
|
-
await uiManagedWorkflows.list.waitForData();
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* This method navigates to a subscription plan details station by title.
|
|
54
|
-
* The management system must be loaded & signed in before using this method.
|
|
55
|
-
* If there is not exactly one matching subscription plan an exception will be raised.
|
|
56
|
-
*
|
|
57
|
-
* The following steps will be taken:
|
|
58
|
-
* - Navigate to the home breadcrumb, then tiles: 'Monetization', 'Subscription Plans'
|
|
59
|
-
* - Filter by title and click the subscription plan row action
|
|
60
|
-
* - Wait for the subscription plan details page to load
|
|
61
|
-
*/
|
|
62
|
-
async navigateToSubscriptionPlanDetails(filterBy: {
|
|
63
|
-
/** A unique subscription plan title. */
|
|
64
|
-
title: string;
|
|
65
|
-
}): Promise<void> {
|
|
66
|
-
const { uiShell, uiManagedWorkflows } = this;
|
|
67
|
-
await this.navigateToSubscriptionPlans();
|
|
68
|
-
|
|
69
|
-
// filter to the item
|
|
70
|
-
await uiManagedWorkflows.filters
|
|
71
|
-
.getFilterByName('title')
|
|
72
|
-
.asFreeTextFilter()
|
|
73
|
-
.setValue(filterBy.title);
|
|
74
|
-
await uiManagedWorkflows.list.waitForData();
|
|
75
|
-
|
|
76
|
-
// Verify that there is exactly one matching row
|
|
77
|
-
if ((await uiManagedWorkflows.list.allVisibleRows.count()) !== 1) {
|
|
78
|
-
throw new Error(
|
|
79
|
-
`Failed to find exactly one subscription plan with title '${filterBy.title}'.`,
|
|
80
|
-
);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
// navigate
|
|
84
|
-
await uiShell.waitForPageTransition(
|
|
85
|
-
uiManagedWorkflows.list.getRow(1).actionButton.click(),
|
|
86
|
-
);
|
|
87
|
-
await uiManagedWorkflows.form.waitForData();
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* This method navigates to a claim set details station by unique key.
|
|
92
|
-
* The management system must be loaded & signed in before using this method.
|
|
93
|
-
* If there is not exactly one matching claim set an exception will be raised.
|
|
94
|
-
*
|
|
95
|
-
* The following steps will be taken:
|
|
96
|
-
* - Navigate to the home breadcrumb, then tiles: 'Monetization', 'Claim Sets'
|
|
97
|
-
* - Filter by unique key and click the claim set row action
|
|
98
|
-
* - Wait for the claim set details station to load
|
|
99
|
-
*/
|
|
100
|
-
async navigateToClaimSetDetails(args: {
|
|
101
|
-
/** The claim set unique key. */
|
|
102
|
-
uniqueKey: string;
|
|
103
|
-
}): Promise<void> {
|
|
104
|
-
const { uiShell, uiManagedWorkflows } = this;
|
|
105
|
-
|
|
106
|
-
if (this.page.url().endsWith(`/monetization/claimsets/${args.uniqueKey}`)) {
|
|
107
|
-
// already on the correct page. do nothing
|
|
108
|
-
return;
|
|
109
|
-
}
|
|
110
|
-
await this.navigateToClaimSets();
|
|
111
|
-
|
|
112
|
-
// filter to the item
|
|
113
|
-
await uiManagedWorkflows.filters
|
|
114
|
-
.getFilterByName('key')
|
|
115
|
-
.asFreeTextFilter()
|
|
116
|
-
.setValue(args.uniqueKey);
|
|
117
|
-
await uiManagedWorkflows.list.waitForData();
|
|
118
|
-
|
|
119
|
-
// Verify that there is exactly one matching row
|
|
120
|
-
if ((await uiManagedWorkflows.list.allVisibleRows.count()) !== 1) {
|
|
121
|
-
throw new Error(
|
|
122
|
-
`Failed to find exactly one claim set with unique key '${args.uniqueKey}'.`,
|
|
123
|
-
);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
// navigate
|
|
127
|
-
await uiShell.waitForPageTransition(
|
|
128
|
-
uiManagedWorkflows.list.getRow(1).actionButton.click(),
|
|
129
|
-
);
|
|
130
|
-
await uiManagedWorkflows.form.waitForData();
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
* This method assigns a claim set to the subscription plan.
|
|
135
|
-
* The management system must be loaded & signed in before using this method.
|
|
136
|
-
* If the claim set does not exist, or is already added to this subscription plan then an exception will be raised.
|
|
137
|
-
*
|
|
138
|
-
* The following steps will be taken:
|
|
139
|
-
* - Navigate to the home breadcrumb, then tiles: 'Monetization', 'Subscription Plans'
|
|
140
|
-
* - Filter by title and click the subscription plan row action
|
|
141
|
-
* - Click the 'Claim Sets' action
|
|
142
|
-
* - Open the claim sets explorer modal, filter by key and select the first result
|
|
143
|
-
* - Click the 'previous' breadcrumb and wait for the subscription plan details station to load
|
|
144
|
-
*/
|
|
145
|
-
async assignClaimSetToSubscriptionPlan(args: {
|
|
146
|
-
/** A unique subscription plan title. */
|
|
147
|
-
subscriptionPlanTitle: string;
|
|
148
|
-
/** The claim set unique key. */
|
|
149
|
-
claimSetUniqueKey: string;
|
|
150
|
-
}): Promise<void> {
|
|
151
|
-
const { uiShell, uiManagedWorkflows } = this;
|
|
152
|
-
await this.navigateToSubscriptionPlanDetails({
|
|
153
|
-
title: args.subscriptionPlanTitle,
|
|
154
|
-
});
|
|
155
|
-
|
|
156
|
-
await uiShell.waitForPageTransition(
|
|
157
|
-
uiManagedWorkflows.actions.getActionByLabel('Manage Claim Sets').click(),
|
|
158
|
-
);
|
|
159
|
-
await uiManagedWorkflows.form.waitForData();
|
|
160
|
-
|
|
161
|
-
// open modal
|
|
162
|
-
await uiManagedWorkflows.form
|
|
163
|
-
.getFieldByLabel('Claim Sets')
|
|
164
|
-
.asDynamicDataListField()
|
|
165
|
-
.dataList.dataEntryRow.addButton.click();
|
|
166
|
-
const modal = uiManagedWorkflows.form.modal.asSelectionExplorer();
|
|
167
|
-
await modal.waitToOpen();
|
|
168
|
-
await modal.list.waitForData();
|
|
169
|
-
|
|
170
|
-
// filter to the claim set
|
|
171
|
-
await modal.filters
|
|
172
|
-
.getFilterByName('key')
|
|
173
|
-
.asFreeTextFilter()
|
|
174
|
-
.setValue(args.claimSetUniqueKey);
|
|
175
|
-
await modal.list.waitForData();
|
|
176
|
-
if ((await modal.list.allVisibleRows.count()) !== 1) {
|
|
177
|
-
throw new Error('The claim set was not found or is already assigned.');
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
// assign the claim set
|
|
181
|
-
await modal.list.getRow(1).selectButton.click();
|
|
182
|
-
await modal.waitToClose();
|
|
183
|
-
|
|
184
|
-
// Back to subscription plan details
|
|
185
|
-
await uiShell.navigateToBreadcrumbPrevious();
|
|
186
|
-
await uiManagedWorkflows.form.waitForData();
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
/**
|
|
190
|
-
* This method removes a claim set assignment from a subscription plan.
|
|
191
|
-
* The management system must be loaded & signed in before using this method.
|
|
192
|
-
* If the claim set is not assigned to this subscription plan then an exception will be raised.
|
|
193
|
-
*
|
|
194
|
-
* The following steps will be taken:
|
|
195
|
-
* - Navigate to the home breadcrumb, then tiles: 'Monetization', 'Subscription Plans'
|
|
196
|
-
* - Filter by title and click the subscription plan row action
|
|
197
|
-
* - Click the 'Claim Sets' action
|
|
198
|
-
* - Unassign the claim set using the inline menu
|
|
199
|
-
* - Click the 'previous' breadcrumb and wait for the subscription plan details station to load
|
|
200
|
-
*/
|
|
201
|
-
async removeClaimSetFromSubscriptionPlan(args: {
|
|
202
|
-
/** A unique subscription plan title. */
|
|
203
|
-
subscriptionPlanTitle: string;
|
|
204
|
-
/** The claim set unique key. */
|
|
205
|
-
claimSetUniqueKey: string;
|
|
206
|
-
}): Promise<void> {
|
|
207
|
-
const { uiShell, uiManagedWorkflows } = this;
|
|
208
|
-
await this.navigateToSubscriptionPlanDetails({
|
|
209
|
-
title: args.subscriptionPlanTitle,
|
|
210
|
-
});
|
|
211
|
-
|
|
212
|
-
await uiShell.waitForPageTransition(
|
|
213
|
-
uiManagedWorkflows.actions.getActionByLabel('Manage Claim Sets').click(),
|
|
214
|
-
);
|
|
215
|
-
await uiManagedWorkflows.form.waitForData();
|
|
216
|
-
|
|
217
|
-
// Find and remove the claim set
|
|
218
|
-
const dataList = uiManagedWorkflows.form
|
|
219
|
-
.getFieldByLabel('Claim Sets')
|
|
220
|
-
.asDynamicDataListField().dataList;
|
|
221
|
-
const row = dataList.getRowByPropertyValue('key', args.claimSetUniqueKey);
|
|
222
|
-
try {
|
|
223
|
-
await row.getLocator().waitFor({ state: 'visible' });
|
|
224
|
-
} catch {
|
|
225
|
-
throw new Error('The claim set was not found on the subscription plan.');
|
|
226
|
-
}
|
|
227
|
-
await row.inlineMenu.openButton.click();
|
|
228
|
-
await row.inlineMenu.getActionByLabel('Unassign').click();
|
|
229
|
-
await dataList.waitForData();
|
|
230
|
-
|
|
231
|
-
// Back to subscription plan details
|
|
232
|
-
await uiShell.navigateToBreadcrumbPrevious();
|
|
233
|
-
await uiManagedWorkflows.form.waitForData();
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
/**
|
|
237
|
-
* This method sets subscription plan status and publishes the subscription plan.
|
|
238
|
-
* The management system must be loaded & signed in before using this method.
|
|
239
|
-
* If the subscription plan cannot be published then an exception will be raised.
|
|
240
|
-
*
|
|
241
|
-
* The following steps will be taken:
|
|
242
|
-
* - Navigate to the home breadcrumb, then tiles: 'Monetization', 'Subscription Plans'
|
|
243
|
-
* - Filter by title and click the subscription plan row action
|
|
244
|
-
* - Set the Status field
|
|
245
|
-
* - Click 'Publishing'
|
|
246
|
-
* - Click 'Publish' and confirm
|
|
247
|
-
* - Wait for the subscription plan details station to load and verify that the publication state is 'PUBLISHED'
|
|
248
|
-
*/
|
|
249
|
-
async publishSubscriptionPlan(args: {
|
|
250
|
-
/** A unique subscription plan title. */
|
|
251
|
-
title: string;
|
|
252
|
-
/** The subscription plan status to be set. If omitted no change will be made. */
|
|
253
|
-
status?: 'Active' | 'Inactive';
|
|
254
|
-
}): Promise<void> {
|
|
255
|
-
const { uiShell, uiManagedWorkflows } = this;
|
|
256
|
-
await this.navigateToSubscriptionPlanDetails(args);
|
|
257
|
-
|
|
258
|
-
if (args.status !== undefined) {
|
|
259
|
-
await uiManagedWorkflows.form
|
|
260
|
-
.getFieldByName('isActive')
|
|
261
|
-
.asRadioField()
|
|
262
|
-
.setValue(args.status === 'Active' ? 'true' : 'false');
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
await uiShell.waitForPageTransition(
|
|
266
|
-
uiManagedWorkflows.actions.getActionByLabel('Publishing').click(),
|
|
267
|
-
);
|
|
268
|
-
await uiManagedWorkflows.form.waitForData();
|
|
269
|
-
|
|
270
|
-
const publishButton =
|
|
271
|
-
uiManagedWorkflows.actions.getActionByLabel('Publish');
|
|
272
|
-
try {
|
|
273
|
-
await publishButton.waitFor({ state: 'visible' });
|
|
274
|
-
} catch {
|
|
275
|
-
throw new Error(
|
|
276
|
-
'Subscription plan could not be published. Are there validation errors?',
|
|
277
|
-
);
|
|
278
|
-
}
|
|
279
|
-
await publishButton.click();
|
|
280
|
-
await uiShell.waitForPageTransition(
|
|
281
|
-
uiManagedWorkflows.actions.confirmButton.click(),
|
|
282
|
-
);
|
|
283
|
-
await uiManagedWorkflows.form.waitForData();
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
/**
|
|
287
|
-
* This method creates a new claim set.
|
|
288
|
-
* The management system must be loaded & signed in before using this method.
|
|
289
|
-
* When this method completes, the new claim set details station will be loaded.
|
|
290
|
-
*
|
|
291
|
-
* The following steps will be taken:
|
|
292
|
-
* - Navigate to the home breadcrumb, then tiles: 'Monetization', 'Claim Sets'
|
|
293
|
-
* - Click 'New', enter the title and key then click 'Proceed'
|
|
294
|
-
* - Wait for the claim set details station to load
|
|
295
|
-
*/
|
|
296
|
-
async createClaimSet(properties: {
|
|
297
|
-
/** A unique subscription plan title. */
|
|
298
|
-
title: string;
|
|
299
|
-
/** The claim set unique key. */
|
|
300
|
-
uniqueKey: string;
|
|
301
|
-
}): Promise<void> {
|
|
302
|
-
const { uiShell, uiManagedWorkflows } = this;
|
|
303
|
-
await this.navigateToClaimSets();
|
|
304
|
-
|
|
305
|
-
await uiShell.waitForPageTransition(
|
|
306
|
-
uiManagedWorkflows.pageHeader.actions.getActionByLabel('New').click(),
|
|
307
|
-
);
|
|
308
|
-
await uiManagedWorkflows.form.waitForData();
|
|
309
|
-
|
|
310
|
-
await uiManagedWorkflows.form
|
|
311
|
-
.getFieldByName('title')
|
|
312
|
-
.asSingleLineTextField()
|
|
313
|
-
.setValue(properties.title);
|
|
314
|
-
await uiManagedWorkflows.form
|
|
315
|
-
.getFieldByName('key')
|
|
316
|
-
.asSingleLineTextField()
|
|
317
|
-
.setValue(properties.uniqueKey);
|
|
318
|
-
await uiShell.waitForPageTransition(
|
|
319
|
-
uiManagedWorkflows.actions.getActionByLabel(ActionLabel.Proceed).click(),
|
|
320
|
-
);
|
|
321
|
-
await uiManagedWorkflows.form.waitForData();
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
/**
|
|
325
|
-
* This method assigns claims to a claim set.
|
|
326
|
-
* The management system must be loaded & signed in before using this method.
|
|
327
|
-
* NOTE: This method does not support adding claims by mod*a*l.
|
|
328
|
-
*
|
|
329
|
-
* The following steps will be taken:
|
|
330
|
-
* - Navigate to the home breadcrumb, then tiles: 'Monetization', 'Claim Sets'
|
|
331
|
-
* - Filter by unique key and click the claim set row action
|
|
332
|
-
* - Click 'Claims'
|
|
333
|
-
* - Add each claim by checkbox or radio button
|
|
334
|
-
* - Click the 'previous' breadcrumb and wait for the claim set details station to load
|
|
335
|
-
*/
|
|
336
|
-
async assignClaimsToClaimSet(args: {
|
|
337
|
-
/** The claim set unique key. */
|
|
338
|
-
uniqueKey: string;
|
|
339
|
-
/** The list of claim values to be assigned. Each claim input will be clicked. */
|
|
340
|
-
claims: string[];
|
|
341
|
-
}): Promise<void> {
|
|
342
|
-
const { uiShell, uiManagedWorkflows } = this;
|
|
343
|
-
await this.navigateToClaimSetDetails(args);
|
|
344
|
-
|
|
345
|
-
// Open claims editor
|
|
346
|
-
await uiShell.waitForPageTransition(
|
|
347
|
-
uiManagedWorkflows.actions.getActionByLabel('Claims').click(),
|
|
348
|
-
);
|
|
349
|
-
|
|
350
|
-
// Select each claim
|
|
351
|
-
const claimsEditor = new ClaimsEditor(this.page);
|
|
352
|
-
for (const claim of args.claims) {
|
|
353
|
-
const row = claimsEditor.getClaimRow(claim);
|
|
354
|
-
try {
|
|
355
|
-
await row.getLocator().waitFor({ state: 'visible' });
|
|
356
|
-
} catch (e) {
|
|
357
|
-
throw new Error(
|
|
358
|
-
`A radio or checkbox for for claim '${claim}' is not visible. NOTE: selecting claims by mod*a*l is not supported by this method.` +
|
|
359
|
-
(e instanceof Error ? `\n${e.message}` : ''),
|
|
360
|
-
);
|
|
361
|
-
}
|
|
362
|
-
await row.toggle();
|
|
363
|
-
}
|
|
364
|
-
// Back to claim set details
|
|
365
|
-
await uiShell.navigateToBreadcrumbPrevious();
|
|
366
|
-
await uiManagedWorkflows.form.waitForData();
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
/**
|
|
370
|
-
* This method assigns claims to a claim set.
|
|
371
|
-
* The management system must be loaded & signed in before using this method.
|
|
372
|
-
* NOTE: This method *does* support adding claims by mod*a*l.
|
|
373
|
-
*
|
|
374
|
-
* The following steps will be taken:
|
|
375
|
-
* - Navigate to the home breadcrumb, then tiles: 'Monetization', 'Claim Sets'
|
|
376
|
-
* - Filter by unique key and click the claim set row action
|
|
377
|
-
* - Click 'Claims'
|
|
378
|
-
* - Add each claim by checkbox or radio button
|
|
379
|
-
* - Click the 'previous' breadcrumb and wait for the claim set details station to load
|
|
380
|
-
*/
|
|
381
|
-
async assignClaimsToClaimSetByLabel(args: {
|
|
382
|
-
/** The claim set unique key. */
|
|
383
|
-
uniqueKey: string;
|
|
384
|
-
/** The label of the claim group. */
|
|
385
|
-
claimGroupLabel: string;
|
|
386
|
-
/** The claim labels in the claim group. Each will be clicked or added by modal as required. */
|
|
387
|
-
claimLabels: string[];
|
|
388
|
-
}): Promise<void> {
|
|
389
|
-
const { uiShell, uiManagedWorkflows } = this;
|
|
390
|
-
await this.navigateToClaimSetDetails(args);
|
|
391
|
-
|
|
392
|
-
// Open claims editor
|
|
393
|
-
await uiShell.waitForPageTransition(
|
|
394
|
-
uiManagedWorkflows.actions.getActionByLabel('Claims').click(),
|
|
395
|
-
);
|
|
396
|
-
|
|
397
|
-
// Select each claim
|
|
398
|
-
const claimsEditor = new ClaimsEditor(this.page);
|
|
399
|
-
const group = claimsEditor.getClaimGroup(args.claimGroupLabel);
|
|
400
|
-
try {
|
|
401
|
-
await group.row.waitFor({ state: 'visible' });
|
|
402
|
-
} catch (e) {
|
|
403
|
-
throw new Error(
|
|
404
|
-
`A claim group with label ${args.claimGroupLabel} is not visible.` +
|
|
405
|
-
(e instanceof Error ? `\n${e.message}` : ''),
|
|
406
|
-
);
|
|
407
|
-
}
|
|
408
|
-
await group.expand();
|
|
409
|
-
if (await group.isDataListEntry()) {
|
|
410
|
-
// Select each claim with selection explorer
|
|
411
|
-
const modal = group.explorerModal;
|
|
412
|
-
for (const claimLabel of args.claimLabels) {
|
|
413
|
-
await group.dataList.dataEntryRow.addButton.click();
|
|
414
|
-
await modal.waitToOpen();
|
|
415
|
-
await modal.list.waitForData();
|
|
416
|
-
|
|
417
|
-
// filter to the claim
|
|
418
|
-
await modal.filters
|
|
419
|
-
.getFilterByName('title')
|
|
420
|
-
.asFreeTextFilter()
|
|
421
|
-
.setValue(claimLabel);
|
|
422
|
-
await modal.list.waitForData();
|
|
423
|
-
|
|
424
|
-
if ((await modal.list.allVisibleRows.count()) !== 1) {
|
|
425
|
-
throw new Error(
|
|
426
|
-
`A entry for claim with label '${claimLabel}' is not visible in the modal for group '${args.claimGroupLabel}'.`,
|
|
427
|
-
);
|
|
428
|
-
}
|
|
429
|
-
|
|
430
|
-
// assign the claim
|
|
431
|
-
await modal.list.getRow(1).selectButton.click();
|
|
432
|
-
await modal.waitToClose();
|
|
433
|
-
}
|
|
434
|
-
} else {
|
|
435
|
-
// Select each claim
|
|
436
|
-
for (const claimLabel of args.claimLabels) {
|
|
437
|
-
const row = group.getClaimRowByLabel(claimLabel);
|
|
438
|
-
try {
|
|
439
|
-
await row.getLocator().waitFor({ state: 'visible' });
|
|
440
|
-
} catch (e) {
|
|
441
|
-
throw new Error(
|
|
442
|
-
`A radio or checkbox for claim with label '${claimLabel}' is not visible in group '${args.claimGroupLabel}'.` +
|
|
443
|
-
(e instanceof Error ? `\n${e.message}` : ''),
|
|
444
|
-
);
|
|
445
|
-
}
|
|
446
|
-
await row.toggle();
|
|
447
|
-
}
|
|
448
|
-
}
|
|
449
|
-
// Back to claim set details
|
|
450
|
-
await uiShell.navigateToBreadcrumbPrevious();
|
|
451
|
-
await uiManagedWorkflows.form.waitForData();
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
/**
|
|
455
|
-
* This method publishes a claim set.
|
|
456
|
-
* The management system must be loaded & signed in before using this method.
|
|
457
|
-
* If the claim set cannot be published then an exception will be raised.
|
|
458
|
-
*
|
|
459
|
-
* The following steps will be taken:
|
|
460
|
-
* - Navigate to the home breadcrumb, then tiles: 'Monetization', 'Claim Sets'
|
|
461
|
-
* - Filter by unique key and click the claim set row action
|
|
462
|
-
* - Click 'Publishing'
|
|
463
|
-
* - Click 'Publish' and confirm
|
|
464
|
-
* - Wait for the claim set details station to load
|
|
465
|
-
*/
|
|
466
|
-
async publishClaimSet(args: {
|
|
467
|
-
/** The claim set unique key. */
|
|
468
|
-
uniqueKey: string;
|
|
469
|
-
}): Promise<void> {
|
|
470
|
-
const { uiShell, uiManagedWorkflows } = this;
|
|
471
|
-
await this.navigateToClaimSetDetails(args);
|
|
472
|
-
|
|
473
|
-
await uiShell.waitForPageTransition(
|
|
474
|
-
uiManagedWorkflows.actions.getActionByLabel('Publishing').click(),
|
|
475
|
-
);
|
|
476
|
-
await uiManagedWorkflows.form.waitForData();
|
|
477
|
-
|
|
478
|
-
const action = uiManagedWorkflows.actions.getActionByLabel('Publish');
|
|
479
|
-
try {
|
|
480
|
-
await action.waitFor({ state: 'visible' });
|
|
481
|
-
} catch {
|
|
482
|
-
throw new Error(
|
|
483
|
-
'Claim set could not be published. Are there validation errors?',
|
|
484
|
-
);
|
|
485
|
-
}
|
|
486
|
-
await action.click();
|
|
487
|
-
await uiShell.waitForPageTransition(
|
|
488
|
-
uiManagedWorkflows.actions.confirmButton.click(),
|
|
489
|
-
);
|
|
490
|
-
await uiManagedWorkflows.form.waitForData();
|
|
491
|
-
}
|
|
492
|
-
|
|
493
|
-
/**
|
|
494
|
-
* This method unpublishes a claim set by unique key.
|
|
495
|
-
* The management system must be loaded & signed in before using this method.
|
|
496
|
-
* If the claim set cannot be unpublished then an exception will be raised.
|
|
497
|
-
*
|
|
498
|
-
* The following steps will be taken:
|
|
499
|
-
* - Navigate to the home breadcrumb, then tiles: 'Monetization', 'Claim Sets'
|
|
500
|
-
* - Filter by unique key and click the claim set row action
|
|
501
|
-
* - Click 'Unpublish' and confirm
|
|
502
|
-
* - Wait for the claim sets details station to load
|
|
503
|
-
*/
|
|
504
|
-
async unpublishClaimSet(args: { uniqueKey: string }): Promise<void> {
|
|
505
|
-
const { uiShell, uiManagedWorkflows } = this;
|
|
506
|
-
await this.navigateToClaimSetDetails(args);
|
|
507
|
-
|
|
508
|
-
const action = uiManagedWorkflows.actions.getActionByLabel('Unpublish');
|
|
509
|
-
try {
|
|
510
|
-
await action.waitFor({ state: 'visible' });
|
|
511
|
-
} catch {
|
|
512
|
-
throw new Error('The "Unpublish" action is not visible.');
|
|
513
|
-
}
|
|
514
|
-
await action.click();
|
|
515
|
-
await uiShell.waitForPageTransition(
|
|
516
|
-
uiManagedWorkflows.actions.confirmButton.click(),
|
|
517
|
-
);
|
|
518
|
-
await uiManagedWorkflows.form.waitForData();
|
|
519
|
-
}
|
|
520
|
-
|
|
521
|
-
/**
|
|
522
|
-
* This method deletes a claim set by unique key.
|
|
523
|
-
* The management system must be loaded & signed in before using this method.
|
|
524
|
-
* If the claim set cannot be deleted then an exception will be raised.
|
|
525
|
-
*
|
|
526
|
-
* The following steps will be taken:
|
|
527
|
-
* - Navigate to the home breadcrumb, then tiles: 'Monetization', 'Claim Sets'
|
|
528
|
-
* - Filter by unique key and click the claim set row action
|
|
529
|
-
* - Click 'Delete' and confirm
|
|
530
|
-
* - Wait for the claim sets explorer to load
|
|
531
|
-
*/
|
|
532
|
-
async deleteClaimSet(args: {
|
|
533
|
-
/** The claim set unique key. */
|
|
534
|
-
uniqueKey: string;
|
|
535
|
-
}): Promise<void> {
|
|
536
|
-
const { uiShell, uiManagedWorkflows } = this;
|
|
537
|
-
await this.navigateToClaimSetDetails(args);
|
|
538
|
-
|
|
539
|
-
// Delete the claim set
|
|
540
|
-
const action = uiManagedWorkflows.actions.getActionByLabel('Delete');
|
|
541
|
-
try {
|
|
542
|
-
await action.waitFor({ state: 'visible' });
|
|
543
|
-
} catch {
|
|
544
|
-
throw new Error('The "Delete" action is not visible.');
|
|
545
|
-
}
|
|
546
|
-
await action.click();
|
|
547
|
-
await uiShell.waitForPageTransition(
|
|
548
|
-
uiManagedWorkflows.actions.confirmButton.click(),
|
|
549
|
-
);
|
|
550
|
-
await uiManagedWorkflows.list.waitForData();
|
|
551
|
-
}
|
|
552
|
-
}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { GenericField } from '@axinom/mosaic-e2e-ui-selectors';
|
|
2
|
-
import { Locator } from 'playwright-core';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* A model for a "Recurrence Period" form field which can be used to configure
|
|
6
|
-
* the "Recurrence Period" field on payment plans. This is a custom FormField component.
|
|
7
|
-
*
|
|
8
|
-
* It is advised not to use this model directly but to use fixed pre-configured
|
|
9
|
-
* subscription plans for end-to-end testing of payment provider integrations.
|
|
10
|
-
*
|
|
11
|
-
* Example usage:
|
|
12
|
-
* ```
|
|
13
|
-
* await uiManagedWorkflows.form
|
|
14
|
-
* .getFieldByLabel('Recurrence Period')
|
|
15
|
-
* .as(PaymentPlanRecurrencePeriodField)
|
|
16
|
-
* .setValues(1, 'WEEK');
|
|
17
|
-
* ```
|
|
18
|
-
*/
|
|
19
|
-
export class PaymentPlanRecurrencePeriodField extends GenericField {
|
|
20
|
-
/** @inheritdoc */
|
|
21
|
-
protected override get fieldTypeValidator(): string {
|
|
22
|
-
return '[@data-test-type="PaymentProviderRecurrencePeriod"]';
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
readonly quantityInput = this.content.locator(
|
|
26
|
-
'//input[@name="periodQuantity"]',
|
|
27
|
-
);
|
|
28
|
-
|
|
29
|
-
readonly unitInput = this.getLocator('//*[@id="periodUnit"]');
|
|
30
|
-
|
|
31
|
-
readonly option = (value: string): Locator =>
|
|
32
|
-
this.getGlobalLocator(
|
|
33
|
-
`//li[@role="option" and normalize-space(text())="${value}"]`,
|
|
34
|
-
);
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Sets values for both inputs of the recurrence period field.
|
|
38
|
-
*
|
|
39
|
-
* @param quantity Value for the number entry input
|
|
40
|
-
* @param unit The dropdown label to select
|
|
41
|
-
*/
|
|
42
|
-
async setValues(
|
|
43
|
-
quantity: number,
|
|
44
|
-
unit: 'day(s)' | 'week(s)' | 'month(s)' | 'year(s)',
|
|
45
|
-
): Promise<void> {
|
|
46
|
-
await this.verifyFieldType();
|
|
47
|
-
await this.quantityInput.fill(quantity.toString());
|
|
48
|
-
await this.unitInput.click();
|
|
49
|
-
await this.unitInput.fill(unit);
|
|
50
|
-
const optionElement = this.option(unit);
|
|
51
|
-
await optionElement.waitFor({ state: 'visible' });
|
|
52
|
-
await optionElement.click();
|
|
53
|
-
}
|
|
54
|
-
}
|