@bigbinary/neeto-playwright-commons 1.8.31 → 1.8.33
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 +55 -0
- package/index.cjs.js.map +1 -1
- package/index.d.ts +29 -2
- package/index.js +52 -1
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.cjs.js
CHANGED
|
@@ -13031,6 +13031,27 @@ const USER_AGENTS = {
|
|
|
13031
13031
|
mac: "Mozilla/5.0 (Macintosh; Intel Mac OS X 14_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36",
|
|
13032
13032
|
};
|
|
13033
13033
|
|
|
13034
|
+
const networkConditions = {
|
|
13035
|
+
"Slow 3G": {
|
|
13036
|
+
downloadThroughput: ((500 * 1000) / 8) * 0.8,
|
|
13037
|
+
uploadThroughput: ((500 * 1000) / 8) * 0.8,
|
|
13038
|
+
latency: 400 * 5,
|
|
13039
|
+
offline: false,
|
|
13040
|
+
},
|
|
13041
|
+
"Fast 3G": {
|
|
13042
|
+
downloadThroughput: ((1.6 * 1000 * 1000) / 8) * 0.9,
|
|
13043
|
+
uploadThroughput: ((750 * 1000) / 8) * 0.9,
|
|
13044
|
+
latency: 150 * 3.75,
|
|
13045
|
+
offline: false,
|
|
13046
|
+
},
|
|
13047
|
+
"No Throttling": {
|
|
13048
|
+
downloadThroughput: -1,
|
|
13049
|
+
uploadThroughput: -1,
|
|
13050
|
+
latency: 0,
|
|
13051
|
+
offline: false,
|
|
13052
|
+
},
|
|
13053
|
+
};
|
|
13054
|
+
|
|
13034
13055
|
const NEETO_EDITOR_SELECTORS = {
|
|
13035
13056
|
boldOption: "neeto-editor-fixed-menu-bold-option",
|
|
13036
13057
|
italicOption: "neeto-editor-fixed-menu-italic-option",
|
|
@@ -13049,6 +13070,10 @@ const NEETO_EDITOR_SELECTORS = {
|
|
|
13049
13070
|
redoOption: "neeto-editor-fixed-menu-redo-option",
|
|
13050
13071
|
imageWrapper: "neeto-editor-image-wrapper",
|
|
13051
13072
|
contentField: "neeto-editor-content",
|
|
13073
|
+
addLinkButton: "neeto-editor-fixed-menu-link-option",
|
|
13074
|
+
addLinkTextField: "neeto-editor-add-link-text-input",
|
|
13075
|
+
addURLTextField: "neeto-editor-add-link-url-input",
|
|
13076
|
+
submitLinkButton: "neeto-editor-add-link",
|
|
13052
13077
|
};
|
|
13053
13078
|
|
|
13054
13079
|
const NEETO_FILTERS_SELECTORS = {
|
|
@@ -146075,6 +146100,32 @@ const initializeTotp = ({ issuer, secret, }) => {
|
|
|
146075
146100
|
});
|
|
146076
146101
|
};
|
|
146077
146102
|
|
|
146103
|
+
// Util to throttle network via CDP (only available for chrome)
|
|
146104
|
+
// Based on https://github.com/microsoft/playwright/issues/6038#issuecomment-812521882
|
|
146105
|
+
// Feature request issue: https://github.com/microsoft/playwright/issues/8622
|
|
146106
|
+
const networkThrottlingUsingCDP = ({ cdpSession, emulateNetworkConditionsParameters = networkConditions["Fast 3G"], }) => cdpSession.send("Network.emulateNetworkConditions", emulateNetworkConditionsParameters);
|
|
146107
|
+
// Util to throttle CPU via CDP (only available for chrome)
|
|
146108
|
+
// Throttling rate as a slowdown factor
|
|
146109
|
+
// Default value is 1.25; means it will slow down CPU by 1.25 times
|
|
146110
|
+
const cpuThrottlingUsingCDP = ({ cdpSession, rate = 1.25, }) => cdpSession.send("Emulation.setCPUThrottlingRate", { rate });
|
|
146111
|
+
const executeWithThrottledResources = async ({ code: emulatedCode, kind = "both", networkCondition, cpuThrottlingRate, cdpSession, }) => {
|
|
146112
|
+
if (kind === "network" || kind === "both") {
|
|
146113
|
+
await networkThrottlingUsingCDP({
|
|
146114
|
+
cdpSession,
|
|
146115
|
+
emulateNetworkConditionsParameters: networkCondition,
|
|
146116
|
+
});
|
|
146117
|
+
}
|
|
146118
|
+
else if (kind === "cpu" || kind === "both") {
|
|
146119
|
+
await cpuThrottlingUsingCDP({ cdpSession, rate: cpuThrottlingRate });
|
|
146120
|
+
}
|
|
146121
|
+
await emulatedCode();
|
|
146122
|
+
await networkThrottlingUsingCDP({
|
|
146123
|
+
cdpSession,
|
|
146124
|
+
emulateNetworkConditionsParameters: networkConditions["No Throttling"],
|
|
146125
|
+
});
|
|
146126
|
+
await cpuThrottlingUsingCDP({ cdpSession, rate: 1 });
|
|
146127
|
+
};
|
|
146128
|
+
|
|
146078
146129
|
var main$2 = {exports: {}};
|
|
146079
146130
|
|
|
146080
146131
|
var name = "dotenv";
|
|
@@ -146658,8 +146709,10 @@ exports.USER_AGENTS = USER_AGENTS;
|
|
|
146658
146709
|
exports.WebhooksPage = WebhooksPage;
|
|
146659
146710
|
exports.clearCredentials = clearCredentials;
|
|
146660
146711
|
exports.commands = commands;
|
|
146712
|
+
exports.cpuThrottlingUsingCDP = cpuThrottlingUsingCDP;
|
|
146661
146713
|
exports.decodeQRCodeFromFile = decodeQRCodeFromFile;
|
|
146662
146714
|
exports.definePlaywrightConfig = definePlaywrightConfig;
|
|
146715
|
+
exports.executeWithThrottledResources = executeWithThrottledResources;
|
|
146663
146716
|
exports.extractSubdomainFromError = extractSubdomainFromError;
|
|
146664
146717
|
exports.generateStagingData = generateStagingData;
|
|
146665
146718
|
exports.getGlobalUserState = getGlobalUserState;
|
|
@@ -146673,6 +146726,8 @@ exports.joinString = joinString;
|
|
|
146673
146726
|
exports.login = login;
|
|
146674
146727
|
exports.loginWithoutSSO = loginWithoutSSO;
|
|
146675
146728
|
exports.memberUtils = memberUtils;
|
|
146729
|
+
exports.networkConditions = networkConditions;
|
|
146730
|
+
exports.networkThrottlingUsingCDP = networkThrottlingUsingCDP;
|
|
146676
146731
|
exports.readFileSyncIfExists = readFileSyncIfExists;
|
|
146677
146732
|
exports.removeCredentialFile = removeCredentialFile;
|
|
146678
146733
|
exports.shouldSkipSetupAndTeardown = shouldSkipSetupAndTeardown;
|