Merge pull request #77 from thecodingmachine/e2efix
Fixing Cypress tests
This commit is contained in:
commit
587caf968c
@ -4,7 +4,6 @@ import {CurrentGamerInterface, GamerInterface, hasMovedEventName, Player} from "
|
|||||||
import {DEBUG_MODE, RESOLUTION, ROOM, ZOOM_LEVEL} from "../../Enum/EnvironmentVariable";
|
import {DEBUG_MODE, RESOLUTION, ROOM, ZOOM_LEVEL} from "../../Enum/EnvironmentVariable";
|
||||||
import Tile = Phaser.Tilemaps.Tile;
|
import Tile = Phaser.Tilemaps.Tile;
|
||||||
import {ITiledMap, ITiledTileSet} from "../Map/ITiledMap";
|
import {ITiledMap, ITiledTileSet} from "../Map/ITiledMap";
|
||||||
import {cypressAsserter} from "../../Cypress/CypressAsserter";
|
|
||||||
|
|
||||||
export const GameSceneName = "GameScene";
|
export const GameSceneName = "GameScene";
|
||||||
export enum Textures {
|
export enum Textures {
|
||||||
@ -41,7 +40,6 @@ export class GameScene extends Phaser.Scene implements GameSceneInterface{
|
|||||||
//hook preload scene
|
//hook preload scene
|
||||||
preload(): void {
|
preload(): void {
|
||||||
this.GameManager.setCurrentGameScene(this);
|
this.GameManager.setCurrentGameScene(this);
|
||||||
cypressAsserter.preloadStarted();
|
|
||||||
let mapUrl = 'maps/map.json';
|
let mapUrl = 'maps/map.json';
|
||||||
this.load.on('filecomplete-tilemapJSON-'+Textures.Map, (key: string, type: string, data: any) => {
|
this.load.on('filecomplete-tilemapJSON-'+Textures.Map, (key: string, type: string, data: any) => {
|
||||||
// Triggered when the map is loaded
|
// Triggered when the map is loaded
|
||||||
@ -62,8 +60,6 @@ export class GameScene extends Phaser.Scene implements GameSceneInterface{
|
|||||||
{ frameWidth: 32, frameHeight: 32 }
|
{ frameWidth: 32, frameHeight: 32 }
|
||||||
);
|
);
|
||||||
this.load.bitmapFont('main_font', 'resources/fonts/arcade.png', 'resources/fonts/arcade.xml');
|
this.load.bitmapFont('main_font', 'resources/fonts/arcade.png', 'resources/fonts/arcade.xml');
|
||||||
|
|
||||||
cypressAsserter.preloadFinished();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//hook initialisation
|
//hook initialisation
|
||||||
@ -72,8 +68,6 @@ export class GameScene extends Phaser.Scene implements GameSceneInterface{
|
|||||||
|
|
||||||
//hook create scene
|
//hook create scene
|
||||||
create(): void {
|
create(): void {
|
||||||
cypressAsserter.initStarted();
|
|
||||||
|
|
||||||
//initalise map
|
//initalise map
|
||||||
this.Map = this.add.tilemap("map");
|
this.Map = this.add.tilemap("map");
|
||||||
this.map.tilesets.forEach((tileset: ITiledTileSet) => {
|
this.map.tilesets.forEach((tileset: ITiledTileSet) => {
|
||||||
@ -113,7 +107,6 @@ export class GameScene extends Phaser.Scene implements GameSceneInterface{
|
|||||||
|
|
||||||
//initialise camera
|
//initialise camera
|
||||||
this.initCamera();
|
this.initCamera();
|
||||||
cypressAsserter.initFinished();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//todo: in a dedicated class/function?
|
//todo: in a dedicated class/function?
|
||||||
@ -174,7 +167,7 @@ export class GameScene extends Phaser.Scene implements GameSceneInterface{
|
|||||||
this.createCollisionObject();
|
this.createCollisionObject();
|
||||||
this.CurrentPlayer.on(hasMovedEventName, this.pushPlayerPosition.bind(this))
|
this.CurrentPlayer.on(hasMovedEventName, this.pushPlayerPosition.bind(this))
|
||||||
}
|
}
|
||||||
|
|
||||||
pushPlayerPosition(event: HasMovedEvent) {
|
pushPlayerPosition(event: HasMovedEvent) {
|
||||||
this.GameManager.pushPlayerPosition(event);
|
this.GameManager.pushPlayerPosition(event);
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ import {TextInput} from "../Components/TextInput";
|
|||||||
import {ClickButton} from "../Components/ClickButton";
|
import {ClickButton} from "../Components/ClickButton";
|
||||||
import {GameSceneName} from "../Game/GameScene";
|
import {GameSceneName} from "../Game/GameScene";
|
||||||
import Image = Phaser.GameObjects.Image;
|
import Image = Phaser.GameObjects.Image;
|
||||||
|
import {cypressAsserter} from "../../Cypress/CypressAsserter";
|
||||||
|
|
||||||
//todo: put this constants in a dedicated file
|
//todo: put this constants in a dedicated file
|
||||||
export const LoginSceneName = "LoginScene";
|
export const LoginSceneName = "LoginScene";
|
||||||
@ -28,13 +29,17 @@ export class LogincScene extends Phaser.Scene {
|
|||||||
}
|
}
|
||||||
|
|
||||||
preload() {
|
preload() {
|
||||||
|
cypressAsserter.preloadStarted();
|
||||||
//this.load.image(LoginTextures.playButton, "resources/objects/play_button.png");
|
//this.load.image(LoginTextures.playButton, "resources/objects/play_button.png");
|
||||||
this.load.image(LoginTextures.icon, "resources/logos/tcm_full.png");
|
this.load.image(LoginTextures.icon, "resources/logos/tcm_full.png");
|
||||||
// Note: arcade.png from the Phaser 3 examples at: https://github.com/photonstorm/phaser3-examples/tree/master/public/assets/fonts/bitmap
|
// Note: arcade.png from the Phaser 3 examples at: https://github.com/photonstorm/phaser3-examples/tree/master/public/assets/fonts/bitmap
|
||||||
this.load.bitmapFont(LoginTextures.mainFont, 'resources/fonts/arcade.png', 'resources/fonts/arcade.xml');
|
this.load.bitmapFont(LoginTextures.mainFont, 'resources/fonts/arcade.png', 'resources/fonts/arcade.xml');
|
||||||
|
cypressAsserter.preloadFinished();
|
||||||
}
|
}
|
||||||
|
|
||||||
create() {
|
create() {
|
||||||
|
cypressAsserter.initStarted();
|
||||||
|
|
||||||
this.textField = new TextField(this, this.game.renderer.width / 2, 50, 'Enter your name:');
|
this.textField = new TextField(this, this.game.renderer.width / 2, 50, 'Enter your name:');
|
||||||
this.textField.setOrigin(0.5).setCenterAlign()
|
this.textField.setOrigin(0.5).setCenterAlign()
|
||||||
this.nameInput = new TextInput(this, this.game.renderer.width / 2 - 64, 70, 4);
|
this.nameInput = new TextInput(this, this.game.renderer.width / 2 - 64, 70, 4);
|
||||||
@ -59,7 +64,7 @@ export class LogincScene extends Phaser.Scene {
|
|||||||
}
|
}
|
||||||
return this.login(name);
|
return this.login(name);
|
||||||
});
|
});
|
||||||
|
cypressAsserter.initFinished();
|
||||||
}
|
}
|
||||||
|
|
||||||
update(time: number, delta: number): void {
|
update(time: number, delta: number): void {
|
||||||
|
Loading…
Reference in New Issue
Block a user