Skip to content

Commit

Permalink
gh-147: Add goToDashboard in CreatePlayerPage
Browse files Browse the repository at this point in the history
  • Loading branch information
littlewhywhat committed Apr 17, 2020
1 parent 12009c2 commit 41f2f83
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
8 changes: 7 additions & 1 deletion cypress/integration/pages/CreatePlayerPage.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { Page } from './Page'
import { SelectGamePage } from './SelectGamePage'
import { Player } from '../types/Player'
import { DashboardPage } from './DashboardPage'

export class CreatePlayerPage extends Page {
constructor(gameName: string) {
constructor(private gameName: string) {
super(`/${gameName}/add-player`)
}

Expand All @@ -17,6 +18,11 @@ export class CreatePlayerPage extends Page {
return new SelectGamePage()
}

goToDashboard(): DashboardPage {
this.getHeader().get('#title-link').click()
return new DashboardPage(this.gameName)
}

addPlayer(player: Player, score: number): CreatePlayerPage {
const content = this.getContent()
content.get('#player-name-input').clear().type(player.name)
Expand Down
3 changes: 1 addition & 2 deletions cypress/integration/tests/create-player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ describe('Create player page', () => {
})
it('is seen in the leaderboard without reload', () => {
const leaderboard = addPlayerPage
.goToSelectGamePage()
.selectGame(FOOSBALL_GAME.name)
.goToDashboard()
.goToLeaderboard()
leaderboard.locatePlayerWithScore(player, score)
})
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/app/Game.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export class GameComponent extends Component {
{ selection.status === SelectionStatus.SELECTED
? <>
<span id='title'>
<SimpleLink to={url}>{capitalize(selection.value.name)}</SimpleLink>
<SimpleLink id='title-link' to={url}>{capitalize(selection.value.name)}</SimpleLink>
</span>
<SimpleButton onClick={createMatch}>Add Match</SimpleButton>
</>
Expand Down
1 change: 1 addition & 0 deletions frontend/src/app/__snapshots__/Game.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ exports[`GameComponent when foosball is selected renders button "Add Match" and
id="title"
>
<Styled(Link)
id="title-link"
to="/foosball"
>
Foosball
Expand Down

0 comments on commit 41f2f83

Please sign in to comment.