Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions injected/entry-points/integration.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ function generateConfig() {
'apiManipulation',
'duckPlayer',
'duckPlayerNative',
'scriptlets',
],
},
};
Expand Down
118 changes: 118 additions & 0 deletions injected/integration-test/pages.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,124 @@ test.describe('Test integration pages', () => {
);
});

// Scriptlet integration page tests
test('Set Cookie Scriptlet', async ({ page }, testInfo) => {
await testPage(
page,
testInfo,
'scriptlets/pages/set-cookie.html',
'./integration-test/test-pages/scriptlets/config/set-cookie.json',
);
});

test('Set Local Storage Item Scriptlet', async ({ page }, testInfo) => {
await testPage(
page,
testInfo,
'scriptlets/pages/set-local-storage-item.html',
'./integration-test/test-pages/scriptlets/config/set-local-storage-item.json',
);
});

test('Set Constant Scriptlet', async ({ page }, testInfo) => {
await testPage(
page,
testInfo,
'scriptlets/pages/set-constant.html',
'./integration-test/test-pages/scriptlets/config/set-constant.json',
);
});

test('Trusted Set Cookie Scriptlet', async ({ page }, testInfo) => {
await testPage(
page,
testInfo,
'scriptlets/pages/trusted-set-cookie.html',
'./integration-test/test-pages/scriptlets/config/trusted-set-cookie.json',
);
});

test('Remove Cookie Scriptlet', async ({ page }, testInfo) => {
await testPage(
page,
testInfo,
'scriptlets/pages/remove-cookie.html',
'./integration-test/test-pages/scriptlets/config/remove-cookie.json',
);
});

test('Abort on Property Read Scriptlet', async ({ page }, testInfo) => {
await testPage(
page,
testInfo,
'scriptlets/pages/abort-on-property-read.html',
'./integration-test/test-pages/scriptlets/config/abort-on-property-read.json',
);
});

test('Abort on Property Write Scriptlet', async ({ page }, testInfo) => {
await testPage(
page,
testInfo,
'scriptlets/pages/abort-on-property-write.html',
'./integration-test/test-pages/scriptlets/config/abort-on-property-write.json',
);
});

test('Prevent Add Event Listener Scriptlet', async ({ page }, testInfo) => {
await testPage(
page,
testInfo,
'scriptlets/pages/prevent-addEventListener.html',
'./integration-test/test-pages/scriptlets/config/prevent-addEventListener.json',
);
});

test('Prevent Set Timeout Scriptlet', async ({ page }, testInfo) => {
await testPage(
page,
testInfo,
'scriptlets/pages/prevent-setTimeout.html',
'./integration-test/test-pages/scriptlets/config/prevent-setTimeout.json',
);
});

test('Prevent Window Open Scriptlet', async ({ page }, testInfo) => {
await testPage(
page,
testInfo,
'scriptlets/pages/prevent-window-open.html',
'./integration-test/test-pages/scriptlets/config/prevent-window-open.json',
);
});

test('Prevent Fetch Scriptlet', async ({ page }, testInfo) => {
await testPage(
page,
testInfo,
'scriptlets/pages/prevent-fetch.html',
'./integration-test/test-pages/scriptlets/config/prevent-fetch.json',
);
});

test('Remove Node Text Scriptlet', async ({ page }, testInfo) => {
await testPage(
page,
testInfo,
'scriptlets/pages/remove-node-text.html',
'./integration-test/test-pages/scriptlets/config/remove-node-text.json',
);
});

test('Abort Current Inline Script Scriptlet', async ({ page }, testInfo) => {
await testPage(
page,
testInfo,
'scriptlets/pages/abort-current-inline-script.html',
'./integration-test/test-pages/scriptlets/config/abort-current-inline-script.json',
);
});

test('enumerateDevices API functionality', async ({ page }, testInfo) => {
await testPage(
page,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"readme": "This config tests the abortCurrentInlineScript scriptlet",
"version": 1,
"unprotectedTemporary": [],
"features": {
"scriptlets": {
"exceptions": [],
"state": "enabled",
"settings": {
"scriptlets": [],
"conditionalChanges": [
{
"condition": [
{
"domain": "localhost"
},
{
"domain": "privacy-test-pages.site"
}
],
"patchSettings": [
{
"op": "add",
"path": "/scriptlets/-",
"value": {
"name": "abortCurrentInlineScript",
"attrs": {
"property": "document.createElement",
"search": "badScript"
}
}
}
]
}
]
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"readme": "This config tests the abortOnPropertyRead scriptlet",
"version": 1,
"unprotectedTemporary": [],
"features": {
"scriptlets": {
"exceptions": [],
"state": "enabled",
"settings": {
"scriptlets": [],
"conditionalChanges": [
{
"condition": [
{
"domain": "localhost"
},
{
"domain": "privacy-test-pages.site"
}
],
"patchSettings": [
{
"op": "add",
"path": "/scriptlets/-",
"value": {
"name": "abortOnPropertyRead",
"attrs": {
"property": "testBadProperty"
}
}
}
]
}
]
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"readme": "This config tests the abortOnPropertyWrite scriptlet",
"version": 1,
"unprotectedTemporary": [],
"features": {
"scriptlets": {
"exceptions": [],
"state": "enabled",
"settings": {
"scriptlets": [],
"conditionalChanges": [
{
"condition": [
{
"domain": "localhost"
},
{
"domain": "privacy-test-pages.site"
}
],
"patchSettings": [
{
"op": "add",
"path": "/scriptlets/-",
"value": {
"name": "abortOnPropertyWrite",
"attrs": {
"property": "testWriteProperty"
}
}
}
]
}
]
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"readme": "This config tests the preventAddEventListener scriptlet",
"version": 1,
"unprotectedTemporary": [],
"features": {
"scriptlets": {
"exceptions": [],
"state": "enabled",
"settings": {
"scriptlets": [],
"conditionalChanges": [
{
"condition": [
{
"domain": "localhost"
},
{
"domain": "privacy-test-pages.site"
}
],
"patchSettings": [
{
"op": "add",
"path": "/scriptlets/-",
"value": {
"name": "preventAddEventListener",
"attrs": {
"typeSearch": "click",
"listenerSearch": "badListener"
}
}
}
]
}
]
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"readme": "This config tests the preventFetch scriptlet",
"version": 1,
"unprotectedTemporary": [],
"features": {
"scriptlets": {
"exceptions": [],
"state": "enabled",
"settings": {
"scriptlets": [],
"conditionalChanges": [
{
"condition": [
{
"domain": "localhost"
},
{
"domain": "privacy-test-pages.site"
}
],
"patchSettings": [
{
"op": "add",
"path": "/scriptlets/-",
"value": {
"name": "preventFetch",
"attrs": {
"propsToMatch": "url:/blocked-url"
}
}
}
]
}
]
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"readme": "This config tests the preventSetTimeout scriptlet",
"version": 1,
"unprotectedTemporary": [],
"features": {
"scriptlets": {
"exceptions": [],
"state": "enabled",
"settings": {
"scriptlets": [],
"conditionalChanges": [
{
"condition": [
{
"domain": "localhost"
},
{
"domain": "privacy-test-pages.site"
}
],
"patchSettings": [
{
"op": "add",
"path": "/scriptlets/-",
"value": {
"name": "preventSetTimeout",
"attrs": {
"matchCallback": "badTimeout"
}
}
}
]
}
]
}
}
}
}
Loading
Loading