-
Notifications
You must be signed in to change notification settings - Fork 1
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
36eddf8
commit 99269f0
Showing
19 changed files
with
285 additions
and
41 deletions.
There are no files selected for viewing
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,36 @@ | ||
import { Page } from './Page' | ||
import { Player } from '../types/Player' | ||
import { DashboardPage } from './DashboardPage' | ||
|
||
export class AddMatchPage extends Page { | ||
constructor(private gameName: string) { | ||
super(`/${gameName}/create-match`) | ||
} | ||
|
||
visit(): AddMatchPage { | ||
super.visit() | ||
return this | ||
} | ||
|
||
locate(): void { | ||
super.locate() | ||
this.getContent() | ||
.should('contain.text', 'Team 1') | ||
.should('contain.text', 'Team 2') | ||
} | ||
|
||
selectTeam1Player1(player: Player): AddMatchPage { | ||
cy.get('#team1-player-input-0').select(player.name) | ||
return this | ||
} | ||
|
||
selectTeam2Player1(player: Player): AddMatchPage { | ||
cy.get('#team2-player-input-0').select(player.name) | ||
return this | ||
} | ||
|
||
team1Wins(): DashboardPage { | ||
cy.get('#team1-win-button').click() | ||
return new DashboardPage(this.gameName) | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { Page } from './Page' | ||
|
||
export class MatchListPage extends Page { | ||
constructor(private gameName: string) { | ||
super(`/${gameName}/match-list`) | ||
} | ||
} |
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,44 @@ | ||
import { AddMatchPage } from '../pages/AddMatchPage' | ||
import { FOOSBALL_GAME } from '../utils/data' | ||
import { AddPlayerPage } from '../pages/AddPlayerPage' | ||
import { generateRandomPlayer } from '../utils/gen' | ||
import { LeaderboardPage } from '../pages/LeaderboardPage' | ||
|
||
describe('Create match page', () => { | ||
const addMatchPage = new AddMatchPage(FOOSBALL_GAME.name) | ||
before(() => { | ||
addMatchPage.visit() | ||
}) | ||
it('renders', () => { | ||
addMatchPage.locate() | ||
}) | ||
}) | ||
|
||
describe('Leaderboard', () => { | ||
const player1 = generateRandomPlayer() | ||
const player1score = 1010 | ||
const player1newscore= 1026 | ||
const player2 = generateRandomPlayer() | ||
const player2score = 1020 | ||
const player2newscore= 1004 | ||
describe('when player 1 and player 2 exist in foosball and first wins once over second', () => { | ||
let leaderboard: LeaderboardPage | ||
beforeEach(() => { | ||
leaderboard = new AddPlayerPage(FOOSBALL_GAME.name) | ||
.visit() | ||
.addPlayer(player1, player1score) | ||
.addPlayer(player2, player2score) | ||
.goToSelectGamePage() | ||
.selectGame(FOOSBALL_GAME.name) | ||
.goToAddMatch() | ||
.selectTeam1Player1(player1) | ||
.selectTeam2Player1(player2) | ||
.team1Wins() | ||
.goToLeaderboard() | ||
}) | ||
it('contains players with resulting scores', () => { | ||
leaderboard.locatePlayerWithScore(player1, player1newscore) | ||
leaderboard.locatePlayerWithScore(player2, player2newscore) | ||
}) | ||
}) | ||
}) |
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,72 @@ | ||
import { AddPlayerPage } from '../pages/AddPlayerPage' | ||
import { FOOSBALL_GAME, TENNIS_GAME } from '../utils/data' | ||
import { Player } from '../types/Player' | ||
import { generateRandomPlayer } from '../utils/gen' | ||
|
||
describe('Add player page', () => { | ||
const addPlayerPage = new AddPlayerPage(FOOSBALL_GAME.name) | ||
before(() => { | ||
addPlayerPage.visit() | ||
}) | ||
it('renders', () => { | ||
addPlayerPage.locate() | ||
}) | ||
describe('when a random player is added to foosball', () => { | ||
let player: Player | ||
const score = 1001 | ||
beforeEach(() => { | ||
player = generateRandomPlayer() | ||
addPlayerPage.addPlayer(player, score) | ||
}) | ||
it('is seen in the leaderboard without reload', () => { | ||
const leaderboard = addPlayerPage | ||
.goToSelectGamePage() | ||
.selectGame(FOOSBALL_GAME.name) | ||
.goToLeaderboard() | ||
leaderboard.locatePlayerWithScore(player, score) | ||
}) | ||
}) | ||
}) | ||
|
||
describe('A player added to foosball is not added to tennis', () => { | ||
const addPlayerPage = new AddPlayerPage(FOOSBALL_GAME.name) | ||
describe('when a player is added to foosball', () => { | ||
let player: Player | ||
const score = 1001 | ||
beforeEach(() => { | ||
player = generateRandomPlayer() | ||
addPlayerPage | ||
.visit() | ||
.addPlayer(player, score) | ||
}) | ||
it('is not added to tennis', () => { | ||
addPlayerPage | ||
.goToSelectGamePage() | ||
.selectGame(TENNIS_GAME.name) | ||
.goToLeaderboard() | ||
.missPlayerWithScore(player, score) | ||
}) | ||
}) | ||
}) | ||
|
||
describe('Same player can be added to foosball and to tennis', () => { | ||
describe('when a player is added to foosball', () => { | ||
let player: Player | ||
const score = 1001 | ||
beforeEach(() => { | ||
player = generateRandomPlayer() | ||
new AddPlayerPage(FOOSBALL_GAME.name) | ||
.visit() | ||
.addPlayer(player, score) | ||
}) | ||
it('can be added to tennis', () => { | ||
new AddPlayerPage(TENNIS_GAME.name) | ||
.visit() | ||
.addPlayer(player, score) | ||
.goToSelectGamePage() | ||
.selectGame(TENNIS_GAME.name) | ||
.goToLeaderboard() | ||
.locatePlayerWithScore(player, score) | ||
}) | ||
}) | ||
}) |
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
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,11 @@ | ||
import { SelectGamePage } from '../pages/SelectGamePage' | ||
|
||
describe('Select Game Page', () => { | ||
const selectGamePage = new SelectGamePage() | ||
before(() => { | ||
selectGamePage.visit() | ||
}) | ||
it('renders', () => { | ||
selectGamePage.locate() | ||
}) | ||
}) |
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,53 @@ | ||
import { SelectGamePage } from '../pages/SelectGamePage' | ||
import { FOOSBALL_GAME, TENNIS_GAME } from '../utils/data' | ||
|
||
describe('Navigation', () => { | ||
describe('foosball dashboard', () => { | ||
it('is reachable', () => { | ||
new SelectGamePage() | ||
.visit() | ||
.selectGame(FOOSBALL_GAME.name) | ||
.locate() | ||
}) | ||
}) | ||
|
||
describe('foosball add match page', () => { | ||
it('is reachable', () => { | ||
new SelectGamePage() | ||
.visit() | ||
.selectGame(FOOSBALL_GAME.name) | ||
.goToAddMatch() | ||
.locate() | ||
}) | ||
}) | ||
|
||
describe('tennis dashboard after foosball dashboard', () => { | ||
it('is reachable', () => { | ||
new SelectGamePage() | ||
.visit() | ||
.selectGame(FOOSBALL_GAME.name) | ||
.goToGameSelection() | ||
.selectGame(TENNIS_GAME.name) | ||
.locate() | ||
}) | ||
}) | ||
|
||
describe('match list page', () => { | ||
it('is reachable', () => { | ||
new SelectGamePage() | ||
.visit() | ||
.selectGame(FOOSBALL_GAME.name) | ||
.goToMatchesList() | ||
.locate() | ||
}) | ||
}) | ||
describe('leaderboard page', () => { | ||
it('is reachable', () => { | ||
new SelectGamePage() | ||
.visit() | ||
.selectGame(FOOSBALL_GAME.name) | ||
.goToLeaderboard() | ||
.locate() | ||
}) | ||
}) | ||
}) |
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,6 @@ | ||
import { Player } from './Player' | ||
|
||
export interface Team { | ||
player1: Player; | ||
player2: Player; | ||
} |
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 |
---|---|---|
@@ -1,3 +1,23 @@ | ||
import { Player } from '../types/Player' | ||
import { Team } from '../types/Team' | ||
|
||
export const FOOSBALL_GAME = { | ||
name: 'foosball', | ||
} | ||
|
||
export const TENNIS_GAME = { | ||
name: 'tennis', | ||
} | ||
|
||
export const XRadek: Player = { | ||
name: 'XRadek', | ||
} | ||
|
||
export const XTonda: Player = { | ||
name: 'XTonda', | ||
} | ||
|
||
export const Team1: Team = { | ||
player1: XRadek, | ||
player2: XTonda, | ||
} |
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
Oops, something went wrong.