Skip to content

Commit

Permalink
Update cypress tests for new videos tab layout
Browse files Browse the repository at this point in the history
  • Loading branch information
dan-niles authored and benoit74 committed Oct 8, 2024
1 parent 7fb3176 commit 363992c
Show file tree
Hide file tree
Showing 3 changed files with 137 additions and 10 deletions.
15 changes: 8 additions & 7 deletions zimui/cypress/e2e/channel_home_page.cy.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
describe('home page for a channel', () => {
beforeEach(() => {
cy.intercept('GET', '/channel.json', { fixture: 'channel/channel.json' }).as('getChannel')
cy.intercept('GET', '/playlists/uploads_from_openzim_testing-917Q.json', {
fixture: 'channel/playlists/uploads_from_openzim_testing-917Q.json'
}).as('getUploads')
cy.intercept('GET', '/home_playlists.json', {
fixture: 'channel/home_playlists.json'
}).as('getHomePlaylists')
cy.visit('/')
cy.wait('@getChannel')
cy.wait('@getUploads')
cy.wait('@getHomePlaylists')
})

it('loads the videos tab', () => {
cy.contains('2 videos').should('be.visible')
cy.contains('Coffee Machine').should('be.visible')
cy.contains('Timelapse').should('be.visible')
cy.contains('Uploads from openZIM_testing').should('be.visible')
cy.contains('Trailers').should('be.visible')
cy.contains('Timelapses').should('be.visible')
cy.contains('Coffee').should('be.visible')
})

it('loads the playlist tab', () => {
Expand Down
10 changes: 7 additions & 3 deletions zimui/cypress/e2e/video_player_page.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,25 @@ describe('video player page', () => {
cy.intercept('GET', '/channel.json', { fixture: 'channel/channel.json' }).as('getChannel')
cy.intercept('GET', '/playlists/uploads_from_openzim_testing-917Q.json', {
fixture: 'channel/playlists/uploads_from_openzim_testing-917Q.json'
}).as('getUploads')
}).as('getPlaylist')
cy.intercept('GET', '/home_playlists.json', {
fixture: 'channel/home_playlists.json'
}).as('getHomePlaylists')
cy.intercept('GET', '/videos/sample/video.webm', {
fixture: 'channel/videos/sample/video.webm,null'
}).as('getVideoFile')
cy.visit('/')
cy.wait('@getChannel')
cy.wait('@getUploads')
cy.wait('@getHomePlaylists')
})

it('loads the video and related information', () => {
cy.intercept('GET', '/videos/timelapse-9Tgo.json', {
fixture: 'channel//videos/timelapse-9Tgo.json'
fixture: 'channel/videos/timelapse-9Tgo.json'
}).as('getVideo')
cy.contains('.v-card-title ', 'Timelapse').click()
cy.wait('@getVideo')
cy.wait('@getPlaylist')
cy.wait('@getVideoFile')

cy.url().should('include', '/watch')
Expand Down
122 changes: 122 additions & 0 deletions zimui/cypress/fixtures/channel/home_playlists.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
{
"playlists": [
{
"id": "UU8elThf5TGMpQfQc_VE917Q",
"slug": "uploads_from_openzim_testing-917Q",
"author": {
"channelId": "UC8elThf5TGMpQfQc_VE917Q",
"channelTitle": "openZIM_testing",
"channelDescription": "",
"channelJoinedDate": "2024-06-04T13:30:16.232286Z",
"profilePath": "channels/UC8elThf5TGMpQfQc_VE917Q/profile.jpg",
"bannerPath": "channels/UC8elThf5TGMpQfQc_VE917Q/banner.jpg"
},
"title": "Uploads from openZIM_testing",
"description": "",
"publicationDate": "2024-06-04T14:57:45Z",
"thumbnailPath": "videos/DYvYGQHYScc/video.webp",
"videos": [
{
"slug": "coffee_machine-DYvY",
"id": "DYvYGQHYScc",
"title": "Coffee Machine",
"thumbnailPath": "videos/DYvYGQHYScc/video.webp",
"duration": "PT9S"
},
{
"slug": "timelapse-9Tgo",
"id": "9TgosbGRsTk",
"title": "Timelapse",
"thumbnailPath": "videos/9TgosbGRsTk/video.webp",
"duration": "PT11S"
}
],
"videosCount": 2
},
{
"id": "PLMK6hZr9PcshJpNSRVaKReGlwhVlh5Gph",
"slug": "trailers-5Gph",
"author": {
"channelId": "UC8elThf5TGMpQfQc_VE917Q",
"channelTitle": "openZIM_testing",
"channelDescription": "",
"channelJoinedDate": "2024-06-04T13:30:16.232286Z",
"profilePath": "channels/UC8elThf5TGMpQfQc_VE917Q/profile.jpg",
"bannerPath": "channels/UC8elThf5TGMpQfQc_VE917Q/banner.jpg"
},
"title": "Trailers",
"description": "",
"publicationDate": "2024-06-04T15:15:48Z",
"thumbnailPath": "videos/TcMBFSGVi1c/video.webp",
"videos": [
{
"slug": "marvel_studios_avengers_endgame_official_trailer-TcMB",
"id": "TcMBFSGVi1c",
"title": "Marvel Studios' Avengers: Endgame - Official Trailer",
"thumbnailPath": "videos/TcMBFSGVi1c/video.webp",
"duration": "PT2M27S"
}
],
"videosCount": 1
},
{
"id": "PLMK6hZr9PcsjcF5mnaQk8Fi-xnb0AQgGI",
"slug": "timelapses-QgGI",
"author": {
"channelId": "UC8elThf5TGMpQfQc_VE917Q",
"channelTitle": "openZIM_testing",
"channelDescription": "",
"channelJoinedDate": "2024-06-04T13:30:16.232286Z",
"profilePath": "channels/UC8elThf5TGMpQfQc_VE917Q/profile.jpg",
"bannerPath": "channels/UC8elThf5TGMpQfQc_VE917Q/banner.jpg"
},
"title": "Timelapses",
"description": "",
"publicationDate": "2024-06-04T15:04:46Z",
"thumbnailPath": "videos/9TgosbGRsTk/video.webp",
"videos": [
{
"slug": "timelapse-9Tgo",
"id": "9TgosbGRsTk",
"title": "Timelapse",
"thumbnailPath": "videos/9TgosbGRsTk/video.webp",
"duration": "PT11S"
},
{
"slug": "cloudy_sky_time_lapse_4k_free_footage_video_gopro_11-k02q",
"id": "k02qXOcCrbo",
"title": "Cloudy Sky ☀️ Time Lapse 4K Free Footage Video | GoPro 11",
"thumbnailPath": "videos/k02qXOcCrbo/video.webp",
"duration": "PT36S"
}
],
"videosCount": 2
},
{
"id": "PLMK6hZr9PcsjTJ5u2z-khzvDNXlqdO2wS",
"slug": "coffee-O2wS",
"author": {
"channelId": "UC8elThf5TGMpQfQc_VE917Q",
"channelTitle": "openZIM_testing",
"channelDescription": "",
"channelJoinedDate": "2024-06-04T13:30:16.232286Z",
"profilePath": "channels/UC8elThf5TGMpQfQc_VE917Q/profile.jpg",
"bannerPath": "channels/UC8elThf5TGMpQfQc_VE917Q/banner.jpg"
},
"title": "Coffee",
"description": "",
"publicationDate": "2024-06-04T15:04:25Z",
"thumbnailPath": "videos/DYvYGQHYScc/video.webp",
"videos": [
{
"slug": "coffee_machine-DYvY",
"id": "DYvYGQHYScc",
"title": "Coffee Machine",
"thumbnailPath": "videos/DYvYGQHYScc/video.webp",
"duration": "PT9S"
}
],
"videosCount": 1
}
]
}

0 comments on commit 363992c

Please sign in to comment.