From da601540701f7b98d1e2b4af5964d9583d422ebe Mon Sep 17 00:00:00 2001 From: shantanuk-browserstack <131665162+shantanuk-browserstack@users.noreply.github.com> Date: Wed, 18 Oct 2023 13:19:04 +0530 Subject: [PATCH 1/4] [PER-2582] Do not execute git commands when `PERCY_SKIP_GIT_CHECK` is set to True (#1400) --- packages/env/src/utils.js | 3 +++ packages/env/test/defaults.test.js | 16 ++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/packages/env/src/utils.js b/packages/env/src/utils.js index 2b99933ee..a336f011a 100644 --- a/packages/env/src/utils.js +++ b/packages/env/src/utils.js @@ -13,6 +13,9 @@ const GIT_COMMIT_FORMAT = [ ].join('%n'); // git show format uses %n for newlines. export function git(args) { + if (process.env.PERCY_SKIP_GIT_CHECK === 'true') { + return ''; + } try { return cp.execSync(`git ${args}`, { stdio: ['ignore', 'pipe', 'ignore'], diff --git a/packages/env/test/defaults.test.js b/packages/env/test/defaults.test.js index 8146f8e8f..121924cbc 100644 --- a/packages/env/test/defaults.test.js +++ b/packages/env/test/defaults.test.js @@ -171,4 +171,20 @@ describe('Defaults', () => { expect(env).toHaveProperty('git.sha', null); }); + + describe('env PERCY_SKIP_GIT_CHECK', () => { + beforeEach(() => { + process.env.PERCY_SKIP_GIT_CHECK = true; + }); + + afterAll(() => { + process.env.PERCY_SKIP_GIT_CHECK = false; + }); + + it('does not make git commands when set to true', () => { + mockgit('mock branch').and.returnValue(''); + + expect(env).toHaveProperty('git.sha', null); + }); + }); }); From d83228ad59736923285426854572f9e1f80ad48f Mon Sep 17 00:00:00 2001 From: shantanuk-browserstack <131665162+shantanuk-browserstack@users.noreply.github.com> Date: Wed, 18 Oct 2023 14:02:39 +0530 Subject: [PATCH 2/4] release v1.27.4-beta.0 (#1402) --- lerna.json | 2 +- packages/cli-app/package.json | 8 ++++---- packages/cli-build/package.json | 6 +++--- packages/cli-command/package.json | 10 +++++----- packages/cli-config/package.json | 6 +++--- packages/cli-exec/package.json | 6 +++--- packages/cli-snapshot/package.json | 6 +++--- packages/cli-upload/package.json | 6 +++--- packages/cli/package.json | 22 +++++++++++----------- packages/client/package.json | 8 ++++---- packages/config/package.json | 6 +++--- packages/core/package.json | 14 +++++++------- packages/dom/package.json | 4 ++-- packages/env/package.json | 6 +++--- packages/logger/package.json | 4 ++-- packages/sdk-utils/package.json | 4 ++-- packages/webdriver-utils/package.json | 8 ++++---- 17 files changed, 63 insertions(+), 63 deletions(-) diff --git a/lerna.json b/lerna.json index db000996c..2fcad280e 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "1.27.3", + "version": "1.27.4-beta.0", "packages": [ "packages/*" ], diff --git a/packages/cli-app/package.json b/packages/cli-app/package.json index 4510f4aee..a9f4dfd27 100644 --- a/packages/cli-app/package.json +++ b/packages/cli-app/package.json @@ -1,6 +1,6 @@ { "name": "@percy/cli-app", - "version": "1.27.3", + "version": "1.27.4-beta.0", "license": "MIT", "repository": { "type": "git", @@ -9,7 +9,7 @@ }, "publishConfig": { "access": "public", - "tag": "latest" + "tag": "beta" }, "engines": { "node": ">=14" @@ -33,7 +33,7 @@ ] }, "dependencies": { - "@percy/cli-command": "1.27.3", - "@percy/cli-exec": "1.27.3" + "@percy/cli-command": "1.27.4-beta.0", + "@percy/cli-exec": "1.27.4-beta.0" } } diff --git a/packages/cli-build/package.json b/packages/cli-build/package.json index 44cbbab90..84169c9a0 100644 --- a/packages/cli-build/package.json +++ b/packages/cli-build/package.json @@ -1,6 +1,6 @@ { "name": "@percy/cli-build", - "version": "1.27.3", + "version": "1.27.4-beta.0", "license": "MIT", "repository": { "type": "git", @@ -9,7 +9,7 @@ }, "publishConfig": { "access": "public", - "tag": "latest" + "tag": "beta" }, "engines": { "node": ">=14" @@ -33,6 +33,6 @@ ] }, "dependencies": { - "@percy/cli-command": "1.27.3" + "@percy/cli-command": "1.27.4-beta.0" } } diff --git a/packages/cli-command/package.json b/packages/cli-command/package.json index d04f26ba7..1923da449 100644 --- a/packages/cli-command/package.json +++ b/packages/cli-command/package.json @@ -1,6 +1,6 @@ { "name": "@percy/cli-command", - "version": "1.27.3", + "version": "1.27.4-beta.0", "license": "MIT", "repository": { "type": "git", @@ -9,7 +9,7 @@ }, "publishConfig": { "access": "public", - "tag": "latest" + "tag": "beta" }, "files": [ "dist", @@ -36,8 +36,8 @@ "test:coverage": "yarn test --coverage" }, "dependencies": { - "@percy/config": "1.27.3", - "@percy/core": "1.27.3", - "@percy/logger": "1.27.3" + "@percy/config": "1.27.4-beta.0", + "@percy/core": "1.27.4-beta.0", + "@percy/logger": "1.27.4-beta.0" } } diff --git a/packages/cli-config/package.json b/packages/cli-config/package.json index e0308ae2e..207739597 100644 --- a/packages/cli-config/package.json +++ b/packages/cli-config/package.json @@ -1,6 +1,6 @@ { "name": "@percy/cli-config", - "version": "1.27.3", + "version": "1.27.4-beta.0", "license": "MIT", "repository": { "type": "git", @@ -9,7 +9,7 @@ }, "publishConfig": { "access": "public", - "tag": "latest" + "tag": "beta" }, "engines": { "node": ">=14" @@ -33,6 +33,6 @@ ] }, "dependencies": { - "@percy/cli-command": "1.27.3" + "@percy/cli-command": "1.27.4-beta.0" } } diff --git a/packages/cli-exec/package.json b/packages/cli-exec/package.json index 758eedf1c..8971c4818 100644 --- a/packages/cli-exec/package.json +++ b/packages/cli-exec/package.json @@ -1,6 +1,6 @@ { "name": "@percy/cli-exec", - "version": "1.27.3", + "version": "1.27.4-beta.0", "license": "MIT", "repository": { "type": "git", @@ -9,7 +9,7 @@ }, "publishConfig": { "access": "public", - "tag": "latest" + "tag": "beta" }, "engines": { "node": ">=14" @@ -33,7 +33,7 @@ ] }, "dependencies": { - "@percy/cli-command": "1.27.3", + "@percy/cli-command": "1.27.4-beta.0", "cross-spawn": "^7.0.3", "which": "^2.0.2" } diff --git a/packages/cli-snapshot/package.json b/packages/cli-snapshot/package.json index da397aa8e..d89306acc 100644 --- a/packages/cli-snapshot/package.json +++ b/packages/cli-snapshot/package.json @@ -1,6 +1,6 @@ { "name": "@percy/cli-snapshot", - "version": "1.27.3", + "version": "1.27.4-beta.0", "license": "MIT", "repository": { "type": "git", @@ -9,7 +9,7 @@ }, "publishConfig": { "access": "public", - "tag": "latest" + "tag": "beta" }, "engines": { "node": ">=14" @@ -33,7 +33,7 @@ ] }, "dependencies": { - "@percy/cli-command": "1.27.3", + "@percy/cli-command": "1.27.4-beta.0", "yaml": "^2.0.0" } } diff --git a/packages/cli-upload/package.json b/packages/cli-upload/package.json index 385270778..4ca9d9a50 100644 --- a/packages/cli-upload/package.json +++ b/packages/cli-upload/package.json @@ -1,6 +1,6 @@ { "name": "@percy/cli-upload", - "version": "1.27.3", + "version": "1.27.4-beta.0", "license": "MIT", "repository": { "type": "git", @@ -9,7 +9,7 @@ }, "publishConfig": { "access": "public", - "tag": "latest" + "tag": "beta" }, "engines": { "node": ">=14" @@ -33,7 +33,7 @@ ] }, "dependencies": { - "@percy/cli-command": "1.27.3", + "@percy/cli-command": "1.27.4-beta.0", "fast-glob": "^3.2.11", "image-size": "^1.0.0" } diff --git a/packages/cli/package.json b/packages/cli/package.json index c79fe493e..ded2e1f76 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@percy/cli", - "version": "1.27.3", + "version": "1.27.4-beta.0", "license": "MIT", "repository": { "type": "git", @@ -9,7 +9,7 @@ }, "publishConfig": { "access": "public", - "tag": "latest" + "tag": "beta" }, "files": [ "bin", @@ -31,14 +31,14 @@ "test:coverage": "yarn test --coverage" }, "dependencies": { - "@percy/cli-app": "1.27.3", - "@percy/cli-build": "1.27.3", - "@percy/cli-command": "1.27.3", - "@percy/cli-config": "1.27.3", - "@percy/cli-exec": "1.27.3", - "@percy/cli-snapshot": "1.27.3", - "@percy/cli-upload": "1.27.3", - "@percy/client": "1.27.3", - "@percy/logger": "1.27.3" + "@percy/cli-app": "1.27.4-beta.0", + "@percy/cli-build": "1.27.4-beta.0", + "@percy/cli-command": "1.27.4-beta.0", + "@percy/cli-config": "1.27.4-beta.0", + "@percy/cli-exec": "1.27.4-beta.0", + "@percy/cli-snapshot": "1.27.4-beta.0", + "@percy/cli-upload": "1.27.4-beta.0", + "@percy/client": "1.27.4-beta.0", + "@percy/logger": "1.27.4-beta.0" } } diff --git a/packages/client/package.json b/packages/client/package.json index 033e7fa19..b3b3d9588 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@percy/client", - "version": "1.27.3", + "version": "1.27.4-beta.0", "license": "MIT", "repository": { "type": "git", @@ -9,7 +9,7 @@ }, "publishConfig": { "access": "public", - "tag": "latest" + "tag": "beta" }, "engines": { "node": ">=14" @@ -32,7 +32,7 @@ "test:coverage": "yarn test --coverage" }, "dependencies": { - "@percy/env": "1.27.3", - "@percy/logger": "1.27.3" + "@percy/env": "1.27.4-beta.0", + "@percy/logger": "1.27.4-beta.0" } } diff --git a/packages/config/package.json b/packages/config/package.json index 5ab626ec0..052e96e99 100644 --- a/packages/config/package.json +++ b/packages/config/package.json @@ -1,6 +1,6 @@ { "name": "@percy/config", - "version": "1.27.3", + "version": "1.27.4-beta.0", "license": "MIT", "repository": { "type": "git", @@ -9,7 +9,7 @@ }, "publishConfig": { "access": "public", - "tag": "latest" + "tag": "beta" }, "engines": { "node": ">=14" @@ -38,7 +38,7 @@ "test:types": "tsd" }, "dependencies": { - "@percy/logger": "1.27.3", + "@percy/logger": "1.27.4-beta.0", "ajv": "^8.6.2", "cosmiconfig": "^8.0.0", "yaml": "^2.0.0" diff --git a/packages/core/package.json b/packages/core/package.json index 5f8bbbb25..0290faa7f 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@percy/core", - "version": "1.27.3", + "version": "1.27.4-beta.0", "license": "MIT", "repository": { "type": "git", @@ -9,7 +9,7 @@ }, "publishConfig": { "access": "public", - "tag": "latest" + "tag": "beta" }, "engines": { "node": ">=14" @@ -43,11 +43,11 @@ "test:types": "tsd" }, "dependencies": { - "@percy/client": "1.27.3", - "@percy/config": "1.27.3", - "@percy/dom": "1.27.3", - "@percy/logger": "1.27.3", - "@percy/webdriver-utils": "1.27.3", + "@percy/client": "1.27.4-beta.0", + "@percy/config": "1.27.4-beta.0", + "@percy/dom": "1.27.4-beta.0", + "@percy/logger": "1.27.4-beta.0", + "@percy/webdriver-utils": "1.27.4-beta.0", "content-disposition": "^0.5.4", "cross-spawn": "^7.0.3", "extract-zip": "^2.0.1", diff --git a/packages/dom/package.json b/packages/dom/package.json index 3fb4c4e20..25d7022dd 100644 --- a/packages/dom/package.json +++ b/packages/dom/package.json @@ -1,6 +1,6 @@ { "name": "@percy/dom", - "version": "1.27.3", + "version": "1.27.4-beta.0", "license": "MIT", "repository": { "type": "git", @@ -9,7 +9,7 @@ }, "publishConfig": { "access": "public", - "tag": "latest" + "tag": "beta" }, "main": "dist/bundle.js", "browser": "dist/bundle.js", diff --git a/packages/env/package.json b/packages/env/package.json index 4a6190d45..7f924b51a 100644 --- a/packages/env/package.json +++ b/packages/env/package.json @@ -1,6 +1,6 @@ { "name": "@percy/env", - "version": "1.27.3", + "version": "1.27.4-beta.0", "license": "MIT", "repository": { "type": "git", @@ -9,7 +9,7 @@ }, "publishConfig": { "access": "public", - "tag": "latest" + "tag": "beta" }, "engines": { "node": ">=14" @@ -32,6 +32,6 @@ "test:coverage": "yarn test --coverage" }, "dependencies": { - "@percy/logger": "1.27.3" + "@percy/logger": "1.27.4-beta.0" } } diff --git a/packages/logger/package.json b/packages/logger/package.json index 0f4cdfb20..b31149293 100644 --- a/packages/logger/package.json +++ b/packages/logger/package.json @@ -1,6 +1,6 @@ { "name": "@percy/logger", - "version": "1.27.3", + "version": "1.27.4-beta.0", "license": "MIT", "repository": { "type": "git", @@ -9,7 +9,7 @@ }, "publishConfig": { "access": "public", - "tag": "latest" + "tag": "beta" }, "engines": { "node": ">=14" diff --git a/packages/sdk-utils/package.json b/packages/sdk-utils/package.json index e37934752..ee5a8482e 100644 --- a/packages/sdk-utils/package.json +++ b/packages/sdk-utils/package.json @@ -1,6 +1,6 @@ { "name": "@percy/sdk-utils", - "version": "1.27.3", + "version": "1.27.4-beta.0", "license": "MIT", "repository": { "type": "git", @@ -9,7 +9,7 @@ }, "publishConfig": { "access": "public", - "tag": "latest" + "tag": "beta" }, "engines": { "node": ">=14" diff --git a/packages/webdriver-utils/package.json b/packages/webdriver-utils/package.json index 5ad269932..254e78e45 100644 --- a/packages/webdriver-utils/package.json +++ b/packages/webdriver-utils/package.json @@ -1,6 +1,6 @@ { "name": "@percy/webdriver-utils", - "version": "1.27.3", + "version": "1.27.4-beta.0", "license": "MIT", "repository": { "type": "git", @@ -9,7 +9,7 @@ }, "publishConfig": { "access": "public", - "tag": "latest" + "tag": "beta" }, "engines": { "node": ">=14" @@ -29,7 +29,7 @@ "test:coverage": "yarn test --coverage" }, "dependencies": { - "@percy/config": "1.27.3", - "@percy/sdk-utils": "1.27.3" + "@percy/config": "1.27.4-beta.0", + "@percy/sdk-utils": "1.27.4-beta.0" } } From 04146d1ebab330d719ecf408118eadd7d42c252c Mon Sep 17 00:00:00 2001 From: shantanuk-browserstack <131665162+shantanuk-browserstack@users.noreply.github.com> Date: Thu, 19 Oct 2023 11:14:25 +0530 Subject: [PATCH 3/4] [PER-2574] Icons not loading when `noscript` tags are present. (#1404) --- packages/dom/src/clone-dom.js | 7 ++++++- packages/dom/test/serialize-dom.test.js | 8 ++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/packages/dom/src/clone-dom.js b/packages/dom/src/clone-dom.js index 37ca0c9d0..257f2d8e2 100644 --- a/packages/dom/src/clone-dom.js +++ b/packages/dom/src/clone-dom.js @@ -10,12 +10,17 @@ import applyElementTransformations from './transform-dom'; * Deep clone a document while also preserving shadow roots * returns document fragment */ + +const ignoreTags = ['NOSCRIPT']; + export function cloneNodeAndShadow({ dom, disableShadowDOM }) { // clones shadow DOM and light DOM for a given node let cloneNode = (node, parent) => { let walkTree = (nextn, nextp) => { while (nextn) { - cloneNode(nextn, nextp); + if (!ignoreTags.includes(nextn.nodeName)) { + cloneNode(nextn, nextp); + } nextn = nextn.nextSibling; } }; diff --git a/packages/dom/test/serialize-dom.test.js b/packages/dom/test/serialize-dom.test.js index 2fa38f6d0..1da2d53ee 100644 --- a/packages/dom/test/serialize-dom.test.js +++ b/packages/dom/test/serialize-dom.test.js @@ -17,6 +17,14 @@ describe('serializeDOM', () => { expect(result.html).toContain('Hey Percy $&'); }); + it('excludes noscript tags when present', () => { + withExample('
Hey Percy $&
'); + + const result = serializeDOM(); + expect(result.html).not.toContain('