From 498cb3f9869851bdc99082992eadec885c33c11a Mon Sep 17 00:00:00 2001 From: Simon Bennetts Date: Tue, 19 Sep 2023 15:33:06 +0200 Subject: [PATCH 1/3] Init to http://zap/ Signed-off-by: Simon Bennetts --- CHANGELOG.md | 4 ++++ source/Background/index.ts | 4 ++-- source/Options/index.tsx | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e25933b..90db52d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,3 +4,7 @@ All notable changes to this add-on will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## Unreleased + +### Changed + +- Init ZAP URL to http://zap/ instead of http://localhost:8080/ \ No newline at end of file diff --git a/source/Background/index.ts b/source/Background/index.ts index 7a0f5a0..290f440 100644 --- a/source/Background/index.ts +++ b/source/Background/index.ts @@ -303,7 +303,7 @@ function cookieChangeHandler( ): void { Browser.storage.sync .get({ - zapurl: 'http://localhost:8080/', + zapurl: 'http://zap/', zapkey: 'not set', }) .then((items) => { @@ -321,7 +321,7 @@ Browser.runtime.onMessage.addListener(onMessageHandler); Browser.runtime.onInstalled.addListener((): void => { console.emoji('🦄', 'extension installed'); Browser.storage.sync.set({ - zapurl: 'http://localhost:8080/', + zapurl: 'http://zap/', zapkey: 'not set', }); }); diff --git a/source/Options/index.tsx b/source/Options/index.tsx index 5c98d84..eb76ba3 100644 --- a/source/Options/index.tsx +++ b/source/Options/index.tsx @@ -46,7 +46,7 @@ function restoreOptions(): void { Browser.storage.sync .get({ - zapurl: 'http://localhost:8080/', + zapurl: 'http://zap/', zapkey: 'not set', zapenable: true, zaprecordingactive: false, From 6aa70af175a43f7f5a9b738752f384f01d6b13d3 Mon Sep 17 00:00:00 2001 From: aryangupta701 Date: Wed, 11 Oct 2023 15:51:14 +0530 Subject: [PATCH 2/3] firefox receives messages now Signed-off-by: aryangupta701 --- test/ContentScript/integrationTests.test.ts | 5 +++-- test/ContentScript/webpages/integrationTest.html | 4 ++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/test/ContentScript/integrationTests.test.ts b/test/ContentScript/integrationTests.test.ts index b93ee78..d8afe08 100644 --- a/test/ContentScript/integrationTests.test.ts +++ b/test/ContentScript/integrationTests.test.ts @@ -65,7 +65,8 @@ function integrationTests( await page.close(); // Then const expectedData = - '["{\\"action\\":{\\"action\\":\\"reportEvent\\"},\\"body\\":{\\"eventJson\\":\\"{TIMESTAMP,\\"eventName\\":\\"pageLoad\\",\\"url\\":\\"http://localhost:1801/webpages/integrationTest.html\\",\\"count\\":1}\\",\\"apikey\\":\\"not set\\"}}","{\\"action\\":{\\"action\\":\\"reportObject\\"},\\"body\\":{\\"objectJson\\":\\"{TIMESTAMP,\\"type\\":\\"nodeAdded\\",\\"tagName\\":\\"A\\",\\"id\\":\\"\\",\\"nodeName\\":\\"A\\",\\"url\\":\\"http://localhost:1801/webpages/integrationTest.html\\",\\"href\\":\\"http://localhost:1801/webpages/integrationTest.html#test\\",\\"text\\":\\"Link\\"}\\",\\"apikey\\":\\"not set\\"}}"]'; + '["{\\"action\\":{\\"action\\":\\"reportEvent\\"},\\"body\\":{\\"eventJson\\":\\"{TIMESTAMP,\\"eventName\\":\\"pageLoad\\",\\"url\\":\\"http://localhost:1801/webpages/integrationTest.html\\",\\"count\\":1}\\",\\"apikey\\":\\"not set\\"}}","{\\"action\\":{\\"action\\":\\"reportObject\\"},\\"body\\":{\\"objectJson\\":\\"{TIMESTAMP,\\"type\\":\\"nodeAdded\\",\\"tagName\\":\\"A\\",\\"id\\":\\"\\",\\"nodeName\\":\\"A\\",\\"url\\":\\"http://localhost:1801/webpages/integrationTest.html\\",\\"href\\":\\"http://localhost:1801/webpages/integrationTest.html#test\\",\\"text\\":\\"Link\\"}\\",\\"apikey\\":\\"not set\\"}}","{\\"action\\":{\\"action\\":\\"reportObject\\"},\\"body\\":{\\"objectJson\\":\\"{TIMESTAMP,\\"type\\":\\"localStorage\\",\\"tagName\\":\\"\\",\\"id\\":\\"localzapurl\\",\\"nodeName\\":\\"\\",\\"url\\":\\"http://localhost:1801/webpages/integrationTest.html\\",\\"text\\":\\"http://localhost:8080/\\"}\\",\\"apikey\\":\\"not set\\"}}","{\\"action\\":{\\"action\\":\\"reportObject\\"},\\"body\\":{\\"objectJson\\":\\"{TIMESTAMP,\\"type\\":\\"localStorage\\",\\"tagName\\":\\"\\",\\"id\\":\\"localzapenable\\",\\"nodeName\\":\\"\\",\\"url\\":\\"http://localhost:1801/webpages/integrationTest.html\\",\\"text\\":\\"true\\"}\\",\\"apikey\\":\\"not set\\"}}"]'; + expect(JSON.stringify(Array.from(actualData))).toBe(expectedData); }); @@ -76,7 +77,7 @@ function integrationTests( await driver.setEnable(false); const page = await context.newPage(); await page.goto( - `http://localhost:${_HTTPPORT}/webpages/integrationTest.html` + `http://localhost:${_HTTPPORT}/webpages/interactions.html` ); await page.waitForLoadState('networkidle'); await page.waitForTimeout(1000); diff --git a/test/ContentScript/webpages/integrationTest.html b/test/ContentScript/webpages/integrationTest.html index 9072c37..7ce07c7 100644 --- a/test/ContentScript/webpages/integrationTest.html +++ b/test/ContentScript/webpages/integrationTest.html @@ -5,5 +5,9 @@ Link + \ No newline at end of file From f3bffc7b4fe51b4149f207949cccb30e9dcd3570 Mon Sep 17 00:00:00 2001 From: aryangupta701 Date: Wed, 11 Oct 2023 16:11:21 +0530 Subject: [PATCH 3/3] update expected data Signed-off-by: aryangupta701 --- test/ContentScript/integrationTests.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/ContentScript/integrationTests.test.ts b/test/ContentScript/integrationTests.test.ts index c02ee35..f3e1d64 100644 --- a/test/ContentScript/integrationTests.test.ts +++ b/test/ContentScript/integrationTests.test.ts @@ -65,7 +65,7 @@ function integrationTests( await page.close(); // Then const expectedData = - '["{\\"action\\":{\\"action\\":\\"reportEvent\\"},\\"body\\":{\\"eventJson\\":\\"{TIMESTAMP,\\"eventName\\":\\"pageLoad\\",\\"url\\":\\"http://localhost:1801/webpages/integrationTest.html\\",\\"count\\":1}\\",\\"apikey\\":\\"not set\\"}}","{\\"action\\":{\\"action\\":\\"reportObject\\"},\\"body\\":{\\"objectJson\\":\\"{TIMESTAMP,\\"type\\":\\"nodeAdded\\",\\"tagName\\":\\"A\\",\\"id\\":\\"\\",\\"nodeName\\":\\"A\\",\\"url\\":\\"http://localhost:1801/webpages/integrationTest.html\\",\\"href\\":\\"http://localhost:1801/webpages/integrationTest.html#test\\",\\"text\\":\\"Link\\"}\\",\\"apikey\\":\\"not set\\"}}","{\\"action\\":{\\"action\\":\\"reportObject\\"},\\"body\\":{\\"objectJson\\":\\"{TIMESTAMP,\\"type\\":\\"localStorage\\",\\"tagName\\":\\"\\",\\"id\\":\\"localzapurl\\",\\"nodeName\\":\\"\\",\\"url\\":\\"http://localhost:1801/webpages/integrationTest.html\\",\\"text\\":\\"http://localhost:8080/\\"}\\",\\"apikey\\":\\"not set\\"}}","{\\"action\\":{\\"action\\":\\"reportObject\\"},\\"body\\":{\\"objectJson\\":\\"{TIMESTAMP,\\"type\\":\\"localStorage\\",\\"tagName\\":\\"\\",\\"id\\":\\"localzapenable\\",\\"nodeName\\":\\"\\",\\"url\\":\\"http://localhost:1801/webpages/integrationTest.html\\",\\"text\\":\\"true\\"}\\",\\"apikey\\":\\"not set\\"}}"]'; + '["{\\"action\\":{\\"action\\":\\"reportEvent\\"},\\"body\\":{\\"eventJson\\":\\"{TIMESTAMP,\\"eventName\\":\\"pageLoad\\",\\"url\\":\\"http://localhost:1801/webpages/integrationTest.html\\",\\"count\\":1}\\",\\"apikey\\":\\"not set\\"}}","{\\"action\\":{\\"action\\":\\"reportObject\\"},\\"body\\":{\\"objectJson\\":\\"{TIMESTAMP,\\"type\\":\\"nodeAdded\\",\\"tagName\\":\\"A\\",\\"id\\":\\"\\",\\"nodeName\\":\\"A\\",\\"url\\":\\"http://localhost:1801/webpages/integrationTest.html\\",\\"href\\":\\"http://localhost:1801/webpages/integrationTest.html#test\\",\\"text\\":\\"Link\\"}\\",\\"apikey\\":\\"not set\\"}}","{\\"action\\":{\\"action\\":\\"reportObject\\"},\\"body\\":{\\"objectJson\\":\\"{TIMESTAMP,\\"type\\":\\"localStorage\\",\\"tagName\\":\\"\\",\\"id\\":\\"localzapenable\\",\\"nodeName\\":\\"\\",\\"url\\":\\"http://localhost:1801/webpages/integrationTest.html\\",\\"text\\":\\"true\\"}\\",\\"apikey\\":\\"not set\\"}}","{\\"action\\":{\\"action\\":\\"reportObject\\"},\\"body\\":{\\"objectJson\\":\\"{TIMESTAMP,\\"type\\":\\"localStorage\\",\\"tagName\\":\\"\\",\\"id\\":\\"localzapurl\\",\\"nodeName\\":\\"\\",\\"url\\":\\"http://localhost:1801/webpages/integrationTest.html\\",\\"text\\":\\"http://localhost:8080/\\"}\\",\\"apikey\\":\\"not set\\"}}"]'; expect(JSON.stringify(Array.from(actualData))).toBe(expectedData); });