-
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.
Merge pull request #2 from gastongaiduk/more-cypress-tests
Add almost full coverage tests
- Loading branch information
Showing
14 changed files
with
744 additions
and
69 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
describe('game leaderboards page', () => { | ||
beforeEach(() => { | ||
cy.clearAllLocalStorage() | ||
}) | ||
|
||
it('no leaderboards', () => { | ||
cy.intercept('GET', '**/API/API_GetUserRecentlyPlayedGames.php*', { fixture: 'game-list-without-leaderboard.json' }).as('getRecentlyPlayedGames') | ||
|
||
cy.authenticate('player', 'player-secret') | ||
cy.visit('/') | ||
|
||
cy.intercept('GET', '**/API/API_GetGameLeaderboards.php*', { fixture: 'no-leaderboards.json' }).as('getLeaderboards') | ||
|
||
cy.get('.game-button').click() | ||
|
||
cy.wait('@getLeaderboards').its('response.body') | ||
.should('have.property', 'Results') | ||
|
||
cy.url().should('include', '/game/769/leaderboards') | ||
cy.contains('Kirby & The Amazing Mirror') | ||
cy.contains('No leaderboards found for this game.') | ||
}) | ||
|
||
it('leaderboards list with refresh', () => { | ||
cy.intercept('GET', '**/API/API_GetUserRecentlyPlayedGames.php*', { fixture: 'game-list-with-leaderboard.json' }).as('getRecentlyPlayedGames') | ||
|
||
cy.authenticate('player', 'player-secret') | ||
cy.visit('/') | ||
|
||
cy.intercept('GET', '**/API/API_GetGameLeaderboards.php*', { fixture: 'leaderboards.json' }).as('getLeaderboards') | ||
|
||
cy.get('.game-button').click() | ||
|
||
cy.wait('@getLeaderboards').its('response.body') | ||
.should('have.property', 'Results') | ||
.should('have.length', 10) | ||
|
||
cy.url().should('include', '/game/16557/leaderboards') | ||
cy.contains('Colin McRae Rally') | ||
|
||
cy.get('.leaderboard-list li').eq(1).contains('New Zealand Two') | ||
cy.get('.leaderboard-list li').eq(1).contains('Thebpg13') | ||
cy.get('.leaderboard-list li').eq(1).contains('2:38.36') | ||
|
||
cy.intercept('GET', '**/API/API_GetGameLeaderboards.php*', { fixture: 'leaderboards-refresh.json' }).as('getLeaderboardsRefresh') | ||
|
||
cy.get('.refresh-button').click() | ||
|
||
cy.wait('@getLeaderboardsRefresh').its('response.body') | ||
.should('have.property', 'Results') | ||
.should('have.length', 10) | ||
|
||
cy.get('.leaderboard-list li').eq(1).contains('New Zealand Two') | ||
cy.get('.leaderboard-list li').eq(1).contains('zuliman92') | ||
cy.get('.leaderboard-list li').eq(1).contains('2:35.23') | ||
}) | ||
|
||
it('go back to recently played games', () => { | ||
cy.intercept('GET', '**/API/API_GetUserRecentlyPlayedGames.php*', { fixture: 'game-list-with-leaderboard.json' }).as('getRecentlyPlayedGames') | ||
|
||
cy.authenticate('player', 'player-secret') | ||
cy.visit('/') | ||
|
||
cy.intercept('GET', '**/API/API_GetGameLeaderboards.php*', { fixture: 'leaderboards.json' }).as('getLeaderboards') | ||
|
||
cy.visit('#/game/16557/leaderboards') | ||
|
||
cy.get('.back-button').click() | ||
|
||
cy.url().should('include', '/games') | ||
}) | ||
}) |
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,159 @@ | ||
describe('leaderboard entries page', () => { | ||
beforeEach(() => { | ||
cy.clearAllLocalStorage() | ||
}) | ||
|
||
it('no entries', () => { | ||
cy.intercept('GET', '**/API/API_GetUserRecentlyPlayedGames.php*', { fixture: 'game-list-with-leaderboard.json' }).as('getRecentlyPlayedGames') | ||
|
||
cy.authenticate('player', 'player-secret') | ||
cy.interceptUsersIFollow() | ||
cy.visit('/') | ||
|
||
cy.intercept('GET', '**/API/API_GetGameLeaderboards.php*', { fixture: 'leaderboards.json' }).as('getLeaderboards') | ||
|
||
cy.get('.game-button').click() | ||
|
||
cy.url().should('include', '/game/16557/leaderboards') | ||
cy.contains('Colin McRae Rally') | ||
|
||
cy.intercept('GET', '**/API/API_GetLeaderboardEntries.php*', { fixture: 'no-leaderboard-entries.json' }).as('getLeaderboardEntries') | ||
|
||
cy.get('.leaderboard-list li').eq(1).click() | ||
|
||
cy.url().should('include', '/leaderboard/19063') | ||
cy.contains('Colin McRae Rally') | ||
cy.contains('New Zealand Two') | ||
cy.contains('No entries found for this leaderboard.') | ||
}) | ||
|
||
it('entries with refresh and no entry from me or my friends', () => { | ||
cy.intercept('GET', '**/API/API_GetUserRecentlyPlayedGames.php*', { fixture: 'game-list-with-leaderboard.json' }).as('getRecentlyPlayedGames') | ||
|
||
cy.authenticate('player', 'player-secret') | ||
cy.interceptUsersIFollow() | ||
cy.visit('/') | ||
|
||
cy.intercept('GET', '**/API/API_GetGameLeaderboards.php*', { fixture: 'leaderboards.json' }).as('getLeaderboards') | ||
|
||
cy.get('.game-button').click() | ||
|
||
cy.url().should('include', '/game/16557/leaderboards') | ||
cy.contains('Colin McRae Rally') | ||
|
||
cy.intercept('GET', '**/API/API_GetLeaderboardEntries.php*', { fixture: 'leaderboard-entries.json' }).as('getLeaderboardEntries') | ||
|
||
cy.get('.leaderboard-list li').eq(1).click() | ||
|
||
cy.url().should('include', '/leaderboard/19063') | ||
cy.contains('Colin McRae Rally') | ||
cy.contains('New Zealand Two') | ||
|
||
cy.get('.entries-list li').eq(0).contains('Thebpg13') | ||
cy.get('.entries-list li').eq(0).contains('2:38.36') | ||
|
||
cy.intercept('GET', '**/API/API_GetLeaderboardEntries.php*', { fixture: 'leaderboard-entries-refresh.json' }).as('getLeaderboardEntriesRefresh') | ||
|
||
cy.get('.refresh-button').click() | ||
|
||
cy.wait('@getLeaderboardEntriesRefresh').its('response.body') | ||
.should('have.property', 'Results') | ||
.should('have.length', 10) | ||
|
||
cy.get('.entries-list li').eq(0).contains('josef733') | ||
cy.get('.entries-list li').eq(0).contains('2:34.45') | ||
|
||
cy.get('.entries-list li').eq(1).contains('Thebpg13') | ||
cy.get('.entries-list li').eq(1).contains('2:38.36') | ||
}) | ||
|
||
it('entries with an entry only from me', () => { | ||
cy.intercept('GET', '**/API/API_GetUserRecentlyPlayedGames.php*', { fixture: 'game-list-with-leaderboard.json' }).as('getRecentlyPlayedGames') | ||
|
||
cy.authenticate('matias721744', 'matias721744-secret') | ||
cy.interceptUsersIFollow() | ||
cy.visit('/') | ||
|
||
cy.intercept('GET', '**/API/API_GetGameLeaderboards.php*', { fixture: 'leaderboards.json' }).as('getLeaderboards') | ||
|
||
cy.get('.game-button').click() | ||
|
||
cy.url().should('include', '/game/16557/leaderboards') | ||
cy.contains('Colin McRae Rally') | ||
|
||
cy.intercept('GET', '**/API/API_GetLeaderboardEntries.php*', { fixture: 'leaderboard-entries.json' }).as('getLeaderboardEntries') | ||
|
||
cy.get('.leaderboard-list li').eq(1).click() | ||
|
||
cy.url().should('include', '/leaderboard/19063') | ||
cy.contains('Colin McRae Rally') | ||
cy.contains('New Zealand Two') | ||
|
||
cy.get('.entries-list li').eq(0).contains('matias721744') | ||
cy.get('.entries-list li').eq(0).contains('2:51.55') | ||
|
||
cy.get('.entries-list li').eq(1).contains('Thebpg13') | ||
cy.get('.entries-list li').eq(1).contains('2:38.36') | ||
}) | ||
|
||
it('entries with entry only from a friend', () => { | ||
cy.intercept('GET', '**/API/API_GetUserRecentlyPlayedGames.php*', { fixture: 'game-list-with-leaderboard.json' }).as('getRecentlyPlayedGames') | ||
|
||
cy.authenticate('player', 'player-secret') | ||
cy.intercept('GET', '**/API/API_GetUsersIFollow.php*', { fixture: 'users-i-follow-with-matias.json' }).as('getUsersIFollow') | ||
cy.visit('/') | ||
|
||
cy.intercept('GET', '**/API/API_GetGameLeaderboards.php*', { fixture: 'leaderboards.json' }).as('getLeaderboards') | ||
|
||
cy.get('.game-button').click() | ||
|
||
cy.url().should('include', '/game/16557/leaderboards') | ||
cy.contains('Colin McRae Rally') | ||
|
||
cy.intercept('GET', '**/API/API_GetLeaderboardEntries.php*', { fixture: 'leaderboard-entries.json' }).as('getLeaderboardEntries') | ||
|
||
cy.get('.leaderboard-list li').eq(1).click() | ||
|
||
cy.url().should('include', '/leaderboard/19063') | ||
cy.contains('Colin McRae Rally') | ||
cy.contains('New Zealand Two') | ||
|
||
cy.get('.entries-list li').eq(0).contains('matias721744') | ||
cy.get('.entries-list li').eq(0).contains('2:51.55') | ||
|
||
cy.get('.entries-list li').eq(1).contains('Thebpg13') | ||
cy.get('.entries-list li').eq(1).contains('2:38.36') | ||
}) | ||
|
||
it('entries with a entry from me and a friend', () => { | ||
cy.intercept('GET', '**/API/API_GetUserRecentlyPlayedGames.php*', { fixture: 'game-list-with-leaderboard.json' }).as('getRecentlyPlayedGames') | ||
|
||
cy.authenticate('masakimu', 'masakimu-secret') | ||
cy.intercept('GET', '**/API/API_GetUsersIFollow.php*', { fixture: 'users-i-follow-with-matias.json' }).as('getUsersIFollow') | ||
cy.visit('/') | ||
|
||
cy.intercept('GET', '**/API/API_GetGameLeaderboards.php*', { fixture: 'leaderboards.json' }).as('getLeaderboards') | ||
|
||
cy.get('.game-button').click() | ||
|
||
cy.url().should('include', '/game/16557/leaderboards') | ||
cy.contains('Colin McRae Rally') | ||
|
||
cy.intercept('GET', '**/API/API_GetLeaderboardEntries.php*', { fixture: 'leaderboard-entries.json' }).as('getLeaderboardEntries') | ||
|
||
cy.get('.leaderboard-list li').eq(1).click() | ||
|
||
cy.url().should('include', '/leaderboard/19063') | ||
cy.contains('Colin McRae Rally') | ||
cy.contains('New Zealand Two') | ||
|
||
cy.get('.entries-list li').eq(0).contains('masakimu') | ||
cy.get('.entries-list li').eq(0).contains('2:46.59') | ||
|
||
cy.get('.entries-list li').eq(1).contains('matias721744') | ||
cy.get('.entries-list li').eq(1).contains('2:51.55') | ||
|
||
cy.get('.entries-list li').eq(2).contains('Thebpg13') | ||
cy.get('.entries-list li').eq(2).contains('2:38.36') | ||
}) | ||
}) |
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,20 @@ | ||
[ | ||
{ | ||
"GameID": 16557, | ||
"ConsoleID": 12, | ||
"ConsoleName": "PlayStation", | ||
"Title": "Colin McRae Rally", | ||
"ImageIcon": "/Images/036840.png", | ||
"ImageTitle": "/Images/036689.png", | ||
"ImageIngame": "/Images/036690.png", | ||
"ImageBoxArt": "/Images/065054.png", | ||
"LastPlayed": "2024-12-16 22:22:54", | ||
"AchievementsTotal": 104, | ||
"NumPossibleAchievements": 104, | ||
"PossibleScore": 436, | ||
"NumAchieved": 53, | ||
"ScoreAchieved": 173, | ||
"NumAchievedHardcore": 53, | ||
"ScoreAchievedHardcore": 173 | ||
} | ||
] |
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,20 @@ | ||
[ | ||
{ | ||
"GameID": 769, | ||
"ConsoleID": 5, | ||
"ConsoleName": "Game Boy Advance", | ||
"Title": "Kirby & The Amazing Mirror", | ||
"ImageIcon": "/Images/042405.png", | ||
"ImageTitle": "/Images/033746.png", | ||
"ImageIngame": "/Images/002643.png", | ||
"ImageBoxArt": "/Images/014483.png", | ||
"LastPlayed": "2024-11-24 21:31:43", | ||
"AchievementsTotal": 55, | ||
"NumPossibleAchievements": 55, | ||
"PossibleScore": 311, | ||
"NumAchieved": 21, | ||
"ScoreAchieved": 31, | ||
"NumAchievedHardcore": 21, | ||
"ScoreAchievedHardcore": 31 | ||
} | ||
] |
Oops, something went wrong.