-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e56b851
commit ab0d608
Showing
7 changed files
with
152 additions
and
151 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { expect } from '@playwright/test' | ||
import { launchGame } from '../fixtures/launch-game' | ||
import { secondsToMilliseconds } from 'date-fns' | ||
import { GamePage } from '../pages/game.page' | ||
import { users } from '../data' | ||
|
||
launchGame('configure game server', async ({ steamIds, gameNumber, pages, page, gameServer }) => { | ||
const players = steamIds.slice(0, 12) | ||
|
||
await Promise.all( | ||
players.map(async steamId => { | ||
const page = new GamePage(pages.get(steamId)!, gameNumber) | ||
await expect(page.gameEvent('Game server assigned')).toBeVisible() | ||
|
||
const connectString = page.connectString() | ||
await expect(connectString).toHaveText(/^connect .+;\s?password (.+)$/, { | ||
timeout: secondsToMilliseconds(30), | ||
}) | ||
|
||
const [, password] = | ||
(await connectString.innerText()).match(/^connect .+;\s?password (.+)$/) ?? [] | ||
expect(gameServer.cvar('sv_password').value).toEqual(password) | ||
|
||
await expect(page.gameEvent('Game server initialized')).toBeVisible() | ||
await expect(page.joinGameButton()).toBeVisible() | ||
|
||
expect(gameServer.addedPlayers.some(p => p.steamId64 === steamId)).toBe(true) | ||
}), | ||
) | ||
|
||
const gamePage = new GamePage(page, gameNumber) | ||
await gamePage.goto() | ||
await expect(gamePage.connectString()).toHaveText(/^connect ([a-z0-9\s.:]+)(;\s?password tv)?$/) | ||
await expect(gamePage.watchStvButton()).toBeVisible() | ||
|
||
const adminsPage = new GamePage(pages.get(users[0].steamId)!, gameNumber) | ||
await adminsPage.forceEnd() | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { secondsToMilliseconds } from 'date-fns' | ||
import { expect, launchGame } from '../fixtures/launch-game' | ||
import { GamePage } from '../pages/game.page' | ||
import { users } from '../data' | ||
|
||
launchGame( | ||
'update player connection status', | ||
async ({ steamIds, gameNumber, pages, gameServer }) => { | ||
const players = steamIds.slice(0, 12) | ||
|
||
await Promise.all( | ||
players.map(async steamId => { | ||
const page = new GamePage(pages.get(steamId)!, gameNumber) | ||
const playerName = users.find(u => u.steamId === steamId)!.name | ||
|
||
await expect(page.gameEvent('Game server initialized')).toBeVisible({ | ||
timeout: secondsToMilliseconds(30), | ||
}) | ||
|
||
const slot = page.playerSlot(playerName) | ||
|
||
await gameServer.playerConnects(playerName) | ||
await expect(slot.getByLabel('Player connection status')).toHaveClass(/joining/) | ||
|
||
await gameServer.playerJoinsTeam(playerName) | ||
await expect(slot.getByLabel('Player connection status')).toHaveClass(/connected/) | ||
}), | ||
) | ||
|
||
const adminsPage = new GamePage(pages.get(users[0].steamId)!, gameNumber) | ||
await adminsPage.forceEnd() | ||
}, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters