From 395df086e12e62ae55ebc7012d94896ca8958394 Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Thu, 28 Jul 2022 10:37:00 +1000 Subject: adding a test for contact finder --- test/spec/LibreJSSpec.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'test/spec') diff --git a/test/spec/LibreJSSpec.js b/test/spec/LibreJSSpec.js index aa5c167..1bb47ab 100644 --- a/test/spec/LibreJSSpec.js +++ b/test/spec/LibreJSSpec.js @@ -296,6 +296,22 @@ describe('LibreJS\' components', () => { done(); }, 100); }); + it('should display the correct contact info in the contact finder iframe', async (done) => { + await browser.runtime.connect({ name: "port-from-cs" }).postMessage({ invoke_contact_finder: 1 }); + // Direct await / async does not work as executeScript does not wait + // for the listener + setTimeout(async () => { + const [frameBody] = await browser.tabs.executeScript(tab.id, { + code: 'document.getElementById("_LibreJS_frame").contentWindow.document.body.innerHTML' + }) + console.log(frameBody); + expect(frameBody).not.toContain('About Us'); + expect(frameBody).toContain('Contact Us'); + expect(frameBody).toContain('Website Feedback'); + expect(frameBody).toContain('lib@re.js'); + done(); + }, 200); + }); }); afterAll(async () => { -- cgit v1.2.3