cypress/e2e/pages/onDemandTV/index.cy.js

Summary

Maintainability
C
1 day
Test Coverage
import config from '../../../support/config/services';
import getPaths from '../../../support/helpers/getPaths';
import serviceHasPageType from '../../../support/helpers/serviceHasPageType';
import e2eTests from './tests';
import visitPage from '../../../support/helpers/visitPage';
import { overrideRendererOnTest } from '../../../support/helpers/onDemandRadioTv';

const pageType = 'onDemandTV';
Object.keys(config)
  .filter(service => serviceHasPageType(service, pageType))
  .forEach(serviceId => {
    const { variant, name: service } = config[serviceId];
    const paths = getPaths(serviceId, pageType);
    paths.forEach(currentPath => {
      describe(`${pageType} - ${currentPath}`, () => {
        beforeEach(() => {
          Cypress.env('currentPath', currentPath);
          const newPath = `${Cypress.env(
            'currentPath',
          )}${overrideRendererOnTest()}`;
          visitPage(newPath, pageType);
        });
        e2eTests({
          service,
          pageType,
          variant,
        });
      });
    });
  });