Skip to content

Instantly share code, notes, and snippets.

@azz0r
Created March 21, 2022 09:55
Show Gist options
  • Save azz0r/f1862b4a0dcd27c044237c18bb29a28e to your computer and use it in GitHub Desktop.
Save azz0r/f1862b4a0dcd27c044237c18bb29a28e to your computer and use it in GitHub Desktop.
/* eslint-disable no-undef */
const { Themes } = require('@namespace/themes');
const atomicComponentsMap = require('../fixtures/urls');
const storybookUrl = 'STORYBOOK URL';
const ignoredThemes = [ 'test-theme' ];
const themes = Object.keys(Themes).filter(themeName => !ignoredThemes.includes(themeName));
const atomicComponents = Object.keys(atomicComponentsMap);
describe('namespace VRT component tests', () => {
before(() => {
cy.vrtStart();
});
after(() => {
cy.vrtStop();
});
themes.forEach((themeName) => {
atomicComponents.forEach((componentKey) => {
const params = atomicComponentsMap[componentKey];
it(`should display the ${ themeName } ${ componentKey } correctly`, () => {
cy.visit(`${ storybookUrl }iframe.html?path=/story/${ params }&viewMode=story&globals=theme:${ themeName }`);
cy.get('.sb-show-main').vrtTrack(`${ themeName }-${ componentKey }`);
});
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment