Skip to content

Commit

Permalink
chore: adding e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Conrad Chan committed Jun 25, 2021
1 parent 281b18b commit 1949fc2
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 29 deletions.
70 changes: 41 additions & 29 deletions test/integration/media/DashViewer.e2e.test.js
Original file line number Diff line number Diff line change
@@ -1,57 +1,69 @@
import {
runAudioTracksTests,
runBaseMediaSettingsTests,
runLowQualityMenuTests,
runQualityMenuTests,
runSubtitlesTests,
} from '../../support/mediaSettingsTests';

describe('Dash Viewer', () => {
const token = Cypress.env('ACCESS_TOKEN');
const fileIdVideo = Cypress.env('FILE_ID_VIDEO_SUBTITLES_TRACKS');
const fileIdVideoSmall = Cypress.env('FILE_ID_VIDEO_SMALL');

describe('Media Settings Controls', () => {
describe('Without react controls', () => {
beforeEach(() => {
cy.visit('/');
cy.showPreview(token, fileIdVideo, {
viewers: { Dash: { useReactControls: false } },
});
const setupTest = (fileId, useReactControls) => {
cy.visit('/');
cy.showPreview(token, fileId, {
viewers: { Dash: { useReactControls } },
});

cy.showMediaControls();
cy.showMediaControls();

// Open the menu
cy.getByTitle('Settings').click();
});
// Open the menu
cy.getByTitle('Settings').click();
};

runBaseMediaSettingsTests();
describe('HD Video with Subtitles', () => {
describe('Media Settings Controls', () => {
describe('Without react controls', () => {
beforeEach(() => setupTest(fileIdVideo, false));

runQualityMenuTests();
runBaseMediaSettingsTests();

runAudioTracksTests();
runQualityMenuTests();

runSubtitlesTests();
});
runAudioTracksTests();

runSubtitlesTests();
});

describe('With react controls', () => {
beforeEach(() => setupTest(fileIdVideo, true));

describe('With react controls', () => {
beforeEach(() => {
cy.visit('/');
cy.showPreview(token, fileIdVideo, {
viewers: { Dash: { useReactControls: true } },
});
runBaseMediaSettingsTests();

cy.showMediaControls();
runQualityMenuTests();

// Open the menu
cy.getByTitle('Settings').click();
runAudioTracksTests();

runSubtitlesTests();
});
});
});

runBaseMediaSettingsTests();
describe('Non HD Video', () => {
describe('Media Settings Controls', () => {
describe('Without react controls', () => {
beforeEach(() => setupTest(fileIdVideoSmall, false));

runQualityMenuTests();
runLowQualityMenuTests();
});

runAudioTracksTests();
describe('With react controls', () => {
beforeEach(() => setupTest(fileIdVideoSmall, true));

runSubtitlesTests();
runLowQualityMenuTests();
});
});
});
});
12 changes: 12 additions & 0 deletions test/support/mediaSettingsTests.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,18 @@ export function runQualityMenuTests() {
});
}

export function runLowQualityMenuTests() {
describe('Non HD Video', () => {
it('Should not have the Quality settings menu enabled', () => {
cy.getByTestId('bp-media-settings-quality')
.contains('480p')
.click({ force: true });

cy.getByTestId('bp-media-controls-hd').should('not.be.visible');
});
});
}

export function runAudioTracksTests() {
describe('Audiotracks Menu', () => {
it('Should be able to change the Audiotrack setting', () => {
Expand Down

0 comments on commit 1949fc2

Please sign in to comment.