This commit is contained in:
silas
2018-10-10 20:05:53 +02:00
parent 05188e37fd
commit f5ba242d40
3 changed files with 55 additions and 20 deletions

View File

@@ -91,7 +91,7 @@ test('Play', async t => {
await waitForMainMenu(t);
await t
//Main Menu
.click(Selector('#play-button'))
.click(Selector('#play-button')).wait(500)
//firstTutorial
.expect(Selector('.tutorial-text .step-1').visible).eql(true)
@@ -201,15 +201,15 @@ test('Play', async t => {
.expect(Selector('.segment-parent').nth(SEGMENT.THREE).textContent).eql("INCK")
.expect(Selector('.segment-parent').nth(SEGMENT.FOUR).textContent).eql("PHRE")
.expect(Selector('.segment-parent').nth(SEGMENT.FIVE).textContent).eql("YSSI")
.expect(Selector('.segment-parent').nth(SEGMENT.SIX).textContent).eql("BEHE")
.expect(Selector('.segment-parent').nth(SEGMENT.SEVEN).textContent).eql("RARZ")
.expect(Selector('.segment-parent').nth(SEGMENT.SIX).textContent).eql("BEKO")
.expect(Selector('.segment-parent').nth(SEGMENT.SEVEN).textContent).eql("RACH")
.expect(Selector('.segment-parent').nth(SEGMENT.EIGHT).textContent).eql("GUFA")
.expect(Selector('.segment-parent').nth(SEGMENT.NINE).textContent).eql("SSLL")
.expect(Selector('.segment-parent').nth(SEGMENT.TEN).textContent).eql("IKDEERNZTULANGND")
.expect(Selector('.segment-parent').nth(SEGMENT.TEN).textContent).eql("IKDEERNZTUTONGPF")
.expect(Selector('.segment-parent').nth(SEGMENT.ELEVEN).textContent).eql("IKDE")
.expect(Selector('.segment-parent').nth(SEGMENT.TWELVE).textContent).eql("ERNZ")
.expect(Selector('.segment-parent').nth(SEGMENT.THIRTEEN).textContent).eql("TULA")
.expect(Selector('.segment-parent').nth(SEGMENT.FOURTEEN).textContent).eql("NGND")
.expect(Selector('.segment-parent').nth(SEGMENT.THIRTEEN).textContent).eql("TUTO")
.expect(Selector('.segment-parent').nth(SEGMENT.FOURTEEN).textContent).eql("NGPF")
.drag(Selector('.segment-parent').nth(SEGMENT.TEN), dragDimen, 4, {
offsetX: 54,
offsetY: 17
@@ -381,7 +381,7 @@ test('Play', async t => {
});
test('LoadLastLevel', async t => {
await waitForMainMenu(t);
await t.click(Selector('#play-button'))
await t.click(Selector('#play-button')).wait(500)
.expect(Selector('.segment-parent').nth(SEGMENT.ONE).hasClass('locked')).ok()
.expect(Selector('.segment-parent').nth(SEGMENT.ONE).getStyleProperty('transform')).eql("matrix(1, 0, 0, 1, 0, 0)")
.expect(Selector('.segment-parent').nth(SEGMENT.TWO).getStyleProperty('transform')).eql("matrix(1, 0, 0, 1, 0, 0)")
@@ -395,13 +395,13 @@ test('LevelRotation', async t => {
.click(Selector('.segment-parent').nth(SEGMENT.THREE))
.click(Selector('.segment-parent').nth(SEGMENT.THREE))
.expect(Selector('.segment-parent').nth(SEGMENT.THREE).getStyleProperty('transform')).eql("matrix(0, -1, 1, 0, 0, 0)")
.wait(3500)
.wait(3700)
.expect(Selector('.segment-parent').nth(SEGMENT.THREE).getStyleProperty('transform')).eql("matrix(0, -1, 1, 0, 0, 0)")
.expect(Selector('.segment-parent').nth(SEGMENT.FOUR).getStyleProperty('transform')).eql("matrix(0, 1, -1, 0, 0, 0)")
.click(Selector('.segment-parent').nth(SEGMENT.THREE))
.click(Selector('.segment-parent').nth(SEGMENT.FOUR))
.click(Selector('.segment-parent').nth(SEGMENT.FOUR))
.click(Selector('.segment-parent').nth(SEGMENT.FOUR))
.click(Selector('.segment-parent').nth(SEGMENT.FOUR)).wait(500)
.expect(Selector('.segment-parent').nth(SEGMENT.ONE).textContent).eql("AHAU")
.expect(Selector('.segment-parent').nth(SEGMENT.TWO).textContent).eql("NUSB")
.expect(Selector('.segment-parent').nth(SEGMENT.THREE).textContent).eql("NGAU");
@@ -411,7 +411,7 @@ test('LevelRotation', async t => {
.click(Selector('.segment-parent').nth(SEGMENT.THREE))
.click(Selector('.segment-parent').nth(SEGMENT.THREE))
.expect(Selector('.segment-parent').nth(SEGMENT.THREE).getStyleProperty('transform')).eql("matrix(0, -1, 1, 0, 0, 0)")
.wait(3500)
.wait(3700)
.expect(Selector('.segment-parent').nth(SEGMENT.THREE).getStyleProperty('transform')).eql("matrix(0, -1, 1, 0, 0, 0)")
.expect(Selector('.segment-parent').nth(SEGMENT.FOUR).getStyleProperty('transform')).eql("matrix(0, 1, -1, 0, 0, 0)")
.click(Selector('.segment-parent').nth(SEGMENT.THREE))
@@ -476,4 +476,39 @@ test('Themes', async t => {
.expect(Selector("body.green").visible).ok()
}).before(async t => {
await testLocalStorageSet("currentTheme", "dark");
});
test('Sharing', async t => {
let overrideWindowOpener = ClientFunction(() => {
window.open = (url, blank, noopener) => {
window.lastWindowOpened = [url, blank, noopener];
}
});
let getLastWindowOpened = ClientFunction(() => {
return window.lastWindowOpened;
});
await waitForMainMenu(t);
await overrideWindowOpener();
await t
.expect(Selector(".share-icon").nth(0).exists).eql(false)
.expect(Selector(".share-icon").nth(1).exists).eql(false)
.click(Selector("#share-button"))
.expect(Selector(".share-icon").nth(0).visible).ok()
.expect(Selector(".share-icon").nth(1).visible).ok()
.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"]);
await t
.click(Selector("#share-button"))
.expect(Selector(".share-icon").nth(0).visible).ok()
.expect(Selector(".share-icon").nth(1).visible).ok()
.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"]);
});