@bigbinary/neeto-playwright-commons 3.0.2 → 3.0.4

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 CHANGED
@@ -145,6 +145,99 @@ const HELP_CENTER_ROUTES = {
145
145
  kbDocs: (product) => `https://help.neeto${product.toLowerCase()}.com/`,
146
146
  changelog: (product) => `https://neeto${product.toLowerCase()}help.neetoengage.net/changelogs`,
147
147
  };
148
+ const ANALYTICS_RESOURCES = [
149
+ "**/analytics/**",
150
+ "**/mixpanel/**",
151
+ "**/static.cloudflareinsights.com/**",
152
+ ];
153
+ const FONTS_RESOURCES = [
154
+ "**/fonts.googleapis.com/**",
155
+ "**/fonts.gstatic.com/**",
156
+ "**/api.fontshare.com/**",
157
+ ];
158
+ const THIRD_PARTY_RESOURCES = [
159
+ ...ANALYTICS_RESOURCES,
160
+ // Advertising networks
161
+ "**amazon-adsystem.com/**",
162
+ "**paa-reporting-advertising.amazon/**",
163
+ "**adsrvr.org/**",
164
+ "**adnxs.com/**",
165
+ "**doubleclick.net/**",
166
+ "**googlesyndication.com/**",
167
+ "**googletagmanager.com/**",
168
+ "**bat.bing.com/**",
169
+ "**connect.facebook.net/**",
170
+ "**facebook.com/**",
171
+ "**ads.linkedin.com/**",
172
+ "**snap.licdn.com/**",
173
+ "**linkedin.com/**",
174
+ "**analytics.tiktok.com/**",
175
+ "**tiktokw.us/**",
176
+ "**alb.reddit.com/**",
177
+ "**redditstatic.com/**",
178
+ "**pixel-config.reddit.com/**",
179
+ "**bidswitch.net/**",
180
+ "**casalemedia.com/**",
181
+ "**pubmatic.com/**",
182
+ "**rubiconproject.com/**",
183
+ "**podscribe.com/**",
184
+ "**trkn.us/**",
185
+ "**usbrowserspeed.com/**",
186
+ // Analytics & tracking
187
+ "**amplitude.com/**",
188
+ "**segment.com/**",
189
+ "**clearbitjs.com/**",
190
+ "**clearbitscripts.com/**",
191
+ "**clearbit.com/**",
192
+ "**builder.io/**",
193
+ "**influ2.com/**",
194
+ "**axiom-vitals.com/**",
195
+ "**qualtrics.com/**",
196
+ // HubSpot
197
+ "**hubspot.com/**",
198
+ "**hs-scripts.com/**",
199
+ "**hs-analytics.net/**",
200
+ "**hsadspixel.net/**",
201
+ "**hs-banner.com/**",
202
+ "**hsforms.com/**",
203
+ "**hubapi.com/**",
204
+ // Monitoring & error tracking
205
+ "**sentry.io/**",
206
+ "**bugsnag.com/**",
207
+ "**datadoghq.com/**",
208
+ "**datadoghq-browser-agent.com/**",
209
+ "**fullstory.com/**",
210
+ // Chat & support widgets
211
+ "**intercom.io/**",
212
+ "**intercomcdn.com/**",
213
+ "**ada.support/**",
214
+ // Product research & feature flags
215
+ "**sprig.com/**",
216
+ "**split.io/**",
217
+ // Cookie consent
218
+ "**cookielaw.org/**",
219
+ "**onetrust.com/**",
220
+ // Zapier layout & marketing (non-functional)
221
+ "**cdn.zapier.com/**",
222
+ "**design-system-bff.zapier.com/**",
223
+ // Realtime messaging
224
+ "**ably.net/**",
225
+ // Microsoft telemetry
226
+ "**browser.events.data.microsoft.com/**",
227
+ ];
228
+ const APP_RESOURCES = [
229
+ ...ANALYTICS_RESOURCES,
230
+ ...FONTS_RESOURCES,
231
+ "**/neeto-widget**",
232
+ "**/neeto-engage-widget**",
233
+ "**.neetoreplay.net",
234
+ "**neeto-replay**.amazonaws.com/**",
235
+ "**/cdn-cgi/rum?",
236
+ "**.neetochat.net/**",
237
+ "**.neetoengage.net/**",
238
+ "**/sticky_ribbons",
239
+ "**/neeto_widget_tokens",
240
+ ];
148
241
 
