@bigbinary/neeto-playwright-commons 1.24.2 → 1.24.3
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 +35 -14
- package/index.cjs.js.map +1 -1
- package/index.d.ts +25 -2
- package/index.js +35 -15
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.cjs.js
CHANGED
|
@@ -261,6 +261,15 @@ class TagsApi {
|
|
|
261
261
|
}
|
|
262
262
|
}
|
|
263
263
|
|
|
264
|
+
class WebhookSiteApi {
|
|
265
|
+
constructor(request) {
|
|
266
|
+
this.request = request;
|
|
267
|
+
this.WEBHOOK_SITE_BASE_URL = "https://webhook.site/token";
|
|
268
|
+
this.create = () => this.request.post(this.WEBHOOK_SITE_BASE_URL);
|
|
269
|
+
this.fetch = (token) => this.request.get(`${this.WEBHOOK_SITE_BASE_URL}/${token}/request/latest`);
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
|
|
264
273
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
265
274
|
|
|
266
275
|
function getDefaultExportFromCjs (x) {
|
|
@@ -116543,6 +116552,21 @@ class SlackPage extends IntegrationBase {
|
|
|
116543
116552
|
|
|
116544
116553
|
class WebhooksPage {
|
|
116545
116554
|
constructor({ page, request, neetoPlaywrightUtilities, context, }) {
|
|
116555
|
+
this.getTokenViaAPI = async () => {
|
|
116556
|
+
let webhookToken = null;
|
|
116557
|
+
await test.expect(async () => {
|
|
116558
|
+
var _a;
|
|
116559
|
+
const response = await this.webhookSiteApi.create();
|
|
116560
|
+
await test.expect(response).toBeOK();
|
|
116561
|
+
webhookToken = (_a = (await response.json())) === null || _a === void 0 ? void 0 : _a.uuid;
|
|
116562
|
+
}).toPass({ timeout: 15000 });
|
|
116563
|
+
if (!webhookToken)
|
|
116564
|
+
throw new Error("Failed to get webhook token");
|
|
116565
|
+
return {
|
|
116566
|
+
webhookToken,
|
|
116567
|
+
webhookSiteURL: `${THIRD_PARTY_ROUTES.webhooks.site}${webhookToken}`,
|
|
116568
|
+
};
|
|
116569
|
+
};
|
|
116546
116570
|
this.getWebhookURL = async () => {
|
|
116547
116571
|
var _a;
|
|
116548
116572
|
const WEBHOOK_URL_REGEX = /[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/g;
|
|
@@ -116570,20 +116594,15 @@ class WebhooksPage {
|
|
|
116570
116594
|
]);
|
|
116571
116595
|
await test.expect(this.page.getByRole("row", { name: webhookSiteURL })).toBeVisible();
|
|
116572
116596
|
};
|
|
116573
|
-
this.verifyLatestWebhookResponse =
|
|
116574
|
-
|
|
116575
|
-
await test.expect(
|
|
116576
|
-
|
|
116577
|
-
|
|
116578
|
-
|
|
116579
|
-
|
|
116580
|
-
|
|
116581
|
-
|
|
116582
|
-
: JSON.parse(content).webhook;
|
|
116583
|
-
callback({ parsedResponse, ...otherParams });
|
|
116584
|
-
}
|
|
116585
|
-
}).toPass({ timeout });
|
|
116586
|
-
};
|
|
116597
|
+
this.verifyLatestWebhookResponse = ({ callback = () => { }, webhookToken, parseFullResponseContent = false, timeout = 20000, ...otherParams }) => test.expect(async () => {
|
|
116598
|
+
const response = await this.webhookSiteApi.fetch(webhookToken);
|
|
116599
|
+
await test.expect(response).toBeOK();
|
|
116600
|
+
const { content } = await response.json();
|
|
116601
|
+
const parsedResponse = parseFullResponseContent
|
|
116602
|
+
? JSON.parse(content)
|
|
116603
|
+
: JSON.parse(content).webhook;
|
|
116604
|
+
callback({ parsedResponse, ...otherParams });
|
|
116605
|
+
}).toPass({ timeout });
|
|
116587
116606
|
this.verifyWebhookDeliveries = async ({ callback = () => { }, ...otherParams }) => {
|
|
116588
116607
|
await test.expect(this.page.getByTestId(WEBHOOK_SELECTORS.deliveryResponseCode)).toHaveText("200");
|
|
116589
116608
|
const requestPayload = (await this.page
|
|
@@ -116604,6 +116623,7 @@ class WebhooksPage {
|
|
|
116604
116623
|
this.neetoPlaywrightUtilities = neetoPlaywrightUtilities;
|
|
116605
116624
|
this.context = context;
|
|
116606
116625
|
this.t = playwrightI18nextFixture.getI18nInstance().t;
|
|
116626
|
+
this.webhookSiteApi = new WebhookSiteApi(this.request);
|
|
116607
116627
|
}
|
|
116608
116628
|
}
|
|
116609
116629
|
|
|
@@ -124126,6 +124146,7 @@ exports.TeamMembers = TeamMembers;
|
|
|
124126
124146
|
exports.ThankYouPage = ThankYouPage;
|
|
124127
124147
|
exports.USER_AGENTS = USER_AGENTS;
|
|
124128
124148
|
exports.WEBHOOK_SELECTORS = WEBHOOK_SELECTORS;
|
|
124149
|
+
exports.WebhookSiteApi = WebhookSiteApi;
|
|
124129
124150
|
exports.WebhooksPage = WebhooksPage;
|
|
124130
124151
|
exports.ZAPIER_LIMIT_EXHAUSTED_MESSAGE = ZAPIER_LIMIT_EXHAUSTED_MESSAGE;
|
|
124131
124152
|
exports.ZAPIER_SELECTORS = ZAPIER_SELECTORS;
|