@bigbinary/neeto-commons-frontend 2.0.78 → 2.0.80
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/configs/scripts/dead-code-eliminator/index.js +3 -7
- package/cypress-commands.d.ts +6 -0
- package/cypress-configs/initializer.js +41 -0
- package/cypress-configs/plugins.js +63 -0
- package/cypress-configs/resolve.js +18 -0
- package/cypress-configs/webpack.config.js +19 -0
- package/cypress-utils.cjs.js +6 -3
- package/cypress-utils.cjs.js.map +1 -1
- package/cypress-utils.d.ts +1 -1
- package/cypress-utils.js +6 -3
- package/cypress-utils.js.map +1 -1
- package/package.json +5 -3
|
@@ -13,7 +13,7 @@ const {
|
|
|
13
13
|
existsBy,
|
|
14
14
|
} = require("@bigbinary/neeto-commons-frontend/pure");
|
|
15
15
|
const enhancedResolve = require("enhanced-resolve");
|
|
16
|
-
const { isEmpty } = require("ramda");
|
|
16
|
+
const { isEmpty, includes, __ } = require("ramda");
|
|
17
17
|
|
|
18
18
|
const {
|
|
19
19
|
RAILS_MOUNTED_COMPONENTS_REGEX,
|
|
@@ -47,7 +47,7 @@ const isRailsMountedOrPacksFiles = filePath =>
|
|
|
47
47
|
PACKS_FILES_REGEX.test(filePath);
|
|
48
48
|
|
|
49
49
|
const isInImportedList = (item, filePath) =>
|
|
50
|
-
existsBy({ item, filePath }, importedItems);
|
|
50
|
+
existsBy({ item: includes(__, [item, "*"]), filePath }, importedItems);
|
|
51
51
|
|
|
52
52
|
const findImports = filePath => {
|
|
53
53
|
const code = fs.readFileSync(filePath, "utf8");
|
|
@@ -73,11 +73,7 @@ const findImports = filePath => {
|
|
|
73
73
|
|
|
74
74
|
node.specifiers.forEach(specifier => {
|
|
75
75
|
if (specifier.type === TYPES.IMPORT_NAMESPACE_SPECIFIER) {
|
|
76
|
-
|
|
77
|
-
binding?.referencePaths?.forEach(refPath => {
|
|
78
|
-
const item = refPath.parentPath?.node?.property?.name;
|
|
79
|
-
importedItems.push({ item, filePath: resolvedPath });
|
|
80
|
-
});
|
|
76
|
+
importedItems.push({ item: "*", filePath: resolvedPath });
|
|
81
77
|
} else if (specifier.type === TYPES.IMPORT_DEFAULT_SPECIFIER) {
|
|
82
78
|
importedItems.push({ item: "default", filePath: resolvedPath });
|
|
83
79
|
} else {
|
package/cypress-commands.d.ts
CHANGED
|
@@ -98,5 +98,11 @@ declare namespace Cypress {
|
|
|
98
98
|
}): Void;
|
|
99
99
|
verifyUnsavedAlertModal(cancelButton: string): Void;
|
|
100
100
|
verifyTooltip(selector: string, text: string): Void;
|
|
101
|
+
/**
|
|
102
|
+
* Command to get email content using Mailosaur API.
|
|
103
|
+
* @param props Mailosaur API request body.
|
|
104
|
+
* @see https://mailosaur.com/docs/frameworks-and-tools/cypress/#library-reference
|
|
105
|
+
*/
|
|
106
|
+
getEmailContent(props): Void;
|
|
101
107
|
}
|
|
102
108
|
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
const { defineConfig } = require("cypress");
|
|
2
|
+
|
|
3
|
+
const defineCypressConfig = (overrides = {}) => {
|
|
4
|
+
const globalState = { skipSetup: false };
|
|
5
|
+
|
|
6
|
+
const { e2e: e2eOverrides = {}, otherProps = {} } = overrides;
|
|
7
|
+
|
|
8
|
+
return defineConfig({
|
|
9
|
+
execTimeout: 1800000,
|
|
10
|
+
defaultCommandTimeout: 5000,
|
|
11
|
+
requestTimeout: 5000,
|
|
12
|
+
pageLoadTimeout: 30000,
|
|
13
|
+
responseTimeout: 20000,
|
|
14
|
+
viewportWidth: 1440,
|
|
15
|
+
viewportHeight: 960,
|
|
16
|
+
chromeWebSecurity: false,
|
|
17
|
+
env: { grepFilterSpecs: true, grepOmitFiltered: true },
|
|
18
|
+
retries: { runMode: 1, openMode: 0 },
|
|
19
|
+
e2e: {
|
|
20
|
+
setupNodeEvents(on, config) {
|
|
21
|
+
on("task", {
|
|
22
|
+
getGlobalState: key => (key ? globalState[key] || null : globalState),
|
|
23
|
+
updateGlobalState: ({ key, value }) => (globalState[key] = value),
|
|
24
|
+
bulkUpdateGlobalState: newState =>
|
|
25
|
+
Object.assign(globalState, newState),
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
return require("./plugins")(on, config);
|
|
29
|
+
},
|
|
30
|
+
specPattern: "cypress/e2e/**/*.spec.js",
|
|
31
|
+
excludeSpecPattern: "cypress/e2e/**/*.wip.spec.js",
|
|
32
|
+
experimentalRunAllSpecs: true,
|
|
33
|
+
testIsolation: true,
|
|
34
|
+
experimentalMemoryManagement: true,
|
|
35
|
+
...e2eOverrides,
|
|
36
|
+
},
|
|
37
|
+
...otherProps,
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
module.exports = { defineCypressConfig };
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/// <reference types="cypress" />
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @type {Cypress.PluginConfig}
|
|
6
|
+
*/
|
|
7
|
+
// eslint-disable-next-line no-unused-vars
|
|
8
|
+
const path = require("path");
|
|
9
|
+
|
|
10
|
+
const webpack = require("@cypress/webpack-preprocessor");
|
|
11
|
+
const {
|
|
12
|
+
cypressBrowserPermissionsPlugin,
|
|
13
|
+
} = require("cypress-browser-permissions");
|
|
14
|
+
const fs = require("fs-extra");
|
|
15
|
+
|
|
16
|
+
const getConfigurationByFile = file => {
|
|
17
|
+
const pathToConfigFile = `cypress/config/cypress.${file}.json`;
|
|
18
|
+
|
|
19
|
+
return file && fs.readJsonSync(path.join(process.cwd(), pathToConfigFile));
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const merge = (target, source = {}) => {
|
|
23
|
+
Object.keys(source).forEach(key => {
|
|
24
|
+
if (source[key] && typeof source[key] === "object") {
|
|
25
|
+
merge((target[key] = target[key] || {}), source[key]);
|
|
26
|
+
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
target[key] = source[key];
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
return target;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
module.exports = (on, config) => {
|
|
36
|
+
const environment = config.env.configFile;
|
|
37
|
+
const configForEnvironment = getConfigurationByFile(environment);
|
|
38
|
+
const options = {
|
|
39
|
+
// send in the options from your webpack.config.js
|
|
40
|
+
webpackOptions: require("./webpack.config"),
|
|
41
|
+
watchOptions: {},
|
|
42
|
+
};
|
|
43
|
+
on("file:preprocessor", webpack(options));
|
|
44
|
+
|
|
45
|
+
config = cypressBrowserPermissionsPlugin(on, config);
|
|
46
|
+
|
|
47
|
+
const newEnvironment = merge(config, configForEnvironment);
|
|
48
|
+
require("@cypress/grep/src/plugin")(newEnvironment);
|
|
49
|
+
require("@cypress/code-coverage/task")(on, newEnvironment);
|
|
50
|
+
|
|
51
|
+
on("before:browser:launch", (browser, launchOptions) => {
|
|
52
|
+
if (["chrome", "edge"].includes(browser.name) && browser.isHeadless) {
|
|
53
|
+
launchOptions.args.push("--no-sandbox");
|
|
54
|
+
launchOptions.args.push("--disable-gl-drawing-for-tests");
|
|
55
|
+
launchOptions.args.push("--js-flags=--max-old-space-size=3500");
|
|
56
|
+
launchOptions.args.push("--disable-gpu");
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return launchOptions;
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
return config, newEnvironment;
|
|
63
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
const path = require("path");
|
|
2
|
+
|
|
3
|
+
const basePath = `${process.cwd()}/cypress/`;
|
|
4
|
+
|
|
5
|
+
module.exports = {
|
|
6
|
+
alias: {
|
|
7
|
+
Fixtures: path.resolve(basePath, "fixtures"),
|
|
8
|
+
Plugins: path.resolve(basePath, "plugins"),
|
|
9
|
+
Support: path.resolve(basePath, "support"),
|
|
10
|
+
Texts: path.resolve(basePath, "constants/texts"),
|
|
11
|
+
Selectors: path.resolve(basePath, "constants/selectors"),
|
|
12
|
+
neetocommons: "@bigbinary/neeto-commons-frontend",
|
|
13
|
+
Constants: path.resolve(basePath, "constants"),
|
|
14
|
+
},
|
|
15
|
+
fallback: {
|
|
16
|
+
path: require.resolve("path-browserify"),
|
|
17
|
+
},
|
|
18
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const resolve = require("./resolve");
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
resolve,
|
|
5
|
+
module: {
|
|
6
|
+
rules: [
|
|
7
|
+
{
|
|
8
|
+
test: /\.(js|jsx)$/,
|
|
9
|
+
exclude: [/node_modules/],
|
|
10
|
+
use: [
|
|
11
|
+
{
|
|
12
|
+
loader: "babel-loader",
|
|
13
|
+
options: { presets: ["@babel/preset-env"] },
|
|
14
|
+
},
|
|
15
|
+
],
|
|
16
|
+
},
|
|
17
|
+
],
|
|
18
|
+
},
|
|
19
|
+
};
|
package/cypress-utils.cjs.js
CHANGED
|
@@ -514,6 +514,9 @@ var initCustomCommands = function initCustomCommands() {
|
|
|
514
514
|
});
|
|
515
515
|
cy.document().its("body").find(commonSelectors.tooltip).should("not.exist");
|
|
516
516
|
});
|
|
517
|
+
Cypress.Commands.add("getEmailContent", function (props) {
|
|
518
|
+
return cy.mailosaurGetMessage(Cypress.env("MAILOSAUR_SERVER_ID"), props);
|
|
519
|
+
});
|
|
517
520
|
};
|
|
518
521
|
|
|
519
522
|
var loginSelectors = {
|
|
@@ -675,7 +678,7 @@ var helpIconTexts = {
|
|
|
675
678
|
documentation: "Documentation",
|
|
676
679
|
welcome: "Welcome",
|
|
677
680
|
keyboardShortcuts: "Keyboard shortcuts",
|
|
678
|
-
|
|
681
|
+
liveChat: "Live chat",
|
|
679
682
|
newConversation: "New Conversation",
|
|
680
683
|
chatMessage: "Hello. Go ahead and ask us anything.",
|
|
681
684
|
whatsNew: "What's new"
|
|
@@ -1127,7 +1130,7 @@ var createOrganization = function createOrganization(_ref) {
|
|
|
1127
1130
|
cy.get(signUpSelectors.submitButton).click();
|
|
1128
1131
|
cy.wait("@signupRequest");
|
|
1129
1132
|
if (isMailosaurEmail) {
|
|
1130
|
-
cy.
|
|
1133
|
+
cy.getEmailContent({
|
|
1131
1134
|
sentTo: email,
|
|
1132
1135
|
subject: signUpTexts.loginCode
|
|
1133
1136
|
}).then(function (emailBody) {
|
|
@@ -1232,7 +1235,7 @@ var verifyChatWithUsTab = function verifyChatWithUsTab() {
|
|
|
1232
1235
|
alias: "fetchChatWidget",
|
|
1233
1236
|
times: 4
|
|
1234
1237
|
});
|
|
1235
|
-
clickOnHelpSubTab(helpIconSelectors.chatButton, helpIconTexts.
|
|
1238
|
+
clickOnHelpSubTab(helpIconSelectors.chatButton, helpIconTexts.liveChat);
|
|
1236
1239
|
cy.waitForMultipleRequest("@fetchChatWidget", 4);
|
|
1237
1240
|
cy.get(helpIconSelectors.chatButton).click();
|
|
1238
1241
|
cy.withinIframe(chatWidgetSelectors.widgetIframe, function () {
|