aboutsummaryrefslogtreecommitdiff
path: root/test/spec/LibreJSSpec.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/spec/LibreJSSpec.js')
-rw-r--r--test/spec/LibreJSSpec.js59
1 files changed, 31 insertions, 28 deletions
diff --git a/test/spec/LibreJSSpec.js b/test/spec/LibreJSSpec.js
index 62a44a0..77563d2 100644
--- a/test/spec/LibreJSSpec.js
+++ b/test/spec/LibreJSSpec.js
@@ -44,6 +44,7 @@ describe('LibreJS\' components', () => {
let unknownLicensed = `// @license ${unknownLicense.magnet} ${unknownLicense.id}\n${nontrivial}\n// @license-end`;
let malformedLicensed = `// @license\n${nontrivial}`;
let tab, documentUrl;
+ const enableContactFinderTests = false;
beforeAll(async () => {
let url = browser.extension.getURL('/test/resources/index.html');
@@ -291,35 +292,37 @@ describe('LibreJS\' components', () => {
});
});
- describe('The 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);
- });
- 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'
- });
- expect(frameBody).not.toContain('About Us');
- expect(frameBody).toContain('Contact Us');
- expect(frameBody).toContain('Website Feedback');
- expect(frameBody).toContain('lib@re.js');
- done();
- }, 200);
+ if (enableContactFinderTests) {
+ describe('The 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);
+ });
+ 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'
+ });
+ expect(frameBody).not.toContain('About Us');
+ expect(frameBody).toContain('Contact Us');
+ expect(frameBody).toContain('Website Feedback');
+ expect(frameBody).toContain('lib@re.js');
+ done();
+ }, 200);
+ });
});
- });
+ }
describe('The prefs', () => {
it('should have the defaults', async () => {