ConceptCreator/e2e/game-model/gamesystems/FindGamesystem.spec.ts
Sebastian Böckelmann 6a8c34df52
Some checks failed
E2E Testing / test (push) Failing after 1m39s
Fix import of GameModel in Testcases
2024-03-22 07:53:02 +01:00

51 lines
2.2 KiB
TypeScript

import { BrowserContext, ElectronApplication, Page, _electron as electron } from 'playwright';
import { test, expect } from '@playwright/test';
import * as PATH from 'path';
import {GameModel} from "../../../src/app/project/gamemodel/GameModel";
import {Gamesystem} from "../../src/app/project/gamemodel/gamesystems/Gamesystem";
import {ScriptAccount} from "../../../src/app/project/gamemodel/scriptAccounts/ScriptAccount";
import {ModelComponentType} from "../../../src/app/project/gamemodel/ModelComponentType";
import {SimpleGamesystem} from "../../../src/app/project/gamemodel/gamesystems/SimpleGamesystem";
import exp = require("node:constants");
import {end} from "electron-debug";
import {GamesystemTrainer} from "./GamesystemTrainer";
test.describe('Test Find Gamesystems', () => {
const GAMEMODELNAME: string = "GameModel";
const SIMPLEGAMESYSTEM_NAME: string = "Simple Gamesystem";
test('Find null or undefined Gamesystem', async () => {
const gameModel = new GameModel(GAMEMODELNAME);
expect(gameModel.findGamesystem(null)).toBeUndefined();
expect(gameModel.findGamesystem(undefined)).toBeUndefined();
})
test('Find non existend Gamesystem', async () => {
const gameModel = new GameModel(GAMEMODELNAME);
expect(gameModel.findGamesystem("Gamesystem")).toBeUndefined();
})
test("Find existend simple Gamesystem on top layer", async () => {
const gameModel = new GameModel(GAMEMODELNAME);
const gamesystem = new SimpleGamesystem(SIMPLEGAMESYSTEM_NAME);
gameModel.addGamesystem(gamesystem);
expect(gameModel.findGamesystem(SIMPLEGAMESYSTEM_NAME)).toBeDefined();
expect(gameModel.findGamesystem(SIMPLEGAMESYSTEM_NAME)).toEqual(gamesystem);
})
test('Find existent product gamesystem on top layer', async () => {
const gameModel = GamesystemTrainer.givenGameModelWithProductGamesytemOnTopLayer();
const result = gameModel.findGamesystem(GamesystemTrainer.TOP_PRODUCT_GAMESYSTEM_NAME);
expect(result).toBeDefined();
})
test('Find existent simple gamesystem on lower layer', async () => {
const gameModel = GamesystemTrainer.givenGameModelWithProductGamesytemOnTopLayer();
const result = gameModel.findGamesystem(GamesystemTrainer.SIMPLEGAMESYSTEMNAME);
expect(result).toBeDefined();
})
});