From cbfe3b95c0fd0acf228198de2bb7d48a52a75912 Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Mon, 25 Jul 2022 18:57:08 +1000 Subject: adding a test for the contact finder --- test/spec/LibreJSSpec.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'test') diff --git a/test/spec/LibreJSSpec.js b/test/spec/LibreJSSpec.js index 9e96af5..aa5c167 100644 --- a/test/spec/LibreJSSpec.js +++ b/test/spec/LibreJSSpec.js @@ -282,6 +282,22 @@ describe('LibreJS\' components', () => { expect(scriptInfo).toBeNull(); }); }); + + describe('Contact finder', () => { + it('should display 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 frame = await browser.tabs.executeScript(tab.id, { + code: 'document.getElementById("_LibreJS_frame").outerHTML' + }) + expect(frame).toBeTruthy(); + done(); + }, 100); + }); + }); + afterAll(async () => { await browser.tabs.remove(tab.id); browser.tabs.update((await browser.tabs.getCurrent()).id, { active: true }); -- cgit v1.2.3