-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(e2e): Add tests for basic Media Settings (#1398)
- Loading branch information
Conrad Chan
authored
Jun 4, 2021
1 parent
4fa91c8
commit 05db195
Showing
15 changed files
with
211 additions
and
26 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
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
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,30 @@ | ||
import { runBaseMediaSettingsTests } from '../../support/mediaSettingsTests'; | ||
|
||
describe('Dash Viewer', () => { | ||
const token = Cypress.env('ACCESS_TOKEN'); | ||
const fileIdVideo = Cypress.env('FILE_ID_VIDEO'); | ||
|
||
describe('Media Settings Controls', () => { | ||
describe('Without react controls', () => { | ||
beforeEach(() => { | ||
cy.visit('/'); | ||
cy.showPreview(token, fileIdVideo, { | ||
viewers: { Dash: { useReactControls: false } }, | ||
}); | ||
}); | ||
|
||
runBaseMediaSettingsTests(); | ||
}); | ||
|
||
describe('With react controls', () => { | ||
beforeEach(() => { | ||
cy.visit('/'); | ||
cy.showPreview(token, fileIdVideo, { | ||
viewers: { Dash: { useReactControls: true } }, | ||
}); | ||
}); | ||
|
||
runBaseMediaSettingsTests(); | ||
}); | ||
}); | ||
}); |
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,30 @@ | ||
import { runBaseMediaSettingsTests } from '../../support/mediaSettingsTests'; | ||
|
||
describe('MP3 Viewer', () => { | ||
const token = Cypress.env('ACCESS_TOKEN'); | ||
const fileIdMP3 = Cypress.env('FILE_ID_MP3'); | ||
|
||
describe('Media Settings Controls', () => { | ||
describe('Without react controls', () => { | ||
beforeEach(() => { | ||
cy.visit('/'); | ||
cy.showPreview(token, fileIdMP3, { | ||
viewers: { MP3: { useReactControls: false } }, | ||
}); | ||
}); | ||
|
||
runBaseMediaSettingsTests(); | ||
}); | ||
|
||
describe('With react controls', () => { | ||
beforeEach(() => { | ||
cy.visit('/'); | ||
cy.showPreview(token, fileIdMP3, { | ||
viewers: { MP3: { useReactControls: true } }, | ||
}); | ||
}); | ||
|
||
runBaseMediaSettingsTests(); | ||
}); | ||
}); | ||
}); |
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,30 @@ | ||
import { runBaseMediaSettingsTests } from '../../support/mediaSettingsTests'; | ||
|
||
describe('MP4 Viewer', () => { | ||
const token = Cypress.env('ACCESS_TOKEN'); | ||
const fileIdVideo = Cypress.env('FILE_ID_VIDEO'); | ||
|
||
describe('Media Settings Controls', () => { | ||
describe('Without react controls', () => { | ||
beforeEach(() => { | ||
cy.visit('/'); | ||
cy.showPreview(token, fileIdVideo, { | ||
viewers: { Dash: { disabled: true }, MP4: { useReactControls: false } }, | ||
}); | ||
}); | ||
|
||
runBaseMediaSettingsTests(); | ||
}); | ||
|
||
describe('With react controls', () => { | ||
beforeEach(() => { | ||
cy.visit('/'); | ||
cy.showPreview(token, fileIdVideo, { | ||
viewers: { Dash: { disabled: true }, MP4: { useReactControls: true } }, | ||
}); | ||
}); | ||
|
||
runBaseMediaSettingsTests(); | ||
}); | ||
}); | ||
}); |
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,19 @@ | ||
import { runBaseMediaSettingsTests } from '../../support/mediaSettingsTests'; | ||
|
||
describe('Video360 Viewer', () => { | ||
const token = Cypress.env('ACCESS_TOKEN'); | ||
const fileIdVideo360 = Cypress.env('FILE_ID_VIDEO_360'); | ||
|
||
describe('Media Settings Controls', () => { | ||
describe('Without react controls', () => { | ||
beforeEach(() => { | ||
cy.visit('/'); | ||
cy.showPreview(token, fileIdVideo360, { | ||
viewers: { Video360: { useReactControls: false } }, | ||
}); | ||
}); | ||
|
||
runBaseMediaSettingsTests(); | ||
}); | ||
}); | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
// eslint-disable-next-line import/prefer-default-export | ||
export function runBaseMediaSettingsTests() { | ||
beforeEach(() => { | ||
cy.showMediaControls(); | ||
|
||
// Open the menu | ||
cy.getByTitle('Settings').click({ force: true }); | ||
}); | ||
|
||
describe('Base Media Settings', () => { | ||
it('Should be able to toggle media settings menu', () => { | ||
cy.getByTestId('bp-settings-flyout').should('be.visible'); | ||
cy.getByTestId('bp-media-settings-autoplay').contains('Disabled'); | ||
cy.getByTestId('bp-media-settings-speed').contains('Normal'); | ||
|
||
// Close the menu | ||
cy.getByTitle('Settings').click({ force: true }); | ||
cy.getByTestId('bp-settings-flyout').should('not.be.visible'); | ||
}); | ||
|
||
it('Should be able to click away from media settings menu to close it', () => { | ||
cy.getByTestId('bp-settings-flyout').should('be.visible'); | ||
cy.getByTestId('bp-media-settings-autoplay').contains('Disabled'); | ||
cy.getByTestId('bp-media-settings-speed').contains('Normal'); | ||
|
||
// Click away from menu | ||
cy.getByTestId('bp').click(); | ||
cy.getByTestId('bp-settings-flyout').should('not.be.visible'); | ||
}); | ||
|
||
it('Should be able to change the Autoplay setting', () => { | ||
cy.getByTestId('bp-media-settings-autoplay') | ||
.contains('Disabled') | ||
.click(); | ||
|
||
cy.get('[role="menuitem"]').contains('Autoplay'); | ||
|
||
cy.getByTestId('bp-settings-flyout') | ||
.contains('Enabled') | ||
.click(); | ||
|
||
cy.getByTestId('bp-media-settings-autoplay').contains('Enabled'); | ||
}); | ||
|
||
it('Should be able to change the Speed setting', () => { | ||
cy.getByTestId('bp-media-settings-speed') | ||
.contains('Normal') | ||
.click(); | ||
|
||
cy.get('[role="menuitem"]').contains('Speed'); | ||
|
||
cy.getByTestId('bp-settings-flyout') | ||
.contains('0.5') | ||
.click(); | ||
|
||
cy.getByTestId('bp-media-settings-speed').contains('0.5'); | ||
}); | ||
}); | ||
} |