rework the e2e tests to not depend on console.log() and tested the login page

This commit is contained in:
kharhamel 2020-04-27 13:32:19 +02:00
parent 8bd4e81f48
commit a1d87fc8a8
6 changed files with 54 additions and 44 deletions

View file

@ -1,31 +1,37 @@
import {DEBUG_MODE} from "../Enum/EnvironmentVariable";
import {LogincScene} from "../Phaser/Login/LogincScene";
declare let window:any;
//this class is used to communicate with cypress, our e2e testing client
//Since cypress cannot manipulate canvas, we notified it with console logs
class CypressAsserter {
gameStarted = false;
preload = false;
loginPage = false;
gameScene = false;
private loginScene: LogincScene;
constructor() {
window.cypressAsserter = this
}
gameStarted() {
console.log('Started the game')
reachedLoginScene(loginScene: LogincScene) {
this.loginPage = true
this.loginScene = loginScene
}
async remoteConnect(): Promise<void> {
await this.loginScene.loginFromEmail('test@email.com')
//we implement this timeout to give Phaser the time needed to change scene
return new Promise((r) => {
setTimeout(() => r(), 200);
})
}
preloadStarted() {
console.log('Preloading')
}
preloadFinished() {
console.log('Preloading done')
}
initStarted() {
console.log('startInit')
}
initFinished() {
console.log('startInit done')
reachedGameScene() {
this.loginPage = false;
this.gameScene = true;
}
}