@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.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;
|
|
@@ -397,6 +400,10 @@ declare const NEETO_EDITOR_SELECTORS: {
|
|
|
397
400
|
redoOption: string;
|
|
398
401
|
imageWrapper: string;
|
|
399
402
|
contentField: string;
|
|
403
|
+
addLinkButton: string;
|
|
404
|
+
addLinkTextField: string;
|
|
405
|
+
addURLTextField: string;
|
|
406
|
+
submitLinkButton: string;
|
|
400
407
|
};
|
|
401
408
|
|
|
402
409
|
declare const NEETO_FILTERS_SELECTORS: {
|
|
@@ -715,6 +722,26 @@ declare const initializeTotp: ({ issuer, secret, }: {
|
|
|
715
722
|
secret: string | Secret;
|
|
716
723
|
}) => TOTP;
|
|
717
724
|
|
|
725
|
+
type EmulateNetworkConditionsParameters = Protocol.Network.emulateNetworkConditionsParameters;
|
|
726
|
+
type NetworkThrottlingUsingCdpParams = {
|
|
727
|
+
cdpSession: CDPSession;
|
|
728
|
+
emulateNetworkConditionsParameters?: EmulateNetworkConditionsParameters;
|
|
729
|
+
};
|
|
730
|
+
declare const networkThrottlingUsingCDP: ({ cdpSession, emulateNetworkConditionsParameters, }: NetworkThrottlingUsingCdpParams) => Promise<Protocol.Network.emulateNetworkConditionsReturnValue>;
|
|
731
|
+
type CpuThrottlingUsingCdpParams = {
|
|
732
|
+
cdpSession: CDPSession;
|
|
733
|
+
rate?: number;
|
|
734
|
+
};
|
|
735
|
+
declare const cpuThrottlingUsingCDP: ({ cdpSession, rate, }: CpuThrottlingUsingCdpParams) => Promise<Protocol.Emulation.setCPUThrottlingRateReturnValue>;
|
|
736
|
+
interface ExecuteWithThrottledResourcesParams {
|
|
737
|
+
kind?: "both" | "network" | "cpu";
|
|
738
|
+
code: () => Promise<void>;
|
|
739
|
+
networkCondition?: EmulateNetworkConditionsParameters;
|
|
740
|
+
cpuThrottlingRate?: number;
|
|
741
|
+
cdpSession: CDPSession;
|
|
742
|
+
}
|
|
743
|
+
declare const executeWithThrottledResources: ({ code: emulatedCode, kind, networkCondition, cpuThrottlingRate, cdpSession, }: ExecuteWithThrottledResourcesParams) => Promise<void>;
|
|
744
|
+
|
|
718
745
|
interface CurrentsOverrides {
|
|
719
746
|
projectId: string;
|
|
720
747
|
}
|
|
@@ -727,4 +754,4 @@ interface Overrides {
|
|
|
727
754
|
}
|
|
728
755
|
declare const definePlaywrightConfig: (overrides: Overrides) => _playwright_test.PlaywrightTestConfig<{}, {}>;
|
|
729
756
|
|
|
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 };
|
|
757
|
+
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",
|
|
@@ -13003,6 +13024,10 @@ const NEETO_EDITOR_SELECTORS = {
|
|
|
13003
13024
|
redoOption: "neeto-editor-fixed-menu-redo-option",
|
|
13004
13025
|
imageWrapper: "neeto-editor-image-wrapper",
|
|
13005
13026
|
contentField: "neeto-editor-content",
|
|
13027
|
+
addLinkButton: "neeto-editor-fixed-menu-link-option",
|
|
13028
|
+
addLinkTextField: "neeto-editor-add-link-text-input",
|
|
13029
|
+
addURLTextField: "neeto-editor-add-link-url-input",
|
|
13030
|
+
submitLinkButton: "neeto-editor-add-link",
|
|
13006
13031
|
};
|
|
13007
13032
|
|
|
13008
13033
|
const NEETO_FILTERS_SELECTORS = {
|
|
@@ -146029,6 +146054,32 @@ const initializeTotp = ({ issuer, secret, }) => {
|
|
|
146029
146054
|
});
|
|
146030
146055
|
};
|
|
146031
146056
|
|
|
146057
|
+
// Util to throttle network via CDP (only available for chrome)
|
|
146058
|
+
// Based on https://github.com/microsoft/playwright/issues/6038#issuecomment-812521882
|
|
146059
|
+
// Feature request issue: https://github.com/microsoft/playwright/issues/8622
|
|
146060
|
+
const networkThrottlingUsingCDP = ({ cdpSession, emulateNetworkConditionsParameters = networkConditions["Fast 3G"], }) => cdpSession.send("Network.emulateNetworkConditions", emulateNetworkConditionsParameters);
|
|
146061
|
+
// Util to throttle CPU via CDP (only available for chrome)
|
|
146062
|
+
// Throttling rate as a slowdown factor
|
|
146063
|
+
// Default value is 1.25; means it will slow down CPU by 1.25 times
|
|
146064
|
+
const cpuThrottlingUsingCDP = ({ cdpSession, rate = 1.25, }) => cdpSession.send("Emulation.setCPUThrottlingRate", { rate });
|
|
146065
|
+
const executeWithThrottledResources = async ({ code: emulatedCode, kind = "both", networkCondition, cpuThrottlingRate, cdpSession, }) => {
|
|
146066
|
+
if (kind === "network" || kind === "both") {
|
|
146067
|
+
await networkThrottlingUsingCDP({
|
|
146068
|
+
cdpSession,
|
|
146069
|
+
emulateNetworkConditionsParameters: networkCondition,
|
|
146070
|
+
});
|
|
146071
|
+
}
|
|
146072
|
+
else if (kind === "cpu" || kind === "both") {
|
|
146073
|
+
await cpuThrottlingUsingCDP({ cdpSession, rate: cpuThrottlingRate });
|
|
146074
|
+
}
|
|
146075
|
+
await emulatedCode();
|
|
146076
|
+
await networkThrottlingUsingCDP({
|
|
146077
|
+
cdpSession,
|
|
146078
|
+
emulateNetworkConditionsParameters: networkConditions["No Throttling"],
|
|
146079
|
+
});
|
|
146080
|
+
await cpuThrottlingUsingCDP({ cdpSession, rate: 1 });
|
|
146081
|
+
};
|
|
146082
|
+
|
|
146032
146083
|
var main$2 = {exports: {}};
|
|
146033
146084
|
|
|
146034
146085
|
var name = "dotenv";
|
|
@@ -146568,5 +146619,5 @@ const definePlaywrightConfig = (overrides) => {
|
|
|
146568
146619
|
});
|
|
146569
146620
|
};
|
|
146570
146621
|
|
|
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 };
|
|
146622
|
+
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
146623
|
//# sourceMappingURL=index.js.map
|