@bigbinary/neeto-playwright-commons 3.1.5 → 3.2.0

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.js CHANGED
@@ -5188,9 +5188,7 @@ const skipTest = {
5188
5188
  forAllExceptStagingEnv: () => test.skip(process.env.TEST_ENV !== ENVIRONMENT.staging),
5189
5189
  forNonNightlyRun: () => {
5190
5190
  const currentBranch = execCommand("git rev-parse --abbrev-ref HEAD");
5191
- const isNightlyRun = currentBranch === "main" &&
5192
- IS_STAGING_ENV &&
5193
- IS_CI;
5191
+ const isNightlyRun = currentBranch === "main" && IS_STAGING_ENV && IS_CI;
5194
5192
  return test.skip(not(isNightlyRun), "Run test only in playwright-nightly");
5195
5193
  },
5196
5194
  ifNotWithinAllowedNightlyHours: ({ reason, allowedNightlyRunHours = [0, 6, 12, 18], }) => {
@@ -5254,18 +5252,25 @@ const createTextareaAndEvaluateCopiedText = async (page) => {
5254
5252
  }
5255
5253
  };
5256
5254
  const getClipboardContent = async (page) => {
5257
- // Attempt 1: Native Clipboard API
5258
- const clipboardText = await page.evaluate(async () => {
5259
- if (!navigator.clipboard?.readText)
5260
- return null;
5261
- return await navigator.clipboard.readText();
5262
- });
5263
- if (isNotNil(clipboardText))
5264
- return clipboardText;
5255
+ const isWebkit = page.context().browser()?.browserType().name() === "webkit";
5256
+ if (!isWebkit) {
5257
+ // Attempt 1: Native Clipboard API
5258
+ const clipboardText = await page.evaluate(async () => {
5259
+ if (!navigator.clipboard?.readText)
5260
+ return null;
5261
+ return await navigator.clipboard.readText();
5262
+ });
5263
+ if (isNotNil(clipboardText))
5264
+ return clipboardText;
5265
+ }
5265
5266
  // Attempt 2: Keyboard paste fallback
5266
5267
  return createTextareaAndEvaluateCopiedText(page);
5267
5268
  };
5268
- const grantClipboardPermissions = (context) => context.grantPermissions(["clipboard-read", "clipboard-write"]);
5269
+ const grantClipboardPermissions = async (context) => {
5270
+ if (context.browser()?.browserType().name() === "webkit")
5271
+ return;
5272
+ await context.grantPermissions(["clipboard-read", "clipboard-write"]);
5273
+ };
5269
5274
  const getFullUrl = (path) => shouldSkipCustomDomainSetup() ? path : `${process.env.BASE_URL}${path}`;
5270
5275
  const globalShortcuts = (t) => [
5271
5276
  {