Skip to content

Commit 0d5bfab

Browse files
shakyShanegithub-actions[bot]
authored andcommitted
Release build 4.18.0 [ci release]
1 parent 87962a1 commit 0d5bfab

File tree

18 files changed

+548
-56
lines changed

18 files changed

+548
-56
lines changed

README.md

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,3 +78,92 @@ To handle the difference in scope injection we expose multiple utilities which b
7878
- Stores the native original property in _native such that it can be called elsewhere if needed without going through the proxy.
7979
- DDGReflect
8080
- Calls into wrappedJSObject.Reflect for Firefox but otherwise exactly the same as [window.Reflect](Sources/BrowserServicesKit/UserScript/ContentScopeUserScript.swift)
81+
82+
### Testing Locally
83+
84+
Depending on what you are changing, you may need to run the build processes locally, or individual tests.
85+
The following all run within GitHub Actions when you create a pull request, but you can run them locally as well.
86+
87+
- eslint
88+
- Typescript
89+
- Unit tests (jasmine)
90+
- Feature Integration Tests (puppeteer)
91+
- Feature Integration Tests (playwright)
92+
- Special Pages Integration Tests (playwright)
93+
- Feature Build process + Special Pages Build process
94+
95+
If you want to get a good feeling for whether a PR or CI run will pass/fail, you can run the `test` command
96+
which chains most of the following together
97+
98+
```shell
99+
# run this if you want some confidence that your PR will pass
100+
npm test
101+
```
102+
103+
#### eslint
104+
105+
```shell
106+
# run eslint to check for errors
107+
npm run lint
108+
109+
# run eslint and attempt to fix errors
110+
npm run lint-fix
111+
```
112+
113+
#### Typescript
114+
115+
```shell
116+
# run Typescript to check for errors
117+
npm run tsc
118+
119+
# run Typescript in watch mode
120+
npm run tsc-watch
121+
```
122+
123+
#### Unit Tests (jasmine)
124+
125+
Everything for unit-testing is located in the `unit-test` folder. Jasmine configuration is in `unit-test/jasmine.json`.
126+
127+
```shell
128+
npm run test-unit
129+
```
130+
131+
#### Feature Integration Tests (puppeteer)
132+
133+
Everything within `integration-test` (minus the playwright folder) is controlled by Jasmine + Puppeteer.
134+
The configuration is within `integration-test/config.js`
135+
136+
Note: when you run this command, it will also be executed all workspaces too. For example, within `packages/special-pages`
137+
138+
```shell
139+
npm run test-int
140+
```
141+
142+
#### Feature Integration Tests (playwright)
143+
Everything within `integration-test/playwright` is integration tests controlled by Playwright. These should be defaulted
144+
to for any new tests that include UI elements (such as click to load)
145+
146+
```shell
147+
npm run playwright
148+
```
149+
150+
#### Special Pages Integration Tests (playwright)
151+
There are tests within `packages/special-pages/tests` that are dedicated to testing the special pages.
152+
These tests will be ran automatically when you execute `npm run test-int` from the root. But during development
153+
you might find it useful to run them individually.
154+
155+
```shell
156+
cd packages/special-pages
157+
npm run test-int
158+
```
159+
160+
#### Feature Build process
161+
162+
To produce all artefacts that are used by platforms, just run the `npm run build` command.
163+
This will create platform specific code within the `build` folder (that is not checked in)
164+
165+
```shell
166+
npm run build
167+
```
168+
169+
Note: This will also execute the build process witin `packages/special-pages`

Sources/ContentScopeScripts/dist/contentScope.js

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

build/android/contentScope.js

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

build/contentScope.js

Lines changed: 67 additions & 13 deletions
Large diffs are not rendered by default.

build/integration/contentScope.js

Lines changed: 67 additions & 13 deletions
Large diffs are not rendered by default.

build/tracker-lookup.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

build/windows/contentScope.js

Lines changed: 67 additions & 13 deletions
Large diffs are not rendered by default.

integration-test/playwright/duckplayer.spec.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,3 +224,12 @@ test.describe('Duck Player Overlays on Video Player in YouTube.com', () => {
224224
await overlays.userSettingWasUpdatedTo('always ask remembered') // updated
225225
})
226226
})
227+
228+
test.describe('serp proxy', () => {
229+
test('serp proxy is enabled', async ({ page }, workerInfo) => {
230+
const overlays = DuckplayerOverlays.create(page, workerInfo)
231+
await overlays.serpProxyEnabled()
232+
await overlays.gotoSerpProxyPage()
233+
await overlays.userValuesCallIsProxied()
234+
})
235+
})

integration-test/playwright/page-objects/duckplayer-overlays.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ const userValues = {
3535
export class DuckplayerOverlays {
3636
overlaysPage = '/duckplayer/pages/overlays.html'
3737
playerPage = '/duckplayer/pages/player.html'
38+
serpProxyPage = '/duckplayer/pages/serp-proxy.html'
3839
/**
3940
* @param {import("@playwright/test").Page} page
4041
* @param {import("@duckduckgo/messaging/lib/test-utils.mjs").PlatformInfo} platform
@@ -55,6 +56,25 @@ export class DuckplayerOverlays {
5556
await this.page.goto(this.playerPage + '?videoID=123')
5657
}
5758

59+
async gotoSerpProxyPage () {
60+
await this.page.goto(this.serpProxyPage)
61+
}
62+
63+
async userValuesCallIsProxied () {
64+
const calls = await this.page.evaluate(readOutgoingMessages)
65+
expect(calls).toMatchObject([
66+
{
67+
payload: {
68+
context: 'contentScopeScripts',
69+
featureName: 'duckPlayer',
70+
params: {},
71+
method: 'getUserValues',
72+
id: 'getUserValues.response'
73+
}
74+
}
75+
])
76+
}
77+
5878
async overlayBlocksVideo () {
5979
await this.page.locator('ddg-video-overlay').waitFor({ state: 'visible', timeout: 1000 })
6080
await this.page.getByRole('link', { name: 'Watch in Duck Player' }).waitFor({ state: 'visible', timeout: 1000 })
@@ -72,6 +92,13 @@ export class DuckplayerOverlays {
7292
await this.setup({ config: loadConfig('overlays') })
7393
}
7494

95+
async serpProxyEnabled () {
96+
const config = loadConfig('overlays')
97+
const domains = config.features.duckPlayer.settings.domains[0].patchSettings
98+
config.features.duckPlayer.settings.domains[0].patchSettings = domains.filter(x => x.path === '/overlays/serpProxy/state')
99+
await this.setup({ config })
100+
}
101+
75102
async videoOverlayDoesntShow () {
76103
expect(await this.page.locator('ddg-video-overlay').count()).toBe(0)
77104
}

integration-test/test-pages/duckplayer/config/overlays.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
"overlays": {
99
"youtube": {
1010
"state": "disabled"
11+
},
12+
"serpProxy": {
13+
"state": "disabled"
1114
}
1215
},
1316
"domains": [
@@ -18,6 +21,11 @@
1821
"op": "replace",
1922
"path": "/overlays/youtube/state",
2023
"value": "enabled"
24+
},
25+
{
26+
"op": "replace",
27+
"path": "/overlays/serpProxy/state",
28+
"value": "enabled"
2129
}
2230
]
2331
}

0 commit comments

Comments
 (0)