testupdate

This commit is contained in:
silas 2018-10-10 22:01:17 +02:00
parent f5ba242d40
commit 85898d318d

View File

@ -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"]);
}
});