@bigbinary/neeto-playwright-commons 3.1.5 → 3.1.6

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
@@ -5209,9 +5209,7 @@ const skipTest = {
5209
5209
  forAllExceptStagingEnv: () => test.skip(process.env.TEST_ENV !== ENVIRONMENT.staging),
5210
5210
  forNonNightlyRun: () => {
5211
5211
  const currentBranch = execCommand("git rev-parse --abbrev-ref HEAD");
5212
- const isNightlyRun = currentBranch === "main" &&
5213
- IS_STAGING_ENV &&
5214
- IS_CI;
5212
+ const isNightlyRun = currentBranch === "main" && IS_STAGING_ENV && IS_CI;
5215
5213
  return test.skip(ramda.not(isNightlyRun), "Run test only in playwright-nightly");
5216
5214
  },
5217
5215
  ifNotWithinAllowedNightlyHours: ({ reason, allowedNightlyRunHours = [0, 6, 12, 18], }) => {
@@ -5275,18 +5273,25 @@ const createTextareaAndEvaluateCopiedText = async (page) => {
5275
5273
  }
5276
5274
  };
5277
5275
  const getClipboardContent = async (page) => {
5278
- // Attempt 1: Native Clipboard API
5279
- const clipboardText = await page.evaluate(async () => {
5280
- if (!navigator.clipboard?.readText)
5281
- return null;
5282
- return await navigator.clipboard.readText();
5283
- });
5284
- if (ramda.isNotNil(clipboardText))
5285
- return clipboardText;
5276
+ const isWebkit = page.context().browser()?.browserType().name() === "webkit";
5277
+ if (!isWebkit) {
5278
+ // Attempt 1: Native Clipboard API
5279
+ const clipboardText = await page.evaluate(async () => {
5280
+ if (!navigator.clipboard?.readText)
5281
+ return null;
5282
+ return await navigator.clipboard.readText();
5283
+ });
5284
+ if (ramda.isNotNil(clipboardText))
5285
+ return clipboardText;
5286
+ }
5286
5287
  // Attempt 2: Keyboard paste fallback
5287
5288
  return createTextareaAndEvaluateCopiedText(page);
5288
5289
  };
5289
- const grantClipboardPermissions = (context) => context.grantPermissions(["clipboard-read", "clipboard-write"]);
5290
+ const grantClipboardPermissions = async (context) => {
5291
+ if (context.browser()?.browserType().name() === "webkit")
5292
+ return;
5293
+ await context.grantPermissions(["clipboard-read", "clipboard-write"]);
5294
+ };
5290
5295
  const getFullUrl = (path) => shouldSkipCustomDomainSetup() ? path : `${process.env.BASE_URL}${path}`;
5291
5296
  const globalShortcuts = (t) => [
5292
5297
  {