149
242
  class ApiKeysApi {
150
243
  neetoPlaywrightUtilities;
@@ -5943,6 +6036,18 @@ class CustomCommands {
5943
6036
  .getAttribute("content");
5944
6037
  return this.csrfToken;
5945
6038
  };
6039
+ blockExternalResources = (page = this.page) => Promise.all(THIRD_PARTY_RESOURCES.map(pattern => page.context().route(pattern, route => route.abort())));
6040
+ blockInternalResources = (page = this.page) => Promise.all(APP_RESOURCES.map(pattern => page.context().route(pattern, route => route.abort())));
6041
+ blockNonEssentialResourceTypes = (page = this.page) => page
6042
+ .context()
6043
+ .route("**/*", route => ["image", "stylesheet", "font", "media"].includes(route.request().resourceType())
6044
+ ? route.abort()
6045
+ : route.continue());
6046
+ blockAllResources = (page = this.page) => Promise.all([
6047
+ this.blockExternalResources(page),
6048
+ this.blockInternalResources(page),
6049
+ this.blockNonEssentialResourceTypes(page),
6050
+ ]);
5946
6051
  waitForFloatingMenu = () => test.expect(this.page.getByTestId(COMMON_SELECTORS.floatingActionMenuButton)).toBeVisible({ timeout: 25_000 });
5947
6052
  interceptMultipleResponses = ({ responseUrl = "", responseStatus = 200, times = 1, baseUrl, customPageContext = this.page, timeout = 35_000, } = {}) => Promise.all([...new Array(times)].map(() => customPageContext.waitForResponse((response) => {
5948
6053
  if (response.request().resourceType() === "xhr" &&
@@ -8726,6 +8831,7 @@ class OrganizationPage {
8726
8831
  await fillCredentialsAndSubmit({ page: this.page, email });
8727
8832
  return;
8728
8833
  }
8834
+ await this.neetoPlaywrightUtilities.blockInternalResources();
8729
8835
  await this.fillEmailAndSubmit(email, loginTimeout);
8730
8836
  await this.fillOTP();
8731
8837
  await this.dismissAuthenticatorSetupPromptIfPresent();
@@ -8791,6 +8897,7 @@ class OrganizationPage {
8791
8897
  }
8792
8898
  else {
8793
8899
  let otp = "123456";
8900
+ await this.neetoPlaywrightUtilities.blockInternalResources();
8794
8901
  await this.page.goto(`${ROUTES.neetoAuthSignup}?redirect_uri=${credentials.domain}`, { timeout: 20_000 });
8795
8902
  await this.submitEmail(credentials.email);
8796
8903
  if (fetchOtpFromEmail !== undefined) {
@@ -125833,10 +125940,8 @@ const compilePatterns = (patternStrings) => patternStrings.flatMap((pattern, ind
125833
125940
  const parseSpecPatterns = () => {
125834
125941
  let parsed;
125835
125942
  const raw = process.env.PLAYWRIGHT_SPEC_PATTERNS_JSON?.trim();
125836
- if (!raw) {
125837
- logInfo("PLAYWRIGHT_SPEC_PATTERNS_JSON missing; using default test discovery.");
125943
+ if (neetoCist.isNotPresent(raw))
125838
125944
  return undefined;
125839
- }
125840
125945
  logInfo(`PLAYWRIGHT_SPEC_PATTERNS_JSON received: ${raw}`);
125841
125946
  try {
125842
125947
  parsed = JSON.parse(raw);
@@ -125972,6 +126077,8 @@ const definePlaywrightConfig = (overrides) => {
125972
126077
  timeout: 5 * 60 * 1000,
125973
126078
  cwd: "..",
125974
126079
  env: { ...process.env, PORT: railsPort ?? "" },
126080
+ stdout: "ignore",
126081
+ stderr: "ignore",
125975
126082
  },
125976
126083
  {
125977
126084
  command: "yarn dev --host",
@@ -125979,6 +126086,8 @@ const definePlaywrightConfig = (overrides) => {
125979
126086
  reuseExistingServer: !IS_CI,
125980
126087
  timeout: 2 * 60 * 1000,
125981
126088
  cwd: "..",
126089
+ stdout: "ignore",
126090
+ stderr: "ignore",
125982
126091
  },
125983
126092
  ...webServerOverrides,
125984
126093
  ],
@@ -126071,8 +126180,10 @@ const definePlaywrightConfig = (overrides) => {
126071
126180
 
126072
126181
  exports.ACTIONS = ACTIONS;
126073
126182
  exports.ADMIN_PANEL_SELECTORS = ADMIN_PANEL_SELECTORS;
126183
+ exports.ANALYTICS_RESOURCES = ANALYTICS_RESOURCES;
126074
126184
  exports.API_KEYS_SELECTORS = API_KEYS_SELECTORS;
126075
126185
  exports.API_ROUTES = API_ROUTES;
126186
+ exports.APP_RESOURCES = APP_RESOURCES;
126076
126187
  exports.AUDIT_LOGS_SELECTORS = AUDIT_LOGS_SELECTORS;
126077
126188
  exports.ApiKeysApi = ApiKeysApi;
126078
126189
  exports.ApiKeysPage = ApiKeysPage;
@@ -126113,6 +126224,7 @@ exports.EditorPage = EditorPage;
126113
126224
  exports.EmailDeliveryUtils = EmailDeliveryUtils;
126114
126225
  exports.EmbedBase = EmbedBase;
126115
126226
  exports.FILE_FORMATS = FILE_FORMATS;
126227
+ exports.FONTS_RESOURCES = FONTS_RESOURCES;
126116
126228
  exports.FONT_SIZE_SELECTORS = FONT_SIZE_SELECTORS;
126117
126229
  exports.FROM_EMAIL_ENV_KEYS = FROM_EMAIL_ENV_KEYS;
126118
126230
  exports.GLOBAL_TRANSLATIONS_PATTERN = GLOBAL_TRANSLATIONS_PATTERN;
@@ -126199,6 +126311,7 @@ exports.TEXT_MODIFIER_TAGS = TEXT_MODIFIER_TAGS;
126199
126311
  exports.THANK_YOU_SELECTORS = THANK_YOU_SELECTORS;
126200
126312
  exports.THEMES_SELECTORS = THEMES_SELECTORS;
126201
126313
  exports.THEMES_TEXTS = THEMES_TEXTS;
126314
+ exports.THIRD_PARTY_RESOURCES = THIRD_PARTY_RESOURCES;
126202
126315
  exports.THIRD_PARTY_ROUTES = THIRD_PARTY_ROUTES;
126203
126316
  exports.TIME_RANGES = TIME_RANGES;
126204
126317
  exports.TOASTR_MESSAGES = TOASTR_MESSAGES;