übertrag zu laptop
This commit is contained in:
parent
d2a5489c32
commit
9678354c92
@ -5971,18 +5971,18 @@ class LevelSite extends WordRotatorBaseSite {
|
|||||||
let soundManager = SoundManager.getInstance();
|
let soundManager = SoundManager.getInstance();
|
||||||
let audioOptions = soundManager.get(SoundManager.CHANNELS.SOUND);
|
let audioOptions = soundManager.get(SoundManager.CHANNELS.SOUND);
|
||||||
|
|
||||||
this.coinPromise = Promise.all([new Promise((r) => {
|
this.coinPromise = this.coinPromise.then(() => {
|
||||||
setTimeout(() => {
|
coinsBefore = parseInt(Helper.nonNull(localStorage.getItem("coins"), "0"));
|
||||||
r(continueButton.fadeIn());
|
localStorage.setItem("coins", coinsBefore + parseInt(coinsPerLevel));
|
||||||
}, 500);
|
}).then(() => {
|
||||||
}), audioOptions.loadedPromise.catch(e => {
|
return Promise.all([new Promise((r) => {
|
||||||
console.error(e);
|
setTimeout(() => {
|
||||||
}),
|
r(continueButton.fadeIn());
|
||||||
this.coinPromise.then(() => {
|
}, 500);
|
||||||
coinsBefore = parseInt(Helper.nonNull(localStorage.getItem("coins"), "0"));
|
}), audioOptions.loadedPromise.catch(e => {
|
||||||
localStorage.setItem("coins", coinsBefore + parseInt(coinsPerLevel));
|
console.error(e);
|
||||||
})
|
})]);
|
||||||
]);
|
});
|
||||||
|
|
||||||
this.wonParams.aborted = false;
|
this.wonParams.aborted = false;
|
||||||
|
|
||||||
@ -6003,13 +6003,18 @@ class LevelSite extends WordRotatorBaseSite {
|
|||||||
this.coinAction.redraw();
|
this.coinAction.redraw();
|
||||||
}
|
}
|
||||||
}, timeout / 2);
|
}, timeout / 2);
|
||||||
|
setTimeout(r, timeout);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
r();
|
||||||
}
|
}
|
||||||
//Always do the next promise for garbage collection
|
//Always do the next promise for garbage collection
|
||||||
setTimeout(r, timeout);
|
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.coinPromise = this.coinPromise.catch((e) => {console.error(e);});
|
||||||
|
|
||||||
this.wonTextScaler();
|
this.wonTextScaler();
|
||||||
this.continueButtonScaler();
|
this.continueButtonScaler();
|
||||||
this.levelScaler();
|
this.levelScaler();
|
||||||
|
|||||||
@ -227,18 +227,18 @@ export class LevelSite extends WordRotatorBaseSite {
|
|||||||
let soundManager = SoundManager.getInstance();
|
let soundManager = SoundManager.getInstance();
|
||||||
let audioOptions = soundManager.get(SoundManager.CHANNELS.SOUND);
|
let audioOptions = soundManager.get(SoundManager.CHANNELS.SOUND);
|
||||||
|
|
||||||
this.coinPromise = Promise.all([new Promise((r) => {
|
this.coinPromise = this.coinPromise.then(() => {
|
||||||
setTimeout(() => {
|
coinsBefore = parseInt(Helper.nonNull(localStorage.getItem("coins"), "0"));
|
||||||
r(continueButton.fadeIn());
|
localStorage.setItem("coins", coinsBefore + parseInt(coinsPerLevel));
|
||||||
}, 500)
|
}).then(() => {
|
||||||
}), audioOptions.loadedPromise.catch(e => {
|
return Promise.all([new Promise((r) => {
|
||||||
console.error(e)
|
setTimeout(() => {
|
||||||
}),
|
r(continueButton.fadeIn());
|
||||||
this.coinPromise.then(() => {
|
}, 500)
|
||||||
coinsBefore = parseInt(Helper.nonNull(localStorage.getItem("coins"), "0"));
|
}), audioOptions.loadedPromise.catch(e => {
|
||||||
localStorage.setItem("coins", coinsBefore + parseInt(coinsPerLevel));
|
console.error(e)
|
||||||
})
|
})]);
|
||||||
]);
|
});
|
||||||
|
|
||||||
this.wonParams.aborted = false;
|
this.wonParams.aborted = false;
|
||||||
|
|
||||||
@ -259,13 +259,18 @@ export class LevelSite extends WordRotatorBaseSite {
|
|||||||
this.coinAction.redraw();
|
this.coinAction.redraw();
|
||||||
}
|
}
|
||||||
}, timeout / 2);
|
}, timeout / 2);
|
||||||
|
setTimeout(r, timeout);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
r();
|
||||||
}
|
}
|
||||||
//Always do the next promise for garbage collection
|
//Always do the next promise for garbage collection
|
||||||
setTimeout(r, timeout);
|
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.coinPromise = this.coinPromise.catch((e) => {console.error(e)});
|
||||||
|
|
||||||
this.wonTextScaler();
|
this.wonTextScaler();
|
||||||
this.continueButtonScaler();
|
this.continueButtonScaler();
|
||||||
this.levelScaler();
|
this.levelScaler();
|
||||||
|
|||||||
@ -23,7 +23,7 @@ async function afterEachTest(t) {
|
|||||||
return await t.eval(() => indexedDB.deleteDatabase('wordRotator'));
|
return await t.eval(() => indexedDB.deleteDatabase('wordRotator'));
|
||||||
}
|
}
|
||||||
|
|
||||||
let isLocal = false;
|
let isLocal = true;
|
||||||
if (isLocal) {
|
if (isLocal) {
|
||||||
fixture`Play`
|
fixture`Play`
|
||||||
.page`https://127.0.0.1/pwa/wordRotator/publicTest/`.beforeEach(async t => {
|
.page`https://127.0.0.1/pwa/wordRotator/publicTest/`.beforeEach(async t => {
|
||||||
@ -46,6 +46,7 @@ else {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const extraCoins = 50;
|
||||||
const coinsPerLevel = 5;
|
const coinsPerLevel = 5;
|
||||||
const dragDimen = 250;
|
const dragDimen = 250;
|
||||||
const helpCost = 25;
|
const helpCost = 25;
|
||||||
@ -74,18 +75,32 @@ const SEGMENT = {
|
|||||||
TWENTYONE: 20
|
TWENTYONE: 20
|
||||||
};
|
};
|
||||||
|
|
||||||
test('Play', async t => {
|
test.only('Play', async t => {
|
||||||
await t
|
await t
|
||||||
//Main Menu
|
//Main Menu
|
||||||
.click(Selector('#play-button'))
|
.click(Selector('#play-button'))
|
||||||
|
|
||||||
|
//firstTutorial
|
||||||
|
.expect(Selector('.tutorial-text .step-1').visible).eql(true)
|
||||||
|
.expect(Selector('.tutorial-text .step-2').visible).eql(false)
|
||||||
|
.click(Selector('.segment-parent').nth(SEGMENT.THREE))
|
||||||
|
.expect(Selector('.tutorial-text .step-2').visible).eql(true)
|
||||||
|
.expect(Selector('.tutorial-text .step-1').visible).eql(false)
|
||||||
|
.click(Selector('.segment-parent').nth(SEGMENT.THREE))
|
||||||
|
.expect(Selector('.tutorial-text .step-2').visible).eql(true)
|
||||||
|
.click(Selector('.segment-parent').nth(SEGMENT.THREE))
|
||||||
|
.expect(Selector('#continue-button').visible).eql(true)
|
||||||
|
.wait(3500)
|
||||||
|
.click(Selector('#continue-button'))
|
||||||
|
|
||||||
//first Level
|
//first Level
|
||||||
.expect(Selector('.segment.segment-parent.rotate-90').nth(0).getStyleProperty('transform')).eql("matrix(0, 1, -1, 0, 0, 0)")
|
.expect(Selector('.segment.segment-parent.rotate-90').nth(0).getStyleProperty('transform')).eql("matrix(0, 1, -1, 0, 0, 0)")
|
||||||
.expect(Selector('.segment.segment-parent.rotate-90').nth(1).getStyleProperty('transform')).eql("matrix(0, 1, -1, 0, 0, 0)")
|
.expect(Selector('.segment.segment-parent.rotate-90').nth(1).getStyleProperty('transform')).eql("matrix(0, 1, -1, 0, 0, 0)")
|
||||||
.expect(Selector('.segment.segment-parent.rotate-270').getStyleProperty('transform')).eql("matrix(0, -1, 1, 0, 0, 0)")
|
.expect(Selector('.segment.segment-parent.rotate-270').getStyleProperty('transform')).eql("matrix(0, -1, 1, 0, 0, 0)")
|
||||||
.expect(Selector('#won-text').visible).eql(false)
|
.expect(Selector('#won-text').visible).eql(false)
|
||||||
.expect(Selector('#continue-button').visible).eql(false)
|
.expect(Selector('#continue-button').visible).eql(false)
|
||||||
.expect(Selector('#level-number').textContent).eql("1")
|
.expect(Selector('#level-number').textContent).eql("2")
|
||||||
|
.click(Selector("#help-button"))
|
||||||
.click(Selector('.segment-parent').nth(SEGMENT.THREE))
|
.click(Selector('.segment-parent').nth(SEGMENT.THREE))
|
||||||
.expect(Selector('.segment.segment-parent.rotate-360').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)")
|
||||||
.click(Selector('.segment-parent').nth(SEGMENT.ONE))
|
.click(Selector('.segment-parent').nth(SEGMENT.ONE))
|
||||||
@ -98,7 +113,7 @@ test('Play', async t => {
|
|||||||
.expect(Selector('#won-text').visible).eql(true)
|
.expect(Selector('#won-text').visible).eql(true)
|
||||||
.expect(Selector('#continue-button').visible).eql(true)
|
.expect(Selector('#continue-button').visible).eql(true)
|
||||||
.click(Selector('#continue-button'))
|
.click(Selector('#continue-button'))
|
||||||
.expect(Selector('.coin-counter').innerText).eql("" + coinsPerLevel)
|
.expect(Selector('.coin-counter').innerText).eql("" + (coinsPerLevel*2+extraCoins-helpCost))
|
||||||
|
|
||||||
//TWOLevel
|
//TWOLevel
|
||||||
.expect(Selector('.segment.segment-parent.rotate-270').nth(0).textContent).eql("BOAL")
|
.expect(Selector('.segment.segment-parent.rotate-270').nth(0).textContent).eql("BOAL")
|
||||||
@ -110,7 +125,7 @@ test('Play', async t => {
|
|||||||
.expect(Selector('.segment.segment-parent.rotate-360').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('#continue-button').visible).eql(false)
|
||||||
.expect(Selector('#level-number').textContent).eql("2")
|
.expect(Selector('#level-number').textContent).eql("3")
|
||||||
.expect(Selector('#won-text').visible).eql(false)
|
.expect(Selector('#won-text').visible).eql(false)
|
||||||
.click(Selector('.segment-parent').nth(SEGMENT.TWO))
|
.click(Selector('.segment-parent').nth(SEGMENT.TWO))
|
||||||
.click(Selector('.segment-parent').nth(SEGMENT.ONE))
|
.click(Selector('.segment-parent').nth(SEGMENT.ONE))
|
||||||
@ -122,7 +137,7 @@ test('Play', async t => {
|
|||||||
.expect(Selector('#won-text').visible).eql(true)
|
.expect(Selector('#won-text').visible).eql(true)
|
||||||
.expect(Selector('#continue-button').visible).eql(true)
|
.expect(Selector('#continue-button').visible).eql(true)
|
||||||
.click(Selector('#continue-button'))
|
.click(Selector('#continue-button'))
|
||||||
.expect(Selector('.coin-counter').innerText).eql("" + coinsPerLevel * 2)
|
.expect(Selector('.coin-counter').innerText).eql("" + (coinsPerLevel * 3+extraCoins-helpCost))
|
||||||
|
|
||||||
//THREE Level
|
//THREE Level
|
||||||
.expect(Selector('.segment-parent').nth(SEGMENT.ONE).textContent).eql("ZEHO")
|
.expect(Selector('.segment-parent').nth(SEGMENT.ONE).textContent).eql("ZEHO")
|
||||||
@ -139,7 +154,7 @@ test('Play', async t => {
|
|||||||
.click(Selector('.segment-parent').nth(SEGMENT.FOUR))
|
.click(Selector('.segment-parent').nth(SEGMENT.FOUR))
|
||||||
.click(Selector('.segment-parent').nth(SEGMENT.FIVE))
|
.click(Selector('.segment-parent').nth(SEGMENT.FIVE))
|
||||||
.click(Selector('#continue-button'))
|
.click(Selector('#continue-button'))
|
||||||
.expect(Selector('.coin-counter').innerText).eql("" + coinsPerLevel * 3)
|
.expect(Selector('.coin-counter').innerText).eql("" + (coinsPerLevel * 4+extraCoins-helpCost))
|
||||||
|
|
||||||
//4. Level
|
//4. Level
|
||||||
.expect(Selector('.segment-parent').nth(SEGMENT.ONE).textContent).eql("FERÜINCKPHREYSSI")
|
.expect(Selector('.segment-parent').nth(SEGMENT.ONE).textContent).eql("FERÜINCKPHREYSSI")
|
||||||
@ -194,11 +209,13 @@ test('Play', async t => {
|
|||||||
.click(Selector('.segment-parent').nth(SEGMENT.SIX))
|
.click(Selector('.segment-parent').nth(SEGMENT.SIX))
|
||||||
.expect(Selector('#continue-button').visible).eql(true)
|
.expect(Selector('#continue-button').visible).eql(true)
|
||||||
.expect(Selector('#won-text').visible).eql(true)
|
.expect(Selector('#won-text').visible).eql(true)
|
||||||
|
.wait(1000)
|
||||||
|
.debug()
|
||||||
.click(Selector('#continue-button'))
|
.click(Selector('#continue-button'))
|
||||||
.expect(Selector('.coin-counter').innerText).eql("" + coinsPerLevel * 4)
|
.expect(Selector('.coin-counter').innerText).eql("" + (coinsPerLevel * 5+extraCoins-helpCost))
|
||||||
|
|
||||||
//5. Level
|
//5. Level
|
||||||
.expect(Selector('#level-number').textContent).eql("5")
|
.expect(Selector('#level-number').textContent).eql("6")
|
||||||
.expect(Selector('.segment-parent').nth(SEGMENT.ONE).textContent).eql("BEANTOBEALBALEUM")
|
.expect(Selector('.segment-parent').nth(SEGMENT.ONE).textContent).eql("BEANTOBEALBALEUM")
|
||||||
.expect(Selector('.segment-parent').nth(SEGMENT.SIX).textContent).eql("NUTUNGNGRGHAIEUS")
|
.expect(Selector('.segment-parent').nth(SEGMENT.SIX).textContent).eql("NUTUNGNGRGHAIEUS")
|
||||||
.expect(Selector('.segment-parent').nth(SEGMENT.ONE).getStyleProperty('transform')).eql("matrix(1, 0, 0, 1, 0, 0)")
|
.expect(Selector('.segment-parent').nth(SEGMENT.ONE).getStyleProperty('transform')).eql("matrix(1, 0, 0, 1, 0, 0)")
|
||||||
@ -229,11 +246,11 @@ test('Play', async t => {
|
|||||||
.expect(Selector('#won-text').visible).eql(true)
|
.expect(Selector('#won-text').visible).eql(true)
|
||||||
.expect(Selector('#continue-button').visible).eql(true)
|
.expect(Selector('#continue-button').visible).eql(true)
|
||||||
.click(Selector('#continue-button'))
|
.click(Selector('#continue-button'))
|
||||||
.expect(Selector('.coin-counter').innerText).eql("" + coinsPerLevel * 5)
|
.expect(Selector('.coin-counter').innerText).eql("" + (coinsPerLevel * 6+extraCoins-helpCost))
|
||||||
|
|
||||||
|
|
||||||
//Level 6
|
//Level 6
|
||||||
.expect(Selector('#level-number').textContent).eql("6")
|
.expect(Selector('#level-number').textContent).eql("7")
|
||||||
.expect(Selector('.segment-parent').nth(SEGMENT.ONE).textContent).eql("FEGEHLISARBEBERE")
|
.expect(Selector('.segment-parent').nth(SEGMENT.ONE).textContent).eql("FEGEHLISARBEBERE")
|
||||||
.expect(Selector('.segment-parent').nth(SEGMENT.ONE).getStyleProperty('transform')).eql("matrix(1, 0, 0, 1, 0, 0)")
|
.expect(Selector('.segment-parent').nth(SEGMENT.ONE).getStyleProperty('transform')).eql("matrix(1, 0, 0, 1, 0, 0)")
|
||||||
.expect(Selector('.segment-parent').nth(SEGMENT.TEN).getStyleProperty('transform')).eql("matrix(-1, 0, 0, -1, 0, 0)")
|
.expect(Selector('.segment-parent').nth(SEGMENT.TEN).getStyleProperty('transform')).eql("matrix(-1, 0, 0, -1, 0, 0)")
|
||||||
@ -281,7 +298,7 @@ test('Play', async t => {
|
|||||||
.expect(Selector('#continue-button').visible).eql(true)
|
.expect(Selector('#continue-button').visible).eql(true)
|
||||||
.expect(Selector('#won-text').visible).eql(true)
|
.expect(Selector('#won-text').visible).eql(true)
|
||||||
.click(Selector('#continue-button'))
|
.click(Selector('#continue-button'))
|
||||||
.expect(Selector('.coin-counter').innerText).eql("" + coinsPerLevel * 6)
|
.expect(Selector('.coin-counter').innerText).eql("" + (coinsPerLevel * 7+extraCoins-helpCost))
|
||||||
|
|
||||||
|
|
||||||
//Level 7
|
//Level 7
|
||||||
@ -326,7 +343,7 @@ test('Play', async t => {
|
|||||||
// .click(Selector('.segment-parent').nth(SEGMENT.THIRTEEN))
|
// .click(Selector('.segment-parent').nth(SEGMENT.THIRTEEN))
|
||||||
.click(Selector('#help-button'))
|
.click(Selector('#help-button'))
|
||||||
.wait(5000)
|
.wait(5000)
|
||||||
.expect(Selector('.coin-counter').innerText).eql("" + (coinsPerLevel * 7 - helpCost))
|
.expect(Selector('.coin-counter').innerText).eql("" + (coinsPerLevel * 8 - helpCost+extraCoins-helpCost))
|
||||||
|
|
||||||
.expect(Selector('#won-text').visible).eql(true)
|
.expect(Selector('#won-text').visible).eql(true)
|
||||||
.expect(Selector('#continue-button').visible).eql(true)
|
.expect(Selector('#continue-button').visible).eql(true)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user