@bigbinary/neeto-playwright-commons 1.13.7 → 1.13.8
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/index.cjs.js +44 -30
- package/index.cjs.js.map +1 -1
- package/index.d.ts +14 -4
- package/index.js +44 -30
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.cjs.js
CHANGED
|
@@ -257,7 +257,7 @@ const COMMON_SELECTORS = {
|
|
|
257
257
|
profileSidebar: "profile-section",
|
|
258
258
|
selectOption: (label) => `${hyphenize(label)}-select-option`,
|
|
259
259
|
radioLabel: (embedLabel) => `${hyphenize(embedLabel)}-radio-label`,
|
|
260
|
-
toastMessage:
|
|
260
|
+
toastMessage: (type) => `toastr-${type}-container`,
|
|
261
261
|
toastCloseButton: "toastr-close-button",
|
|
262
262
|
windowAlert: "#alert-box",
|
|
263
263
|
body: "body",
|
|
@@ -3891,7 +3891,7 @@ class CustomCommands {
|
|
|
3891
3891
|
*/
|
|
3892
3892
|
this.verifySuccessToast = async ({ message = "", closeAfterVerification = true, } = {}) => {
|
|
3893
3893
|
if (!ramda.isEmpty(message)) {
|
|
3894
|
-
await test$1.expect(this.page.getByTestId(COMMON_SELECTORS.toastMessage)).toContainText(message);
|
|
3894
|
+
await test$1.expect(this.page.getByTestId(COMMON_SELECTORS.toastMessage("success"))).toContainText(message);
|
|
3895
3895
|
}
|
|
3896
3896
|
else {
|
|
3897
3897
|
await test$1.expect(this.page.locator(COMMON_SELECTORS.toastIcon)).toContainText("👍");
|
|
@@ -3901,12 +3901,9 @@ class CustomCommands {
|
|
|
3901
3901
|
await test$1.expect(this.page.locator(COMMON_SELECTORS.toastIcon)).toBeHidden();
|
|
3902
3902
|
};
|
|
3903
3903
|
this.verifyToast = async ({ message = "", toastType = "success", closeAfterVerification = true, timeout = 10000, } = {}) => {
|
|
3904
|
-
if (toastType === "error") {
|
|
3905
|
-
await test$1.expect(this.page.getByTestId(COMMON_SELECTORS.errorToastIcon)).toBeVisible({ timeout });
|
|
3906
|
-
}
|
|
3907
3904
|
const toastrCloseButton = this.page.getByTestId(COMMON_SELECTORS.toastCloseButton);
|
|
3908
3905
|
if (!ramda.isEmpty(message)) {
|
|
3909
|
-
await test$1.expect(this.page.getByTestId(COMMON_SELECTORS.toastMessage)).toContainText(message, { timeout });
|
|
3906
|
+
await test$1.expect(this.page.getByTestId(COMMON_SELECTORS.toastMessage(toastType))).toContainText(message, { timeout });
|
|
3910
3907
|
}
|
|
3911
3908
|
else {
|
|
3912
3909
|
await test$1.expect(this.page.locator(COMMON_SELECTORS.toastIcon)).toContainText("👍", { timeout });
|
|
@@ -24139,55 +24136,72 @@ class MemberApis {
|
|
|
24139
24136
|
this.neetoPlaywrightUtilities = neetoPlaywrightUtilities;
|
|
24140
24137
|
this.create = (body) => this.neetoPlaywrightUtilities.apiRequest({
|
|
24141
24138
|
method: "post",
|
|
24142
|
-
url:
|
|
24139
|
+
url: this.teamsBaseUrl,
|
|
24143
24140
|
body: { user: body },
|
|
24144
24141
|
});
|
|
24142
|
+
this.jobStatus = (jobId) => this.neetoPlaywrightUtilities.apiRequest({
|
|
24143
|
+
url: `${this.teamsBaseUrl}/creation_status/${jobId}`,
|
|
24144
|
+
});
|
|
24145
24145
|
this.fetch = (params) => this.neetoPlaywrightUtilities.apiRequest({
|
|
24146
24146
|
method: "get",
|
|
24147
|
-
url:
|
|
24147
|
+
url: this.teamsBaseUrl,
|
|
24148
24148
|
params,
|
|
24149
24149
|
});
|
|
24150
24150
|
this.update = (memberId, body) => this.neetoPlaywrightUtilities.apiRequest({
|
|
24151
24151
|
method: "put",
|
|
24152
|
-
url:
|
|
24152
|
+
url: `${this.teamsBaseUrl}/${memberId}`,
|
|
24153
24153
|
body: { team: body },
|
|
24154
24154
|
});
|
|
24155
24155
|
this.bulkUpdate = (body) => this.neetoPlaywrightUtilities.apiRequest({
|
|
24156
24156
|
method: "patch",
|
|
24157
|
-
url:
|
|
24157
|
+
url: `${this.teamsBaseUrl}/bulk_update`,
|
|
24158
24158
|
body: { users: body },
|
|
24159
24159
|
});
|
|
24160
|
+
this.teamsBaseUrl = "/team_members/teams";
|
|
24160
24161
|
}
|
|
24161
24162
|
}
|
|
24162
24163
|
|
|
24163
24164
|
class Member {
|
|
24164
24165
|
constructor(neetoPlaywrightUtilities) {
|
|
24165
24166
|
this.neetoPlaywrightUtilities = neetoPlaywrightUtilities;
|
|
24166
|
-
this.addMemberViaRequest = ({ email, role = MEMBER_TEXTS.agent, appName, }) =>
|
|
24167
|
-
|
|
24168
|
-
|
|
24169
|
-
|
|
24170
|
-
|
|
24171
|
-
|
|
24172
|
-
|
|
24173
|
-
|
|
24174
|
-
|
|
24175
|
-
|
|
24176
|
-
|
|
24177
|
-
|
|
24167
|
+
this.addMemberViaRequest = async ({ email, role = MEMBER_TEXTS.agent, appName, }) => {
|
|
24168
|
+
let response;
|
|
24169
|
+
await test$1.expect
|
|
24170
|
+
.poll(async () => {
|
|
24171
|
+
response = await this.memberApis.create({
|
|
24172
|
+
emails: [email],
|
|
24173
|
+
organization_role: role,
|
|
24174
|
+
app_roles: [
|
|
24175
|
+
{ app_name: appName, active_role: role, is_enabled: true },
|
|
24176
|
+
],
|
|
24177
|
+
});
|
|
24178
|
+
return response === null || response === void 0 ? void 0 : response.status();
|
|
24179
|
+
}, { timeout: 30000 })
|
|
24180
|
+
.toBe(200);
|
|
24181
|
+
const responseBodyBuffer = await (response === null || response === void 0 ? void 0 : response.body());
|
|
24182
|
+
const { job_id: jobId } = JSON.parse(String(responseBodyBuffer));
|
|
24183
|
+
// eslint-disable-next-line playwright/no-standalone-expect
|
|
24184
|
+
await test$1.expect
|
|
24185
|
+
.poll(async () => {
|
|
24186
|
+
const jobResponse = await this.memberApis.jobStatus(jobId);
|
|
24187
|
+
const responseBodyBuffer = await (jobResponse === null || jobResponse === void 0 ? void 0 : jobResponse.body());
|
|
24188
|
+
const { is_completed: isCompleted } = JSON.parse(String(responseBodyBuffer));
|
|
24189
|
+
return isCompleted;
|
|
24190
|
+
}, { timeout: 30000 })
|
|
24191
|
+
.toBe(true);
|
|
24192
|
+
};
|
|
24178
24193
|
this.editMemberViaRequest = async ({ email, firstName, lastName, newRole, }) => {
|
|
24179
|
-
const
|
|
24180
|
-
|
|
24181
|
-
|
|
24182
|
-
|
|
24183
|
-
|
|
24184
|
-
await this.memberApis.update(memberDetails.id, {
|
|
24194
|
+
const responseBody = (await this.memberApis
|
|
24195
|
+
.fetch({ search: email })
|
|
24196
|
+
.then(response => response === null || response === void 0 ? void 0 : response.json()));
|
|
24197
|
+
const memberDetails = responseBody === null || responseBody === void 0 ? void 0 : responseBody.members.find(({ email }) => email === email.toLowerCase());
|
|
24198
|
+
memberDetails &&
|
|
24199
|
+
(await this.memberApis.update(memberDetails.id, {
|
|
24185
24200
|
active: true,
|
|
24186
24201
|
first_name: firstName,
|
|
24187
24202
|
last_name: lastName,
|
|
24188
24203
|
organization_role: newRole,
|
|
24189
|
-
});
|
|
24190
|
-
}
|
|
24204
|
+
}));
|
|
24191
24205
|
};
|
|
24192
24206
|
this.deactivateMemberViaRequest = (email) => this.memberApis.bulkUpdate({ active: false, emails: [email] });
|
|
24193
24207
|
this.generateRandomTeamMembers = ({ count = 1, role = "standard" }) => neetoCist.dynamicArray(count, () => ({
|