-
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
af8c5e4
commit 1bdc71c
Showing
18 changed files
with
260 additions
and
17 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
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
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.