This commit is contained in:
silas
2018-10-21 22:07:45 +02:00
parent 703edc8526
commit 98fc403e9e
12 changed files with 91 additions and 39 deletions

View File

@@ -1,8 +1,7 @@
import {Selector} from 'testcafe';
import {ClientFunction} from 'testcafe';
let isLocal = false;
let isLocal = true;
const goBack = ClientFunction(() => window.history.back());
const testLocalStorageSet = ClientFunction((key, value) => {
@@ -134,14 +133,14 @@ test('Play', async t => {
levelNumber++;
//TWOLevel
await t.expect(Selector('.segment.segment-parent.rotate-270').nth(0).textContent).eql("BOAL")
.expect(Selector('.segment.segment-parent.rotate-180').textContent).eql("DEAR")
.expect(Selector('.segment.segment-parent.rotate-360').textContent).eql("NSMR")
.expect(Selector('.segment.segment-parent.rotate-270').nth(1).textContent).eql("EEUF")
await t.expect(Selector('.segment-parent').nth(SEGMENT.ONE).textContent).eql("BRTH")
.expect(Selector('.segment-parent').nth(SEGMENT.TWO).textContent).eql("AUER")
.expect(Selector('.segment-parent').nth(SEGMENT.THREE).textContent).eql("ERAP")
.expect(Selector('.segment-parent').nth(SEGMENT.FOUR).textContent).eql("EIIE")
.expect(Selector('.segment.segment-parent.rotate-270').nth(0).getStyleProperty('transform')).eql("matrix(0, -1, 1, 0, 0, 0)")
.expect(Selector('.segment.segment-parent.rotate-180').getStyleProperty('transform')).eql("matrix(-1, 0, 0, -1, 0, 0)")
.expect(Selector('.segment.segment-parent.rotate-360').getStyleProperty('transform')).eql("matrix(1, 0, 0, 1, 0, 0)")
.expect(Selector('.segment.segment-parent.rotate-270').nth(1).getStyleProperty('transform')).eql("matrix(0, -1, 1, 0, 0, 0)")
// .expect(Selector('.segment.segment-parent.rotate-270').nth(1).getStyleProperty('transform')).eql("matrix(0, -1, 1, 0, 0, 0)")
.expect(Selector('#continue-button').visible).eql(false)
.expect(Selector('#level-number').textContent).eql("3")
.expect(Selector('#won-text').visible).eql(false)
@@ -544,11 +543,11 @@ 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);
if (isLocal){
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.expect(await getLastWindowOpened()).eql(["https://web.whatsapp.com/send?text=" + encodeURIComponent("beta.wordrotator.silas.link/"), "_blank", "noopener"]);
}
await t
.click(Selector("#share-button"))
@@ -557,7 +556,11 @@ 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);
if (isLocal){
await t.expect(await getLastWindowOpened()).eql(["https://t.me/share/url?url="+encodeURIComponent("beta.wordrotator.silas.link/"), "_blank", "noopener"]);
let res = await getLastWindowOpened();
if (isLocal) {
await t.expect(await getLastWindowOpened()).eql(["https://t.me/share/url?url=" + encodeURIComponent("127.0.0.1/pwa/wordRotator/publicTest/"), "_blank", "noopener"]);
}
else {
await t.expect(await getLastWindowOpened()).eql(["https://t.me/share/url?url=" + encodeURIComponent("beta.wordrotator.silas.link/"), "_blank", "noopener"]);
}
});