Skip to content

Commit d4bccd5

Browse files
Release build 8.6.0 [ci release]
1 parent 8fa69d0 commit d4bccd5

22 files changed

+247
-104
lines changed

.github/workflows/build-pr.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,17 +68,25 @@ jobs:
6868
const repoUrl = `https://github.com/${context.repo.owner}/${context.repo.repo}`;
6969
const branchUrl = `${repoUrl}/tree/${branchName}`;
7070
const commitUrl = `${repoUrl}/commit/${commitHash}`;
71+
72+
// Get the current date
73+
const lastUpdatedDate = (new Date()).toLocaleString('en-US', {
74+
dateStyle: 'long',
75+
timeStyle: 'long'
76+
});
77+
7178
const commentBody = `
7279
### Temporary Branch Update
7380
7481
The temporary branch has been updated with the latest changes. Below are the details:
7582
7683
- **Branch Name**: [${branchName}](${branchUrl})
7784
- **Commit Hash**: [${commitHash}](${commitUrl})
85+
- **Last Updated**: ${lastUpdatedDate}
7886
- **Install Command**: \`npm i github:duckduckgo/content-scope-scripts#${commitHash}\`
7987
8088
Please use the above install command to update to the latest version.
81-
`;
89+
`;
8290
core.setOutput('comment_body', commentBody);
8391
core.setOutput('pr_number', prNumber);
8492
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
name: Update Snapshots on a PR
2+
description: |
3+
Runs previously failed snapshot tests, and commits the changes.
4+
5+
Your PR will receive a commit with the changes so you can manually verify before merging.
6+
7+
on:
8+
workflow_dispatch:
9+
inputs:
10+
pr_number:
11+
description: 'Pull Request Number (Warning: This action will push a commit to the referenced PR)'
12+
required: true
13+
type: number
14+
15+
permissions:
16+
pull-requests: write
17+
contents: write
18+
19+
jobs:
20+
update-pr-with-snapshots:
21+
name: Update PR With Snapshots
22+
runs-on: macos-14
23+
steps:
24+
- uses: actions/checkout@v4
25+
- name: Checkout PR ${{ github.event.inputs.pr_number }}
26+
if: github.event_name == 'workflow_dispatch'
27+
run: gh pr checkout ${{ github.event.inputs.pr_number }}
28+
env:
29+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
30+
31+
- name: Use Node.js
32+
uses: actions/setup-node@v4
33+
with:
34+
node-version-file: '.nvmrc'
35+
- uses: actions/cache@v4
36+
with:
37+
path: |
38+
~/.npm
39+
~/.cache/ms-playwright
40+
key: ${{ runner.os }}-node-playwright-${{ hashFiles('**/package-lock.json') }}
41+
restore-keys: |
42+
${{ runner.os }}-node-playwright-
43+
${{ runner.os }}-node-
44+
45+
- name: Install dependencies
46+
run: npm ci
47+
48+
- name: Build all
49+
run: npm run build
50+
51+
- name: Install Playwright Browsers
52+
run: npx playwright install --with-deps
53+
54+
- name: Run Screenshot tests
55+
id: screenshot_tests
56+
run: npm run test-int-snapshots
57+
58+
- if: ${{ steps.screenshot_tests.conclusion == 'success' }}
59+
run: |
60+
echo "nothing to update - tests all passed"
61+
62+
- name: Re-Running Playwright to update snapshots
63+
id: screenshot_tests_update
64+
if: ${{ failure() && steps.screenshot_tests.conclusion == 'failure' }}
65+
run: npm run test-int-snapshots-update
66+
67+
- name: Commit the updated files to the PR branch
68+
if: ${{ failure() && steps.screenshot_tests_update.conclusion == 'success' }}
69+
env:
70+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
71+
run: |
72+
# Configure Git with a bot's username and email for committing changes
73+
# This makes it easy to identify in the PR
74+
git config user.name "github-actions[bot]"
75+
git config user.email "github-actions[bot]@users.noreply.github.com"
76+
77+
# Stage all updated PNG files for commit
78+
git add "*.png"
79+
80+
# Commit the changes with a descriptive message
81+
git commit -m "Updated snapshots via workflow"
82+
83+
# Push the changes to the current branch in the PR
84+
git push origin HEAD

.github/workflows/snapshots.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Test Snapshots
2+
description: |
3+
Runs snapshot tests and uploads test reports as artifacts
4+
5+
If this workflow fails, you can trigger `update-snapshots.yml` from the
6+
GitHub UI.
7+
8+
on:
9+
push:
10+
branches:
11+
- main
12+
pull_request:
13+
14+
permissions:
15+
contents: read
16+
17+
jobs:
18+
snapshots:
19+
timeout-minutes: 5
20+
runs-on: macos-14
21+
steps:
22+
- uses: actions/checkout@v4
23+
- name: Use Node.js
24+
uses: actions/setup-node@v4
25+
with:
26+
node-version-file: '.nvmrc'
27+
- uses: actions/cache@v4
28+
with:
29+
path: |
30+
~/.npm
31+
~/.cache/ms-playwright
32+
key: ${{ runner.os }}-node-playwright-${{ hashFiles('**/package-lock.json') }}
33+
restore-keys: |
34+
${{ runner.os }}-node-playwright-
35+
${{ runner.os }}-node-
36+
37+
- run: npm ci
38+
- run: npm run build
39+
40+
- run: npm run lint
41+
continue-on-error: true
42+
43+
- run: npm run stylelint
44+
continue-on-error: true
45+
46+
- run: npm run test-unit
47+
continue-on-error: true
48+
49+
- name: 'Clean tree'
50+
run: 'npm run test-clean-tree'
51+
52+
- name: Install Playwright Browsers
53+
run: npx playwright install --with-deps
54+
55+
- run: npm run test-int-snapshots
56+
57+
- uses: actions/upload-artifact@v4
58+
if: always()
59+
with:
60+
name: playwright-report-pages
61+
path: |
62+
special-pages/playwright-report
63+
special-pages/test-results
64+
injected/playwright-report
65+
injected/test-results
66+
retention-days: 5

CHANGELOG.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1-
- add favicon feature (#1561)
1+
- Add support for non isolated messaging (#1586)
2+
- Adds last updated date to PR build-and-release comment (#1563)
3+
- add snapshot checking in CI (#1587)
4+
- build(deps-dev): bump typescript-eslint from 8.26.0 to 8.27.0 (#1582)

Sources/ContentScopeScripts/dist/contentScope.js

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5976,24 +5976,17 @@
59765976
const userUnprotectedDomains = $USER_UNPROTECTED_DOMAINS$;
59775977
const userPreferences = $USER_PREFERENCES$;
59785978
const processedConfig = processConfig(config, userUnprotectedDomains, userPreferences, platformSpecificFeatures);
5979+
const handlerNames = [];
59795980
if (false) {
5980-
processedConfig.messagingConfig = new WebkitMessagingConfig({
5981-
webkitMessageHandlerNames: ["contentScopeScriptsIsolated"],
5982-
secret: "",
5983-
hasModernWebkitAPI: true
5984-
});
5981+
handlerNames.push("contentScopeScriptsIsolated");
59855982
} else {
5986-
processedConfig.messagingConfig = new TestTransportConfig({
5987-
notify() {
5988-
},
5989-
request: async () => {
5990-
},
5991-
subscribe() {
5992-
return () => {
5993-
};
5994-
}
5995-
});
5983+
handlerNames.push("contentScopeScripts");
59965984
}
5985+
processedConfig.messagingConfig = new WebkitMessagingConfig({
5986+
webkitMessageHandlerNames: handlerNames,
5987+
secret: "",
5988+
hasModernWebkitAPI: true
5989+
});
59975990
load({
59985991
platform: processedConfig.platform,
59995992
site: processedConfig.site,

Sources/ContentScopeScripts/dist/contentScopeIsolated.js

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12098,24 +12098,17 @@
1209812098
const userUnprotectedDomains = $USER_UNPROTECTED_DOMAINS$;
1209912099
const userPreferences = $USER_PREFERENCES$;
1210012100
const processedConfig = processConfig(config2, userUnprotectedDomains, userPreferences, platformSpecificFeatures);
12101+
const handlerNames = [];
1210112102
if (true) {
12102-
processedConfig.messagingConfig = new WebkitMessagingConfig({
12103-
webkitMessageHandlerNames: ["contentScopeScriptsIsolated"],
12104-
secret: "",
12105-
hasModernWebkitAPI: true
12106-
});
12103+
handlerNames.push("contentScopeScriptsIsolated");
1210712104
} else {
12108-
processedConfig.messagingConfig = new TestTransportConfig({
12109-
notify() {
12110-
},
12111-
request: async () => {
12112-
},
12113-
subscribe() {
12114-
return () => {
12115-
};
12116-
}
12117-
});
12105+
handlerNames.push("contentScopeScripts");
1211812106
}
12107+
processedConfig.messagingConfig = new WebkitMessagingConfig({
12108+
webkitMessageHandlerNames: handlerNames,
12109+
secret: "",
12110+
hasModernWebkitAPI: true
12111+
});
1211912112
load({
1212012113
platform: processedConfig.platform,
1212112114
site: processedConfig.site,

injected/entry-points/apple.js

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*/
44
import { load, init } from '../src/content-scope-features.js';
55
import { processConfig, platformSpecificFeatures } from './../src/utils';
6-
import { WebkitMessagingConfig, TestTransportConfig } from '../../messaging/index.js';
6+
import { WebkitMessagingConfig } from '../../messaging/index.js';
77

88
function initCode() {
99
// @ts-expect-error https://app.asana.com/0/1201614831475344/1203979574128023/f
@@ -15,27 +15,17 @@ function initCode() {
1515

1616
const processedConfig = processConfig(config, userUnprotectedDomains, userPreferences, platformSpecificFeatures);
1717

18+
const handlerNames = [];
1819
if (import.meta.injectName === 'apple-isolated') {
19-
processedConfig.messagingConfig = new WebkitMessagingConfig({
20-
webkitMessageHandlerNames: ['contentScopeScriptsIsolated'],
21-
secret: '',
22-
hasModernWebkitAPI: true,
23-
});
20+
handlerNames.push('contentScopeScriptsIsolated');
2421
} else {
25-
processedConfig.messagingConfig = new TestTransportConfig({
26-
notify() {
27-
// noop
28-
},
29-
request: async () => {
30-
// noop
31-
},
32-
subscribe() {
33-
return () => {
34-
// noop
35-
};
36-
},
37-
});
22+
handlerNames.push('contentScopeScripts');
3823
}
24+
processedConfig.messagingConfig = new WebkitMessagingConfig({
25+
webkitMessageHandlerNames: handlerNames,
26+
secret: '',
27+
hasModernWebkitAPI: true,
28+
});
3929

4030
load({
4131
platform: processedConfig.platform,
Loading

injected/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@
1111
"build-types": "node scripts/types.mjs",
1212
"bundle-trackers": "node scripts/bundleTrackers.mjs --output ../build/tracker-lookup.json",
1313
"test-unit": "jasmine --config=unit-test/config.json",
14-
"test-int": "npm run playwright",
14+
"test-int": "playwright test --grep-invert '@screenshots'",
1515
"test-int-x": "xvfb-run --server-args='-screen 0 1024x768x24' npm run test-int",
16+
"test-int-snapshots": "playwright test --grep '@screenshots'",
17+
"test-int-snapshots-update": "playwright test --grep '@screenshots' --update-snapshots --last-failed",
1618
"test": "npm run lint && npm run test-unit && npm run test-int && npm run playwright",
1719
"serve": "http-server -c-1 --port 3220 integration-test/test-pages",
1820
"playwright": "playwright test --grep-invert '@screenshots'",

0 commit comments

Comments
 (0)