skillbox/client/cypress/e2e/frontend/modules/videos.cy.ts

83 lines
2.2 KiB
TypeScript

const oldVideoBlock = {
id: 'b6080c67-e21e-41f6-b9b0-8416837c8f1d',
type: 'video_block',
value: {
url: 'https://www.srf.ch/play/tv/popupvideoplayer?id=6db02b8b-975c-4e3e-8260-f1e6eca1d8ed',
},
};
const newVideoBlock = {
id: '04f80357-d201-4a4a-bdbc-03c6f15497fa',
type: 'video_block',
value: {
url: 'https://www.srf.ch/play/tv/popupvideoplayer?id=e553b617-0831-4683-84d2-783d971f3c72&startTime=420.20',
},
};
const videoModule = {
id: 'TW9kdWxlTm9kZTo3NzU=',
title: 'Modul Test',
metaTitle: 'Testing',
teaser: 'Modul fürs Testing',
intro: '<p data-block-key="v1cpe">Dieses Modul wird verwendet, um Funktionen zu testen.</p>',
slug: 'video-module',
heroImage:
'https://skillbox-my-detailhandel-dhf-prod.s3-eu-central-1.amazonaws.com/original_images/A_LJ1_LF1_M3_Titelbild.jpg',
heroSource: '',
solutionsEnabled: false,
language: 'de',
level: null,
category: null,
topic: {
slug: 'test',
title: 'Test',
__typename: 'TopicNode',
},
bookmark: null,
__typename: 'ModuleNode',
chapters: [
{
id: 'Q2hhcHRlck5vZGU6Nzc2',
title: 'Kapitel 1',
description: 'Einleitungstext für Kapitel',
bookmark: null,
titleHiddenFor: [],
descriptionHiddenFor: [],
__typename: 'ChapterNode',
contentBlocks: [
{
id: 'Q29udGVudEJsb2NrTm9kZToxMTY0',
slug: 'auftrag-2',
userCreated: false,
mine: false,
instrumentCategory: null,
bookmarks: [],
hiddenFor: [],
visibleFor: [],
__typename: 'ContentBlockNode',
title: 'Auftrag 2',
type: 'task',
contents: [oldVideoBlock, newVideoBlock],
},
],
},
],
};
describe('Video Block', () => {
beforeEach(() => {
cy.setup();
cy.mockGraphqlOps({
operations: {
MeQuery: {},
ModuleDetailsQuery: {
module: videoModule,
},
ModuleEditModeQuery: {},
UpdateLastModule: {},
},
});
});
it('displays SRF Videos with old and with new pattern', () => {
cy.visit('/module/video-module');
cy.getByDataCy('srf-embed').should('have.length', 2);
});
});