@bigbinary/neeto-playwright-commons 1.8.31 → 1.8.32
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 +51 -0
- package/index.cjs.js.map +1 -1
- package/index.d.ts +25 -2
- package/index.js +48 -1
- package/index.js.map +1 -1
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import * as _playwright_test from '@playwright/test';
|
|
2
|
-
import { Page, APIRequestContext, Response, APIResponse, Fixtures, PlaywrightWorkerArgs, PlaywrightWorkerOptions, PlaywrightTestArgs, PlaywrightTestOptions, Browser, Locator, FrameLocator, BrowserContext } from '@playwright/test';
|
|
2
|
+
import { Page, APIRequestContext, Response, APIResponse, Fixtures, PlaywrightWorkerArgs, PlaywrightWorkerOptions, PlaywrightTestArgs, PlaywrightTestOptions, Browser, Locator, FrameLocator, BrowserContext, CDPSession } from '@playwright/test';
|
|
3
3
|
import MailosaurClient from 'mailosaur';
|
|
4
4
|
import { I18nPlaywrightFixture } from 'playwright-i18next-fixture';
|
|
5
5
|
import { TFunction } from 'i18next';
|
|
6
|
+
import { Protocol } from 'playwright-core/types/protocol';
|
|
6
7
|
import * as playwright_core from 'playwright-core';
|
|
7
8
|
import { Secret, TOTP } from 'otpauth';
|
|
8
9
|
|
|
@@ -316,6 +317,8 @@ declare const THIRD_PARTY_ROUTES: {
|
|
|
316
317
|
};
|
|
317
318
|
};
|
|
318
319
|
|
|
320
|
+
declare const networkConditions: Record<"Slow 3G" | "Fast 3G" | "No Throttling", Protocol.Network.emulateNetworkConditionsParameters>;
|
|
321
|
+
|
|
319
322
|
declare const COMMON_SELECTORS: {
|
|
320
323
|
spinner: string;
|
|
321
324
|
subheaderText: string;
|
|
@@ -715,6 +718,26 @@ declare const initializeTotp: ({ issuer, secret, }: {
|
|
|
715
718
|
secret: string | Secret;
|
|
716
719
|
}) => TOTP;
|
|
717
720
|
|
|
721
|
+
type EmulateNetworkConditionsParameters = Protocol.Network.emulateNetworkConditionsParameters;
|
|
722
|
+
type NetworkThrottlingUsingCdpParams = {
|
|
723
|
+
cdpSession: CDPSession;
|
|
724
|
+
emulateNetworkConditionsParameters?: EmulateNetworkConditionsParameters;
|
|
725
|
+
};
|
|
726
|
+
declare const networkThrottlingUsingCDP: ({ cdpSession, emulateNetworkConditionsParameters, }: NetworkThrottlingUsingCdpParams) => Promise<Protocol.Network.emulateNetworkConditionsReturnValue>;
|
|
727
|
+
type CpuThrottlingUsingCdpParams = {
|
|
728
|
+
cdpSession: CDPSession;
|
|
729
|
+
rate?: number;
|
|
730
|
+
};
|
|
731
|
+
declare const cpuThrottlingUsingCDP: ({ cdpSession, rate, }: CpuThrottlingUsingCdpParams) => Promise<Protocol.Emulation.setCPUThrottlingRateReturnValue>;
|
|
732
|
+
interface ExecuteWithThrottledResourcesParams {
|
|
733
|
+
kind?: "both" | "network" | "cpu";
|
|
734
|
+
code: () => Promise<void>;
|
|
735
|
+
networkCondition?: EmulateNetworkConditionsParameters;
|
|
736
|
+
cpuThrottlingRate?: number;
|
|
737
|
+
cdpSession: CDPSession;
|
|
738
|
+
}
|
|
739
|
+
declare const executeWithThrottledResources: ({ code: emulatedCode, kind, networkCondition, cpuThrottlingRate, cdpSession, }: ExecuteWithThrottledResourcesParams) => Promise<void>;
|
|
740
|
+
|
|
718
741
|
interface CurrentsOverrides {
|
|
719
742
|
projectId: string;
|
|
720
743
|
}
|
|
@@ -727,4 +750,4 @@ interface Overrides {
|
|
|
727
750
|
}
|
|
728
751
|
declare const definePlaywrightConfig: (overrides: Overrides) => _playwright_test.PlaywrightTestConfig<{}, {}>;
|
|
729
752
|
|
|
730
|
-
export { API_ROUTES, BASE_URL, CHANGELOG_WIDGET_SELECTORS, CHAT_WIDGET_SELECTORS, CHAT_WIDGET_TEXTS, COMMON_SELECTORS, CREDENTIALS, CustomCommands, type CustomFixture, ENVIRONMENT, GLOBAL_TRANSLATIONS_PATTERN, HELP_CENTER_SELECTORS, HelpAndProfilePage, INTEGRATIONS_TEXTS, INTEGRATION_SELECTORS, IS_STAGING_ENV, IntegrationBase, KEYBOARD_SHORTCUTS_SELECTORS, LOGIN_SELECTORS, MEMBER_FORM_SELECTORS, MEMBER_SELECTORS, MEMBER_TEXTS, MERGE_TAGS_SELECTORS, MailosaurUtils, NEETO_AUTH_BASE_URL, NEETO_EDITOR_SELECTORS, NEETO_FILTERS_SELECTORS, OTP_EMAIL_PATTERN, OrganizationPage, PROFILE_SECTION_SELECTORS, PROJECT_TRANSLATIONS_PATH, ROLES_SELECTORS, ROUTES, SIGNUP_SELECTORS, SLACK_DEFAULT_CHANNEL, SLACK_SELECTORS, SLACK_WEB_TEXTS, STORAGE_STATE, SlackPage, TAGS_SELECTORS, THIRD_PARTY_ROUTES, USER_AGENTS, WebhooksPage, clearCredentials, commands, decodeQRCodeFromFile, definePlaywrightConfig, extractSubdomainFromError, generateStagingData, getGlobalUserState, headerUtils, hyphenize, i18nFixture, initializeCredentials, initializeTotp, joinHyphenCase, joinString, login, loginWithoutSSO, memberUtils, readFileSyncIfExists, removeCredentialFile, shouldSkipSetupAndTeardown, skipTest, squish, _default as stealthTest, tableUtils, updateCredentials, writeDataToFile };
|
|
753
|
+
export { API_ROUTES, BASE_URL, CHANGELOG_WIDGET_SELECTORS, CHAT_WIDGET_SELECTORS, CHAT_WIDGET_TEXTS, COMMON_SELECTORS, CREDENTIALS, CustomCommands, type CustomFixture, ENVIRONMENT, GLOBAL_TRANSLATIONS_PATTERN, HELP_CENTER_SELECTORS, HelpAndProfilePage, INTEGRATIONS_TEXTS, INTEGRATION_SELECTORS, IS_STAGING_ENV, IntegrationBase, KEYBOARD_SHORTCUTS_SELECTORS, LOGIN_SELECTORS, MEMBER_FORM_SELECTORS, MEMBER_SELECTORS, MEMBER_TEXTS, MERGE_TAGS_SELECTORS, MailosaurUtils, NEETO_AUTH_BASE_URL, NEETO_EDITOR_SELECTORS, NEETO_FILTERS_SELECTORS, OTP_EMAIL_PATTERN, OrganizationPage, PROFILE_SECTION_SELECTORS, PROJECT_TRANSLATIONS_PATH, ROLES_SELECTORS, ROUTES, SIGNUP_SELECTORS, SLACK_DEFAULT_CHANNEL, SLACK_SELECTORS, SLACK_WEB_TEXTS, STORAGE_STATE, SlackPage, TAGS_SELECTORS, THIRD_PARTY_ROUTES, USER_AGENTS, WebhooksPage, clearCredentials, commands, cpuThrottlingUsingCDP, decodeQRCodeFromFile, definePlaywrightConfig, executeWithThrottledResources, extractSubdomainFromError, generateStagingData, getGlobalUserState, headerUtils, hyphenize, i18nFixture, initializeCredentials, initializeTotp, joinHyphenCase, joinString, login, loginWithoutSSO, memberUtils, networkConditions, networkThrottlingUsingCDP, readFileSyncIfExists, removeCredentialFile, shouldSkipSetupAndTeardown, skipTest, squish, _default as stealthTest, tableUtils, updateCredentials, writeDataToFile };
|
package/index.js
CHANGED
|
@@ -12985,6 +12985,27 @@ const USER_AGENTS = {
|
|
|
12985
12985
|
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",
|
|
12986
12986
|
};
|
|
12987
12987
|
|
|
12988
|
+
const networkConditions = {
|
|
12989
|
+
"Slow 3G": {
|
|
12990
|
+
downloadThroughput: ((500 * 1000) / 8) * 0.8,
|
|
12991
|
+
uploadThroughput: ((500 * 1000) / 8) * 0.8,
|
|
12992
|
+
latency: 400 * 5,
|
|
12993
|
+
offline: false,
|
|
12994
|
+
},
|
|
12995
|
+
"Fast 3G": {
|
|
12996
|
+
downloadThroughput: ((1.6 * 1000 * 1000) / 8) * 0.9,
|
|
12997
|
+
uploadThroughput: ((750 * 1000) / 8) * 0.9,
|
|
12998
|
+
latency: 150 * 3.75,
|
|
12999
|
+
offline: false,
|
|
13000
|
+
},
|
|
13001
|
+
"No Throttling": {
|
|
13002
|
+
downloadThroughput: -1,
|
|
13003
|
+
uploadThroughput: -1,
|
|
13004
|
+
latency: 0,
|
|
13005
|
+
offline: false,
|
|
13006
|
+
},
|
|
13007
|
+
};
|
|
13008
|
+
|
|
12988
13009
|
const NEETO_EDITOR_SELECTORS = {
|
|
12989
13010
|
boldOption: "neeto-editor-fixed-menu-bold-option",
|
|
12990
13011
|
italicOption: "neeto-editor-fixed-menu-italic-option",
|
|
@@ -146029,6 +146050,32 @@ const initializeTotp = ({ issuer, secret, }) => {
|
|
|
146029
146050
|
});
|
|
146030
146051
|
};
|
|
146031
146052
|
|
|
146053
|
+
// Util to throttle network via CDP (only available for chrome)
|
|
146054
|
+
// Based on https://github.com/microsoft/playwright/issues/6038#issuecomment-812521882
|
|
146055
|
+
// Feature request issue: https://github.com/microsoft/playwright/issues/8622
|
|
146056
|
+
const networkThrottlingUsingCDP = ({ cdpSession, emulateNetworkConditionsParameters = networkConditions["Fast 3G"], }) => cdpSession.send("Network.emulateNetworkConditions", emulateNetworkConditionsParameters);
|
|
146057
|
+
// Util to throttle CPU via CDP (only available for chrome)
|
|
146058
|
+
// Throttling rate as a slowdown factor
|
|
146059
|
+
// Default value is 1.25; means it will slow down CPU by 1.25 times
|
|
146060
|
+
const cpuThrottlingUsingCDP = ({ cdpSession, rate = 1.25, }) => cdpSession.send("Emulation.setCPUThrottlingRate", { rate });
|
|
146061
|
+
const executeWithThrottledResources = async ({ code: emulatedCode, kind = "both", networkCondition, cpuThrottlingRate, cdpSession, }) => {
|
|
146062
|
+
if (kind === "network" || kind === "both") {
|
|
146063
|
+
await networkThrottlingUsingCDP({
|
|
146064
|
+
cdpSession,
|
|
146065
|
+
emulateNetworkConditionsParameters: networkCondition,
|
|
146066
|
+
});
|
|
146067
|
+
}
|
|
146068
|
+
else if (kind === "cpu" || kind === "both") {
|
|
146069
|
+
await cpuThrottlingUsingCDP({ cdpSession, rate: cpuThrottlingRate });
|
|
146070
|
+
}
|
|
146071
|
+
await emulatedCode();
|
|
146072
|
+
await networkThrottlingUsingCDP({
|
|
146073
|
+
cdpSession,
|
|
146074
|
+
emulateNetworkConditionsParameters: networkConditions["No Throttling"],
|
|
146075
|
+
});
|
|
146076
|
+
await cpuThrottlingUsingCDP({ cdpSession, rate: 1 });
|
|
146077
|
+
};
|
|
146078
|
+
|
|
146032
146079
|
var main$2 = {exports: {}};
|
|
146033
146080
|
|
|
146034
146081
|
var name = "dotenv";
|
|
@@ -146568,5 +146615,5 @@ const definePlaywrightConfig = (overrides) => {
|
|
|
146568
146615
|
});
|
|
146569
146616
|
};
|
|
146570
146617
|
|
|
146571
|
-
export { API_ROUTES, BASE_URL, CHANGELOG_WIDGET_SELECTORS, CHAT_WIDGET_SELECTORS, CHAT_WIDGET_TEXTS, COMMON_SELECTORS, CREDENTIALS, CustomCommands, ENVIRONMENT, GLOBAL_TRANSLATIONS_PATTERN, HELP_CENTER_SELECTORS, HelpAndProfilePage, INTEGRATIONS_TEXTS, INTEGRATION_SELECTORS, IS_STAGING_ENV, IntegrationBase, KEYBOARD_SHORTCUTS_SELECTORS, LOGIN_SELECTORS, MEMBER_FORM_SELECTORS, MEMBER_SELECTORS, MEMBER_TEXTS, MERGE_TAGS_SELECTORS, MailosaurUtils, NEETO_AUTH_BASE_URL, NEETO_EDITOR_SELECTORS, NEETO_FILTERS_SELECTORS, OTP_EMAIL_PATTERN, OrganizationPage, PROFILE_SECTION_SELECTORS, PROJECT_TRANSLATIONS_PATH, ROLES_SELECTORS, ROUTES, SIGNUP_SELECTORS, SLACK_DEFAULT_CHANNEL, SLACK_SELECTORS, SLACK_WEB_TEXTS, STORAGE_STATE, SlackPage, TAGS_SELECTORS, THIRD_PARTY_ROUTES, USER_AGENTS, WebhooksPage, clearCredentials, commands, decodeQRCodeFromFile, definePlaywrightConfig, extractSubdomainFromError, generateStagingData, getGlobalUserState, headerUtils, hyphenize, i18nFixture, initializeCredentials, initializeTotp, joinHyphenCase, joinString, login, loginWithoutSSO, memberUtils, readFileSyncIfExists, removeCredentialFile, shouldSkipSetupAndTeardown, skipTest, squish, stealth as stealthTest, tableUtils, updateCredentials, writeDataToFile };
|
|
146618
|
+
export { API_ROUTES, BASE_URL, CHANGELOG_WIDGET_SELECTORS, CHAT_WIDGET_SELECTORS, CHAT_WIDGET_TEXTS, COMMON_SELECTORS, CREDENTIALS, CustomCommands, ENVIRONMENT, GLOBAL_TRANSLATIONS_PATTERN, HELP_CENTER_SELECTORS, HelpAndProfilePage, INTEGRATIONS_TEXTS, INTEGRATION_SELECTORS, IS_STAGING_ENV, IntegrationBase, KEYBOARD_SHORTCUTS_SELECTORS, LOGIN_SELECTORS, MEMBER_FORM_SELECTORS, MEMBER_SELECTORS, MEMBER_TEXTS, MERGE_TAGS_SELECTORS, MailosaurUtils, NEETO_AUTH_BASE_URL, NEETO_EDITOR_SELECTORS, NEETO_FILTERS_SELECTORS, OTP_EMAIL_PATTERN, OrganizationPage, PROFILE_SECTION_SELECTORS, PROJECT_TRANSLATIONS_PATH, ROLES_SELECTORS, ROUTES, SIGNUP_SELECTORS, SLACK_DEFAULT_CHANNEL, SLACK_SELECTORS, SLACK_WEB_TEXTS, STORAGE_STATE, SlackPage, TAGS_SELECTORS, THIRD_PARTY_ROUTES, USER_AGENTS, WebhooksPage, clearCredentials, commands, cpuThrottlingUsingCDP, decodeQRCodeFromFile, definePlaywrightConfig, executeWithThrottledResources, extractSubdomainFromError, generateStagingData, getGlobalUserState, headerUtils, hyphenize, i18nFixture, initializeCredentials, initializeTotp, joinHyphenCase, joinString, login, loginWithoutSSO, memberUtils, networkConditions, networkThrottlingUsingCDP, readFileSyncIfExists, removeCredentialFile, shouldSkipSetupAndTeardown, skipTest, squish, stealth as stealthTest, tableUtils, updateCredentials, writeDataToFile };
|
|
146572
146619
|
//# sourceMappingURL=index.js.map
|