@bigbinary/neeto-playwright-commons 1.8.24 → 1.8.26
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 +23 -5
- package/index.cjs.js.map +1 -1
- package/index.d.ts +9 -3
- package/index.js +23 -5
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.cjs.js
CHANGED
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var test$1 = require('@playwright/test');
|
|
6
|
+
var child_process = require('child_process');
|
|
6
7
|
var require$$0$1 = require('fs');
|
|
7
|
-
var require$$0$2 = require('util');
|
|
8
8
|
var ramda = require('ramda');
|
|
9
|
+
var require$$0$2 = require('util');
|
|
9
10
|
var faker = require('@faker-js/faker');
|
|
10
11
|
var MailosaurClient = require('mailosaur');
|
|
11
12
|
var dayjs = require('dayjs');
|
|
@@ -69,6 +70,9 @@ const OTP_EMAIL_PATTERN = "is your login code";
|
|
|
69
70
|
const SLACK_DEFAULT_CHANNEL = "general";
|
|
70
71
|
|
|
71
72
|
/* eslint-disable playwright/no-skipped-test */
|
|
73
|
+
const execCommand = (command) => child_process.execSync(command)
|
|
74
|
+
.toString("utf-8")
|
|
75
|
+
.replace(/[\n\r\s]+$/, "");
|
|
72
76
|
const joinString = (string1, string2, string3 = "", separator = " ") => {
|
|
73
77
|
if (string3 === "") {
|
|
74
78
|
return string1 + separator + string2;
|
|
@@ -128,6 +132,11 @@ const skipTest = {
|
|
|
128
132
|
forDevelopmentEnv: () => test__default["default"].skip(process.env.TEST_ENV === ENVIRONMENT.development),
|
|
129
133
|
forReviewEnv: () => test__default["default"].skip(process.env.TEST_ENV === ENVIRONMENT.review),
|
|
130
134
|
forAllExceptStagingEnv: () => test__default["default"].skip(process.env.TEST_ENV !== ENVIRONMENT.staging),
|
|
135
|
+
forNonNightlyRun: () => {
|
|
136
|
+
const currentBranch = execCommand("git rev-parse --abbrev-ref HEAD");
|
|
137
|
+
const isNightlyRun = currentBranch === "main" && process.env.TEST_ENV === ENVIRONMENT.staging;
|
|
138
|
+
return test__default["default"].skip(ramda.not(isNightlyRun), "Run test only in playwright-nightly");
|
|
139
|
+
},
|
|
131
140
|
};
|
|
132
141
|
const shouldSkipSetupAndTeardown = () => { var _a; return ((_a = getGlobalUserState()) === null || _a === void 0 ? void 0 : _a.isLoggedIn) && process.env.SKIP_SETUP === "true"; };
|
|
133
142
|
|
|
@@ -12556,7 +12565,7 @@ const INTEGRATION_SELECTORS = {
|
|
|
12556
12565
|
};
|
|
12557
12566
|
|
|
12558
12567
|
class IntegrationBase {
|
|
12559
|
-
constructor({ page, neetoPlaywrightUtilities, integration,
|
|
12568
|
+
constructor({ page, neetoPlaywrightUtilities, integration, connectHeader, connectedHeader, pageloaderTimeout, integrationRouteIndex, integrationRouteResponsesParams, }) {
|
|
12560
12569
|
this.disconnect = async (interceptMultipleResponsesParams = {}) => {
|
|
12561
12570
|
await this.gotoIntegrationIndex();
|
|
12562
12571
|
await this.clickOnIntegrationCard();
|
|
@@ -12591,18 +12600,27 @@ class IntegrationBase {
|
|
|
12591
12600
|
await test$1.expect(this.page.getByTestId(COMMON_SELECTORS.spinner)).toHaveCount(0);
|
|
12592
12601
|
await this.integrationCard.scrollIntoViewIfNeeded();
|
|
12593
12602
|
await this.integrationCard.click();
|
|
12594
|
-
await test$1.expect(this.page.getByTestId(COMMON_SELECTORS.pageLoader)).toBeHidden();
|
|
12603
|
+
await test$1.expect(this.page.getByTestId(COMMON_SELECTORS.pageLoader)).toBeHidden({ timeout: this.pageloaderTimeout });
|
|
12595
12604
|
};
|
|
12596
12605
|
this.gotoIntegrationIndex = async () => {
|
|
12597
|
-
neetoCist.isNotEmpty(this.integrationRouteIndex)
|
|
12598
|
-
|
|
12606
|
+
if (neetoCist.isNotEmpty(this.integrationRouteIndex)) {
|
|
12607
|
+
const integrationIndexPromise = this.neetoPlaywrightUtilities.interceptMultipleResponses({
|
|
12608
|
+
times: 0,
|
|
12609
|
+
...this.integrationRouteResponsesParams,
|
|
12610
|
+
});
|
|
12611
|
+
await this.page.goto(this.integrationRouteIndex);
|
|
12612
|
+
await integrationIndexPromise;
|
|
12613
|
+
}
|
|
12599
12614
|
};
|
|
12600
12615
|
this.page = page;
|
|
12601
12616
|
this.neetoPlaywrightUtilities = neetoPlaywrightUtilities;
|
|
12602
12617
|
this.t = playwrightI18nextFixture.getI18nInstance().t;
|
|
12603
12618
|
this.integration = integration;
|
|
12604
12619
|
this.integrationCard = this.page.getByTestId(INTEGRATION_SELECTORS.integrationCard(integration));
|
|
12620
|
+
this.pageloaderTimeout = pageloaderTimeout || 10000;
|
|
12605
12621
|
this.integrationRouteIndex = integrationRouteIndex || "";
|
|
12622
|
+
this.integrationRouteResponsesParams =
|
|
12623
|
+
integrationRouteResponsesParams || {};
|
|
12606
12624
|
this.connectHeader =
|
|
12607
12625
|
connectHeader ||
|
|
12608
12626
|
INTEGRATIONS_TEXTS.connectHeader(neetoCist.humanize(this.integration));
|