diff --git a/test/test.testcafe.js b/test/test.testcafe.js index e3b120f..ca515e7 100644 --- a/test/test.testcafe.js +++ b/test/test.testcafe.js @@ -1,6 +1,9 @@ import {Selector} from 'testcafe'; import {ClientFunction} from 'testcafe'; +let isLocal = false + +; const goBack = ClientFunction(() => window.history.back()); const testLocalStorageSet = ClientFunction((key, value) => { localStorage.setItem(key, value) @@ -33,7 +36,6 @@ async function waitForMainMenu(t) { await t.wait(2000); } -let isLocal = true; if (isLocal) { fixture`Play` .page`https://127.0.0.1/pwa/wordRotator/publicTest/`.beforeEach(async t => { @@ -490,6 +492,7 @@ test('Sharing', async t => { return window.lastWindowOpened; }); + await waitForMainMenu(t); await overrideWindowOpener(); @@ -502,7 +505,12 @@ test('Sharing', async t => { .click(Selector(".share-icon").nth(0)) .expect(Selector(".share-icon").nth(0).exists).eql(false) .expect(Selector(".share-icon").nth(1).exists).eql(false); - await t.expect(await getLastWindowOpened()).eql(["https://web.whatsapp.com/send?text="+encodeURIComponent("127.0.0.1/pwa/wordRotator/publicTest/"), "_blank", "noopener"]); + if (isLocal){ + await t.expect(await getLastWindowOpened()).eql(["https://web.whatsapp.com/send?text="+encodeURIComponent("127.0.0.1/pwa/wordRotator/publicTest/"), "_blank", "noopener"]); + } + else { + await t.expect(await getLastWindowOpened()).eql(["https://web.whatsapp.com/send?text="+encodeURIComponent("beta.wordrotator.silas.link/"), "_blank", "noopener"]); + } await t .click(Selector("#share-button")) .expect(Selector(".share-icon").nth(0).visible).ok() @@ -510,5 +518,7 @@ test('Sharing', async t => { .click(Selector(".share-icon").nth(1)) .expect(Selector(".share-icon").nth(0).exists).eql(false) .expect(Selector(".share-icon").nth(1).exists).eql(false); - await t.expect(await getLastWindowOpened()).eql(["https://t.me/share/url?url="+encodeURIComponent("127.0.0.1/pwa/wordRotator/publicTest/"), "_blank", "noopener"]); + if (isLocal){ + await t.expect(await getLastWindowOpened()).eql(["https://t.me/share/url?url="+encodeURIComponent("beta.wordrotator.silas.link/"), "_blank", "noopener"]); + } }); \ No newline at end of file