@bigbinary/neeto-playwright-commons 1.1.1 → 1.1.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 +99 -125
- package/index.cjs.js.map +1 -1
- package/index.d.ts +10 -8
- package/index.js +117 -137
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -112,13 +112,15 @@ declare const CREDENTIALS: {
|
|
|
112
112
|
};
|
|
113
113
|
|
|
114
114
|
declare const BASE_URL = "/api/v1";
|
|
115
|
-
declare const
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
115
|
+
declare const ROUTES: {
|
|
116
|
+
neetoAuth: string;
|
|
117
|
+
profile: string;
|
|
118
|
+
login: string;
|
|
119
|
+
signup: string;
|
|
120
|
+
subdomainAvailability: string;
|
|
121
|
+
countries: string;
|
|
122
|
+
neetoApps: string;
|
|
123
|
+
};
|
|
122
124
|
|
|
123
125
|
declare const COMMON_SELECTORS: {
|
|
124
126
|
toastMessage: string;
|
|
@@ -204,4 +206,4 @@ interface Overrides {
|
|
|
204
206
|
}
|
|
205
207
|
declare const definePlaywrightConfig: (overrides: Overrides) => _playwright_test.PlaywrightTestConfig<{}, {}>;
|
|
206
208
|
|
|
207
|
-
export { BASE_URL, COMMON_SELECTORS, COMMON_TEXTS,
|
|
209
|
+
export { BASE_URL, COMMON_SELECTORS, COMMON_TEXTS, CREDENTIALS, CustomCommands, type CustomFixture, ENVIRONMENT, GLOBAL_TRANSLATIONS_PATTERN, IS_STAGING_ENV, LOGIN_SELECTORS, OrganizationPage, PROJECT_TRANSLATIONS_PATH, ROUTES, SIGNUP_SELECTORS, STORAGE_STATE, clearCredentials, commands, definePlaywrightConfig, i18n, initializeCredentials, joinString, login, loginWithoutSSO, readFileSyncIfExists, readTranslations, stagingData, updateCredentials, writeDataToFile };
|
package/index.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { expect, defineConfig, devices } from '@playwright/test';
|
|
2
|
-
import * as
|
|
3
|
-
import
|
|
2
|
+
import * as require$$0 from 'fs';
|
|
3
|
+
import require$$0__default from 'fs';
|
|
4
4
|
import require$$2 from 'os';
|
|
5
|
-
import require$$0 from 'path';
|
|
6
|
-
import require$$0$
|
|
7
|
-
import require$$0$
|
|
8
|
-
import require$$0$
|
|
5
|
+
import require$$0$1 from 'path';
|
|
6
|
+
import require$$0$2 from 'util';
|
|
7
|
+
import require$$0$3 from 'stream';
|
|
8
|
+
import require$$0$4 from 'events';
|
|
9
9
|
import { mergeDeepLeft } from 'ramda';
|
|
10
10
|
import dayjs from 'dayjs';
|
|
11
11
|
import require$$3 from 'crypto';
|
|
12
12
|
|
|
13
|
-
const COMMON_SELECTORS
|
|
13
|
+
const COMMON_SELECTORS = {
|
|
14
14
|
toastMessage: "toastr-message-container",
|
|
15
15
|
toastIcon: ".Toastify__toast-icon",
|
|
16
16
|
toastCloseButton: "toastr-close-button",
|
|
@@ -88,7 +88,7 @@ var path$a = {};
|
|
|
88
88
|
Object.defineProperty(path$a, "__esModule", { value: true });
|
|
89
89
|
path$a.convertPosixPathToPattern = path$a.convertWindowsPathToPattern = path$a.convertPathToPattern = path$a.escapePosixPath = path$a.escapeWindowsPath = path$a.escape = path$a.removeLeadingDotSegment = path$a.makeAbsolute = path$a.unixify = void 0;
|
|
90
90
|
const os$1 = require$$2;
|
|
91
|
-
const path$9 = require$$0;
|
|
91
|
+
const path$9 = require$$0$1;
|
|
92
92
|
const IS_WINDOWS_PLATFORM = os$1.platform() === 'win32';
|
|
93
93
|
const LEADING_DOT_SEGMENT_CHARACTERS_COUNT = 2; // ./ or .\\
|
|
94
94
|
/**
|
|
@@ -328,7 +328,7 @@ var isGlob$1 = function isGlob(str, options) {
|
|
|
328
328
|
};
|
|
329
329
|
|
|
330
330
|
var isGlob = isGlob$1;
|
|
331
|
-
var pathPosixDirname = require$$0.posix.dirname;
|
|
331
|
+
var pathPosixDirname = require$$0$1.posix.dirname;
|
|
332
332
|
var isWin32 = require$$2.platform() === 'win32';
|
|
333
333
|
|
|
334
334
|
var slash = '/';
|
|
@@ -825,7 +825,7 @@ var toRegexRange_1 = toRegexRange$1;
|
|
|
825
825
|
* Licensed under the MIT License.
|
|
826
826
|
*/
|
|
827
827
|
|
|
828
|
-
const util$1 = require$$0$
|
|
828
|
+
const util$1 = require$$0$2;
|
|
829
829
|
const toRegexRange = toRegexRange_1;
|
|
830
830
|
|
|
831
831
|
const isObject$1 = val => val !== null && typeof val === 'object' && !Array.isArray(val);
|
|
@@ -1792,7 +1792,7 @@ var picomatch$2 = {exports: {}};
|
|
|
1792
1792
|
|
|
1793
1793
|
var utils$f = {};
|
|
1794
1794
|
|
|
1795
|
-
const path$8 = require$$0;
|
|
1795
|
+
const path$8 = require$$0$1;
|
|
1796
1796
|
const WIN_SLASH = '\\\\/';
|
|
1797
1797
|
const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
|
|
1798
1798
|
|
|
@@ -1972,7 +1972,7 @@ var constants$3 = {
|
|
|
1972
1972
|
|
|
1973
1973
|
(function (exports) {
|
|
1974
1974
|
|
|
1975
|
-
const path = require$$0;
|
|
1975
|
+
const path = require$$0$1;
|
|
1976
1976
|
const win32 = process.platform === 'win32';
|
|
1977
1977
|
const {
|
|
1978
1978
|
REGEX_BACKSLASH,
|
|
@@ -3516,7 +3516,7 @@ parse$2.fastpaths = (input, options) => {
|
|
|
3516
3516
|
|
|
3517
3517
|
var parse_1 = parse$2;
|
|
3518
3518
|
|
|
3519
|
-
const path$7 = require$$0;
|
|
3519
|
+
const path$7 = require$$0$1;
|
|
3520
3520
|
const scan = scan_1;
|
|
3521
3521
|
const parse$1 = parse_1;
|
|
3522
3522
|
const utils$c = utils$f;
|
|
@@ -3862,7 +3862,7 @@ var picomatch_1 = picomatch$1;
|
|
|
3862
3862
|
module.exports = picomatch_1;
|
|
3863
3863
|
} (picomatch$2));
|
|
3864
3864
|
|
|
3865
|
-
const util = require$$0$
|
|
3865
|
+
const util = require$$0$2;
|
|
3866
3866
|
const braces = braces_1;
|
|
3867
3867
|
const picomatch = picomatch$2.exports;
|
|
3868
3868
|
const utils$b = utils$f;
|
|
@@ -4330,7 +4330,7 @@ var micromatch_1 = micromatch$1;
|
|
|
4330
4330
|
|
|
4331
4331
|
Object.defineProperty(pattern$1, "__esModule", { value: true });
|
|
4332
4332
|
pattern$1.removeDuplicateSlashes = pattern$1.matchAny = pattern$1.convertPatternsToRe = pattern$1.makeRe = pattern$1.getPatternParts = pattern$1.expandBraceExpansion = pattern$1.expandPatternsWithBraceExpansion = pattern$1.isAffectDepthOfReadingPattern = pattern$1.endsWithSlashGlobStar = pattern$1.hasGlobStar = pattern$1.getBaseDirectory = pattern$1.isPatternRelatedToParentDirectory = pattern$1.getPatternsOutsideCurrentDirectory = pattern$1.getPatternsInsideCurrentDirectory = pattern$1.getPositivePatterns = pattern$1.getNegativePatterns = pattern$1.isPositivePattern = pattern$1.isNegativePattern = pattern$1.convertToNegativePattern = pattern$1.convertToPositivePattern = pattern$1.isDynamicPattern = pattern$1.isStaticPattern = void 0;
|
|
4333
|
-
const path$6 = require$$0;
|
|
4333
|
+
const path$6 = require$$0$1;
|
|
4334
4334
|
const globParent = globParent$1;
|
|
4335
4335
|
const micromatch = micromatch_1;
|
|
4336
4336
|
const GLOBSTAR = '**';
|
|
@@ -4525,7 +4525,7 @@ var stream$4 = {};
|
|
|
4525
4525
|
* Copyright (c) 2014-2020 Teambition
|
|
4526
4526
|
* Licensed under the MIT license.
|
|
4527
4527
|
*/
|
|
4528
|
-
const Stream = require$$0$
|
|
4528
|
+
const Stream = require$$0$3;
|
|
4529
4529
|
const PassThrough = Stream.PassThrough;
|
|
4530
4530
|
const slice = Array.prototype.slice;
|
|
4531
4531
|
|
|
@@ -4905,7 +4905,7 @@ var fs$6 = {};
|
|
|
4905
4905
|
(function (exports) {
|
|
4906
4906
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4907
4907
|
exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = void 0;
|
|
4908
|
-
const fs =
|
|
4908
|
+
const fs = require$$0__default;
|
|
4909
4909
|
exports.FILE_SYSTEM_ADAPTER = {
|
|
4910
4910
|
lstat: fs.lstat,
|
|
4911
4911
|
stat: fs.stat,
|
|
@@ -5256,7 +5256,7 @@ var fs$2 = {};
|
|
|
5256
5256
|
(function (exports) {
|
|
5257
5257
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5258
5258
|
exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = void 0;
|
|
5259
|
-
const fs =
|
|
5259
|
+
const fs = require$$0__default;
|
|
5260
5260
|
exports.FILE_SYSTEM_ADAPTER = {
|
|
5261
5261
|
lstat: fs.lstat,
|
|
5262
5262
|
stat: fs.stat,
|
|
@@ -5275,7 +5275,7 @@ var fs$2 = {};
|
|
|
5275
5275
|
} (fs$2));
|
|
5276
5276
|
|
|
5277
5277
|
Object.defineProperty(settings$2, "__esModule", { value: true });
|
|
5278
|
-
const path$4 = require$$0;
|
|
5278
|
+
const path$4 = require$$0$1;
|
|
5279
5279
|
const fsStat$3 = out$1;
|
|
5280
5280
|
const fs$1 = fs$2;
|
|
5281
5281
|
class Settings$1 {
|
|
@@ -5693,7 +5693,7 @@ class Reader$1 {
|
|
|
5693
5693
|
reader$1.default = Reader$1;
|
|
5694
5694
|
|
|
5695
5695
|
Object.defineProperty(async$4, "__esModule", { value: true });
|
|
5696
|
-
const events_1 = require$$0$
|
|
5696
|
+
const events_1 = require$$0$4;
|
|
5697
5697
|
const fsScandir$2 = out$2;
|
|
5698
5698
|
const fastq = queue.exports;
|
|
5699
5699
|
const common$1 = common$3;
|
|
@@ -5822,7 +5822,7 @@ function callSuccessCallback(callback, entries) {
|
|
|
5822
5822
|
var stream$2 = {};
|
|
5823
5823
|
|
|
5824
5824
|
Object.defineProperty(stream$2, "__esModule", { value: true });
|
|
5825
|
-
const stream_1$5 = require$$0$
|
|
5825
|
+
const stream_1$5 = require$$0$3;
|
|
5826
5826
|
const async_1$3 = async$4;
|
|
5827
5827
|
class StreamProvider {
|
|
5828
5828
|
constructor(_root, _settings) {
|
|
@@ -5935,7 +5935,7 @@ sync$3.default = SyncProvider;
|
|
|
5935
5935
|
var settings$1 = {};
|
|
5936
5936
|
|
|
5937
5937
|
Object.defineProperty(settings$1, "__esModule", { value: true });
|
|
5938
|
-
const path$3 = require$$0;
|
|
5938
|
+
const path$3 = require$$0$1;
|
|
5939
5939
|
const fsScandir = out$2;
|
|
5940
5940
|
class Settings {
|
|
5941
5941
|
constructor(_options = {}) {
|
|
@@ -5997,7 +5997,7 @@ function getSettings(settingsOrOptions = {}) {
|
|
|
5997
5997
|
var reader = {};
|
|
5998
5998
|
|
|
5999
5999
|
Object.defineProperty(reader, "__esModule", { value: true });
|
|
6000
|
-
const path$2 = require$$0;
|
|
6000
|
+
const path$2 = require$$0$1;
|
|
6001
6001
|
const fsStat$2 = out$1;
|
|
6002
6002
|
const utils$6 = utils$k;
|
|
6003
6003
|
class Reader {
|
|
@@ -6032,7 +6032,7 @@ reader.default = Reader;
|
|
|
6032
6032
|
var stream$1 = {};
|
|
6033
6033
|
|
|
6034
6034
|
Object.defineProperty(stream$1, "__esModule", { value: true });
|
|
6035
|
-
const stream_1$3 = require$$0$
|
|
6035
|
+
const stream_1$3 = require$$0$3;
|
|
6036
6036
|
const fsStat$1 = out$1;
|
|
6037
6037
|
const fsWalk$2 = out$3;
|
|
6038
6038
|
const reader_1$2 = reader;
|
|
@@ -6385,7 +6385,7 @@ class EntryTransformer {
|
|
|
6385
6385
|
entry.default = EntryTransformer;
|
|
6386
6386
|
|
|
6387
6387
|
Object.defineProperty(provider, "__esModule", { value: true });
|
|
6388
|
-
const path$1 = require$$0;
|
|
6388
|
+
const path$1 = require$$0$1;
|
|
6389
6389
|
const deep_1 = deep;
|
|
6390
6390
|
const entry_1 = entry$1;
|
|
6391
6391
|
const error_1 = error;
|
|
@@ -6458,7 +6458,7 @@ async$7.default = ProviderAsync;
|
|
|
6458
6458
|
var stream = {};
|
|
6459
6459
|
|
|
6460
6460
|
Object.defineProperty(stream, "__esModule", { value: true });
|
|
6461
|
-
const stream_1$1 = require$$0$
|
|
6461
|
+
const stream_1$1 = require$$0$3;
|
|
6462
6462
|
const stream_2 = stream$1;
|
|
6463
6463
|
const provider_1$1 = provider;
|
|
6464
6464
|
class ProviderStream extends provider_1$1.default {
|
|
@@ -6563,7 +6563,7 @@ var settings = {};
|
|
|
6563
6563
|
(function (exports) {
|
|
6564
6564
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6565
6565
|
exports.DEFAULT_FILE_SYSTEM_ADAPTER = void 0;
|
|
6566
|
-
const fs =
|
|
6566
|
+
const fs = require$$0__default;
|
|
6567
6567
|
const os = require$$2;
|
|
6568
6568
|
/**
|
|
6569
6569
|
* The `os.cpus` method can return zero. We expect the number of cores to be greater than zero.
|
|
@@ -6721,17 +6721,61 @@ function assertPatternsInput(input) {
|
|
|
6721
6721
|
}
|
|
6722
6722
|
var out = FastGlob;
|
|
6723
6723
|
|
|
6724
|
-
|
|
6725
|
-
|
|
6724
|
+
const ENVIRONMENT = {
|
|
6725
|
+
development: "development",
|
|
6726
|
+
staging: "staging",
|
|
6727
|
+
review: "review",
|
|
6728
|
+
};
|
|
6729
|
+
const IS_STAGING_ENV = process.env.TEST_ENV === "staging";
|
|
6730
|
+
const STORAGE_STATE = "./e2e/auth/user.json";
|
|
6731
|
+
const GLOBAL_TRANSLATIONS_PATTERN = "../node_modules/@bigbinary/**/translations/en.json";
|
|
6732
|
+
const PROJECT_TRANSLATIONS_PATH = "../app/javascript/src/translations/en.json";
|
|
6733
|
+
const CREDENTIALS = { email: "oliver@example.com", password: "welcome" };
|
|
6726
6734
|
|
|
6727
|
-
const
|
|
6735
|
+
const joinString = (string1, string2, string3 = "", separator = " ") => {
|
|
6736
|
+
if (string3 === "") {
|
|
6737
|
+
return string1 + separator + string2;
|
|
6738
|
+
}
|
|
6739
|
+
return string1 + separator + string2 + separator + string3;
|
|
6740
|
+
};
|
|
6741
|
+
const readFileSyncIfExists = (path = STORAGE_STATE) => {
|
|
6728
6742
|
try {
|
|
6729
|
-
return JSON.parse(
|
|
6743
|
+
return JSON.parse(require$$0.readFileSync(path, "utf8"));
|
|
6730
6744
|
}
|
|
6731
6745
|
catch (error) {
|
|
6732
6746
|
return {};
|
|
6733
6747
|
}
|
|
6734
6748
|
};
|
|
6749
|
+
const writeDataToFile = data => {
|
|
6750
|
+
try {
|
|
6751
|
+
require$$0.writeFileSync(STORAGE_STATE, data, "utf8");
|
|
6752
|
+
}
|
|
6753
|
+
catch (error) {
|
|
6754
|
+
console.log(error); // eslint-disable-line
|
|
6755
|
+
}
|
|
6756
|
+
return true;
|
|
6757
|
+
};
|
|
6758
|
+
const updateCredentials = ({ key, value }) => {
|
|
6759
|
+
const data = readFileSyncIfExists();
|
|
6760
|
+
data["user"][key] = value;
|
|
6761
|
+
return writeDataToFile(JSON.stringify(data));
|
|
6762
|
+
};
|
|
6763
|
+
const clearCredentials = () => {
|
|
6764
|
+
require$$0.unlink(STORAGE_STATE, error => {
|
|
6765
|
+
if (!error)
|
|
6766
|
+
return;
|
|
6767
|
+
console.log(error); // eslint-disable-line
|
|
6768
|
+
});
|
|
6769
|
+
};
|
|
6770
|
+
const readTranslations = () => {
|
|
6771
|
+
let translations = readFileSyncIfExists(PROJECT_TRANSLATIONS_PATH);
|
|
6772
|
+
const paths = out.sync(GLOBAL_TRANSLATIONS_PATTERN);
|
|
6773
|
+
paths.forEach(path => {
|
|
6774
|
+
const packageTranslation = readFileSyncIfExists(path);
|
|
6775
|
+
translations = mergeDeepLeft(translations, packageTranslation);
|
|
6776
|
+
});
|
|
6777
|
+
return translations;
|
|
6778
|
+
};
|
|
6735
6779
|
|
|
6736
6780
|
class CustomCommands {
|
|
6737
6781
|
constructor(page, request) {
|
|
@@ -6764,13 +6808,13 @@ class CustomCommands {
|
|
|
6764
6808
|
};
|
|
6765
6809
|
this.verifySuccessToast = async ({ message, closeAfterVerification = true, }) => {
|
|
6766
6810
|
if (message) {
|
|
6767
|
-
await expect(this.page.getByTestId(COMMON_SELECTORS
|
|
6811
|
+
await expect(this.page.getByTestId(COMMON_SELECTORS.toastMessage)).toHaveValue(message);
|
|
6768
6812
|
}
|
|
6769
6813
|
else {
|
|
6770
|
-
await expect(this.page.locator(COMMON_SELECTORS
|
|
6814
|
+
await expect(this.page.locator(COMMON_SELECTORS.toastIcon)).toHaveValue("👍");
|
|
6771
6815
|
closeAfterVerification &&
|
|
6772
6816
|
(await this.page
|
|
6773
|
-
.getByTestId(COMMON_SELECTORS
|
|
6817
|
+
.getByTestId(COMMON_SELECTORS.toastCloseButton)
|
|
6774
6818
|
.click());
|
|
6775
6819
|
}
|
|
6776
6820
|
};
|
|
@@ -6782,19 +6826,20 @@ class CustomCommands {
|
|
|
6782
6826
|
await reloadRequests;
|
|
6783
6827
|
};
|
|
6784
6828
|
this.apiRequest = async ({ url, headers: additionalHeaders, body: data, method = "get", params = {}, ...otherOptions }) => {
|
|
6785
|
-
const { headers } = readFileSyncIfExists
|
|
6829
|
+
const { headers } = readFileSyncIfExists();
|
|
6786
6830
|
const requestOptions = {
|
|
6787
6831
|
headers: { ...headers, ...additionalHeaders, "accept-encoding": "gzip" },
|
|
6788
6832
|
data,
|
|
6789
6833
|
params,
|
|
6790
6834
|
...otherOptions,
|
|
6791
6835
|
};
|
|
6792
|
-
|
|
6793
|
-
get: this.request.get(url, requestOptions),
|
|
6794
|
-
post: this.request.post(url, requestOptions),
|
|
6795
|
-
put: this.request.put(url, requestOptions),
|
|
6796
|
-
delete: this.request.delete(url, requestOptions),
|
|
6797
|
-
}
|
|
6836
|
+
const httpMethodsHandlers = {
|
|
6837
|
+
get: () => this.request.get(url, requestOptions),
|
|
6838
|
+
post: () => this.request.post(url, requestOptions),
|
|
6839
|
+
put: () => this.request.put(url, requestOptions),
|
|
6840
|
+
delete: () => this.request.delete(url, requestOptions),
|
|
6841
|
+
};
|
|
6842
|
+
return await httpMethodsHandlers[method.toLowerCase()]();
|
|
6798
6843
|
};
|
|
6799
6844
|
this.verifyFieldValue = values => {
|
|
6800
6845
|
const verifyEachFieldValue = ({ field, value, }) => expect(this.page.getByTestId(field)).toHaveValue(value);
|
|
@@ -6815,67 +6860,11 @@ const commands = {
|
|
|
6815
6860
|
},
|
|
6816
6861
|
page: async ({ page }, use) => {
|
|
6817
6862
|
await page.goto("/");
|
|
6818
|
-
await page.waitForLoadState(
|
|
6863
|
+
await page.waitForLoadState();
|
|
6819
6864
|
await use(page);
|
|
6820
6865
|
},
|
|
6821
6866
|
};
|
|
6822
6867
|
|
|
6823
|
-
const ENVIRONMENT = {
|
|
6824
|
-
development: "development",
|
|
6825
|
-
staging: "staging",
|
|
6826
|
-
review: "review",
|
|
6827
|
-
};
|
|
6828
|
-
const IS_STAGING_ENV = process.env.TEST_ENV === "staging";
|
|
6829
|
-
const STORAGE_STATE = "./e2e/auth/user.json";
|
|
6830
|
-
const GLOBAL_TRANSLATIONS_PATTERN = "../node_modules/@bigbinary/**/translations/en.json";
|
|
6831
|
-
const PROJECT_TRANSLATIONS_PATH = "../app/javascript/src/translations/en.json";
|
|
6832
|
-
const CREDENTIALS = { email: "oliver@example.com", password: "welcome" };
|
|
6833
|
-
|
|
6834
|
-
const joinString = (string1, string2, string3 = "", separator = " ") => {
|
|
6835
|
-
if (string3 === "") {
|
|
6836
|
-
return string1 + separator + string2;
|
|
6837
|
-
}
|
|
6838
|
-
return string1 + separator + string2 + separator + string3;
|
|
6839
|
-
};
|
|
6840
|
-
const readFileSyncIfExists = (path = STORAGE_STATE) => {
|
|
6841
|
-
try {
|
|
6842
|
-
return JSON.parse(fs$9.readFileSync(path, "utf8"));
|
|
6843
|
-
}
|
|
6844
|
-
catch (error) {
|
|
6845
|
-
return {};
|
|
6846
|
-
}
|
|
6847
|
-
};
|
|
6848
|
-
const writeDataToFile = data => {
|
|
6849
|
-
try {
|
|
6850
|
-
fs$9.writeFileSync(STORAGE_STATE, data, "utf8");
|
|
6851
|
-
}
|
|
6852
|
-
catch (error) {
|
|
6853
|
-
console.log(error); // eslint-disable-line
|
|
6854
|
-
}
|
|
6855
|
-
return true;
|
|
6856
|
-
};
|
|
6857
|
-
const updateCredentials = ({ key, value }) => {
|
|
6858
|
-
const data = readFileSyncIfExists();
|
|
6859
|
-
data["user"][key] = value;
|
|
6860
|
-
return writeDataToFile(JSON.stringify(data));
|
|
6861
|
-
};
|
|
6862
|
-
const clearCredentials = () => {
|
|
6863
|
-
fs$9.unlink(STORAGE_STATE, error => {
|
|
6864
|
-
if (!error)
|
|
6865
|
-
return;
|
|
6866
|
-
console.log(error); // eslint-disable-line
|
|
6867
|
-
});
|
|
6868
|
-
};
|
|
6869
|
-
const readTranslations = () => {
|
|
6870
|
-
let translations = readFileSyncIfExists(PROJECT_TRANSLATIONS_PATH);
|
|
6871
|
-
const paths = out.sync(GLOBAL_TRANSLATIONS_PATTERN);
|
|
6872
|
-
paths.forEach(path => {
|
|
6873
|
-
const packageTranslation = readFileSyncIfExists(path);
|
|
6874
|
-
translations = mergeDeepLeft(translations, packageTranslation);
|
|
6875
|
-
});
|
|
6876
|
-
return translations;
|
|
6877
|
-
};
|
|
6878
|
-
|
|
6879
6868
|
const timestamp = dayjs().format("YYYYMMDDHH");
|
|
6880
6869
|
const firstName = "André";
|
|
6881
6870
|
const lastName = "O'Reilly";
|
|
@@ -6892,7 +6881,7 @@ const stagingData = {
|
|
|
6892
6881
|
businessName: stagingOrganization,
|
|
6893
6882
|
subdomainName: IS_STAGING_ENV ? stagingOrganization : "spinkart",
|
|
6894
6883
|
email: IS_STAGING_ENV
|
|
6895
|
-
? `cypresstest${otpBypassKey}+invoice+${timestamp}@bigbinary.com`
|
|
6884
|
+
? `cypresstest${otpBypassKey}+invoice+${timestamp}-playwright@bigbinary.com`
|
|
6896
6885
|
: "oliver@example.com",
|
|
6897
6886
|
};
|
|
6898
6887
|
|
|
@@ -6912,25 +6901,14 @@ const i18n = {
|
|
|
6912
6901
|
};
|
|
6913
6902
|
|
|
6914
6903
|
const BASE_URL = "/api/v1";
|
|
6915
|
-
const
|
|
6916
|
-
|
|
6917
|
-
|
|
6918
|
-
|
|
6919
|
-
|
|
6920
|
-
|
|
6921
|
-
|
|
6922
|
-
|
|
6923
|
-
const COMMON_SELECTORS = {
|
|
6924
|
-
toastMessage: "toastr-message-container",
|
|
6925
|
-
toastIcon: ".Toastify__toast-icon",
|
|
6926
|
-
toastCloseButton: "toastr-close-button",
|
|
6927
|
-
dropdownIcon: "nui-dropdown-icon",
|
|
6928
|
-
checkbox: "nui-checkbox-input",
|
|
6929
|
-
spinner: ".neeto-ui-spinner",
|
|
6930
|
-
input: "nui-input-field",
|
|
6931
|
-
alertModalSubmitButton: "alert-submit-button",
|
|
6932
|
-
selectContainer: "nui-select-container",
|
|
6933
|
-
subheaderText: "subheader-left",
|
|
6904
|
+
const ROUTES = {
|
|
6905
|
+
neetoAuth: "https://app.neetoauth.net",
|
|
6906
|
+
profile: "/profile",
|
|
6907
|
+
login: `${BASE_URL}/login`,
|
|
6908
|
+
signup: `${BASE_URL}/signups`,
|
|
6909
|
+
subdomainAvailability: `${BASE_URL}/subdomain_availability`,
|
|
6910
|
+
countries: `${BASE_URL}/countries`,
|
|
6911
|
+
neetoApps: `${BASE_URL}/neeto_apps`,
|
|
6934
6912
|
};
|
|
6935
6913
|
|
|
6936
6914
|
const SIGNUP_SELECTORS = {
|
|
@@ -6968,8 +6946,8 @@ class OrganizationPage {
|
|
|
6968
6946
|
: await this.page.goto(`${authUrl}?redirect_uri=${appNameInLowerCase}.net`);
|
|
6969
6947
|
await this.page.getByTestId(SIGNUP_SELECTORS.emailTextField).fill(email);
|
|
6970
6948
|
const signup = this.neetoPlaywrightUtilities.interceptMultipleResponses({
|
|
6971
|
-
responseUrl:
|
|
6972
|
-
baseUrl:
|
|
6949
|
+
responseUrl: ROUTES.signup,
|
|
6950
|
+
baseUrl: ROUTES.neetoAuth,
|
|
6973
6951
|
});
|
|
6974
6952
|
await this.page.getByTestId(SIGNUP_SELECTORS.submitButton).click();
|
|
6975
6953
|
await signup;
|
|
@@ -6977,7 +6955,7 @@ class OrganizationPage {
|
|
|
6977
6955
|
await this.page
|
|
6978
6956
|
.getByTestId(SIGNUP_SELECTORS.organizationNameTextField)
|
|
6979
6957
|
.fill(businessName);
|
|
6980
|
-
const fetchSubdomainAvailability = this.page.waitForResponse(response => response.url().includes(
|
|
6958
|
+
const fetchSubdomainAvailability = this.page.waitForResponse(response => response.url().includes(ROUTES.subdomainAvailability));
|
|
6981
6959
|
await this.page
|
|
6982
6960
|
.getByTestId(SIGNUP_SELECTORS.subdomainNameTextField)
|
|
6983
6961
|
.fill(subdomainName);
|
|
@@ -6991,10 +6969,10 @@ class OrganizationPage {
|
|
|
6991
6969
|
.getByTestId(SIGNUP_SELECTORS.organizationSubmitButton)
|
|
6992
6970
|
.click();
|
|
6993
6971
|
await Promise.all([
|
|
6994
|
-
this.page.waitForResponse(response => response.url().includes(
|
|
6995
|
-
this.page.waitForResponse(response => response.url().includes(
|
|
6972
|
+
this.page.waitForResponse(response => response.url().includes(ROUTES.signup)),
|
|
6973
|
+
this.page.waitForResponse(response => response.url().includes(ROUTES.countries)),
|
|
6996
6974
|
]);
|
|
6997
|
-
await this.page.waitForURL(`**${
|
|
6975
|
+
await this.page.waitForURL(`**${ROUTES.profile}`, { timeout: 15000 });
|
|
6998
6976
|
await this.page
|
|
6999
6977
|
.getByTestId(SIGNUP_SELECTORS.firstNameTextField)
|
|
7000
6978
|
.fill(firstName);
|
|
@@ -7003,8 +6981,8 @@ class OrganizationPage {
|
|
|
7003
6981
|
.fill(lastName);
|
|
7004
6982
|
await this.page.getByTestId(COMMON_SELECTORS.checkbox).click();
|
|
7005
6983
|
const submitProfile = this.neetoPlaywrightUtilities.interceptMultipleResponses({
|
|
7006
|
-
responseUrl:
|
|
7007
|
-
baseUrl:
|
|
6984
|
+
responseUrl: ROUTES.signup,
|
|
6985
|
+
baseUrl: ROUTES.neetoAuth,
|
|
7008
6986
|
});
|
|
7009
6987
|
await this.page.getByTestId(SIGNUP_SELECTORS.profileSubmitButton).click();
|
|
7010
6988
|
await submitProfile;
|
|
@@ -7022,7 +7000,7 @@ class OrganizationPage {
|
|
|
7022
7000
|
subdomainName: user.subdomainName,
|
|
7023
7001
|
appName: "neetoInvoice",
|
|
7024
7002
|
});
|
|
7025
|
-
await this.page.route(`**${
|
|
7003
|
+
await this.page.route(`**${ROUTES.neetoApps}`, async (route) => {
|
|
7026
7004
|
headers = await route.request().allHeaders();
|
|
7027
7005
|
await route.continue();
|
|
7028
7006
|
});
|
|
@@ -7045,7 +7023,7 @@ class OrganizationPage {
|
|
|
7045
7023
|
await this.page
|
|
7046
7024
|
.getByTestId(SIGNUP_SELECTORS.subdomainNameTextField)
|
|
7047
7025
|
.fill(newOrganizationName);
|
|
7048
|
-
await this.page.waitForResponse(response => response.url().includes(
|
|
7026
|
+
await this.page.waitForResponse(response => response.url().includes(ROUTES.subdomainAvailability));
|
|
7049
7027
|
subdomainErrorCount = await subdomainError.count();
|
|
7050
7028
|
if (subdomainErrorCount === 0) {
|
|
7051
7029
|
updateCredentials({
|
|
@@ -7110,21 +7088,23 @@ const loginWithoutSSO = async ({ page, neetoPlaywrightUtilities, }) => {
|
|
|
7110
7088
|
var _a;
|
|
7111
7089
|
await page.goto((_a = process.env.BASE_URL) !== null && _a !== void 0 ? _a : "");
|
|
7112
7090
|
let headers = {};
|
|
7113
|
-
await page.route(`**${LOGIN_PATH}`, async (route) => {
|
|
7114
|
-
headers = await route.request().allHeaders();
|
|
7115
|
-
await route.continue();
|
|
7116
|
-
});
|
|
7117
7091
|
await page.getByTestId("login-email-text-field").fill(CREDENTIALS.email);
|
|
7118
7092
|
await page
|
|
7119
7093
|
.getByTestId("login-password-text-field")
|
|
7120
7094
|
.fill(CREDENTIALS.password);
|
|
7121
7095
|
const login = neetoPlaywrightUtilities.interceptMultipleResponses({
|
|
7122
|
-
times:
|
|
7096
|
+
times: 1,
|
|
7123
7097
|
});
|
|
7124
7098
|
await page.getByTestId(LOGIN_SELECTORS.submitButton).click();
|
|
7125
7099
|
await login;
|
|
7100
|
+
await page.route(`**${BASE_URL}/**`, async (route) => {
|
|
7101
|
+
headers = await route.request().allHeaders();
|
|
7102
|
+
await route.continue();
|
|
7103
|
+
});
|
|
7126
7104
|
const userCredentials = readFileSyncIfExists();
|
|
7127
7105
|
await page.context().storageState({ path: STORAGE_STATE });
|
|
7106
|
+
//eslint-disable-next-line
|
|
7107
|
+
await page.waitForTimeout(5000); // There is a delay in headers being set from the route.
|
|
7128
7108
|
const mergedCredentials = {
|
|
7129
7109
|
...readFileSyncIfExists(),
|
|
7130
7110
|
...userCredentials,
|
|
@@ -7217,8 +7197,8 @@ var require$$4 = {
|
|
|
7217
7197
|
browser: browser
|
|
7218
7198
|
};
|
|
7219
7199
|
|
|
7220
|
-
const fs =
|
|
7221
|
-
const path = require$$0;
|
|
7200
|
+
const fs = require$$0__default;
|
|
7201
|
+
const path = require$$0$1;
|
|
7222
7202
|
const os = require$$2;
|
|
7223
7203
|
const crypto = require$$3;
|
|
7224
7204
|
const packageJson = require$$4;
|
|
@@ -7549,7 +7529,7 @@ const definePlaywrightConfig = (overrides) => {
|
|
|
7549
7529
|
const { globalOverrides = {}, useOverrides = {}, projectOverrides = [], currentsOverrides = {}, } = overrides;
|
|
7550
7530
|
return defineConfig({
|
|
7551
7531
|
testDir: "./e2e/tests",
|
|
7552
|
-
fullyParallel:
|
|
7532
|
+
fullyParallel: true,
|
|
7553
7533
|
forbidOnly: isCI,
|
|
7554
7534
|
retries: isCI ? 1 : 0,
|
|
7555
7535
|
timeout: 0,
|
|
@@ -7583,5 +7563,5 @@ const definePlaywrightConfig = (overrides) => {
|
|
|
7583
7563
|
});
|
|
7584
7564
|
};
|
|
7585
7565
|
|
|
7586
|
-
export { BASE_URL, COMMON_SELECTORS, COMMON_TEXTS,
|
|
7566
|
+
export { BASE_URL, COMMON_SELECTORS, COMMON_TEXTS, CREDENTIALS, CustomCommands, ENVIRONMENT, GLOBAL_TRANSLATIONS_PATTERN, IS_STAGING_ENV, LOGIN_SELECTORS, OrganizationPage, PROJECT_TRANSLATIONS_PATH, ROUTES, SIGNUP_SELECTORS, STORAGE_STATE, clearCredentials, commands, definePlaywrightConfig, i18n, initializeCredentials, joinString, login, loginWithoutSSO, readFileSyncIfExists, readTranslations, stagingData, updateCredentials, writeDataToFile };
|
|
7587
7567
|
//# sourceMappingURL=index.js.map
|