Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,16 @@ describe('colorpicker-storybook', () => {
cy.get('app-colorpicker')
.should('exist')
.should('be.visible')
.skyBlur()
.screenshot(`colorpickercomponent-colorpicker--colorpicker-${theme}`);
cy.get('app-colorpicker').percySnapshot(
`colorpickercomponent-colorpicker--colorpicker-${theme}`,
{
widths: E2eVariations.DISPLAY_WIDTHS,
},
);
cy.get('app-colorpicker')
.skyBlur()
.percySnapshot(
`colorpickercomponent-colorpicker--colorpicker-${theme}`,
{
widths: E2eVariations.DISPLAY_WIDTHS,
},
);
});

colorpickerVariations.forEach((colorpicker) => {
Expand All @@ -68,18 +71,22 @@ describe('colorpicker-storybook', () => {
cy.wrap($el.position().left).should('be.gte', 12);
});

cy.window().screenshot(
`colorpickercomponent-colorpicker--${colorpicker.id}-menu-${theme}`,
{
disableTimersAndAnimations: true,
},
);
cy.window().percySnapshot(
`colorpickercomponent-colorpicker--${colorpicker.id}-menu-${theme}`,
{
widths: E2eVariations.DISPLAY_WIDTHS,
},
);
cy.window()
.skyBlur()
.screenshot(
`colorpickercomponent-colorpicker--${colorpicker.id}-menu-${theme}`,
{
disableTimersAndAnimations: true,
},
);
cy.window()
.skyBlur()
.percySnapshot(
`colorpickercomponent-colorpicker--${colorpicker.id}-menu-${theme}`,
{
widths: E2eVariations.DISPLAY_WIDTHS,
},
);
});
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,19 @@ describe('inline-form-storybook', () => {
`/iframe.html?globals=theme:${theme}&id=inlineformcomponent-inlineform--inline-form-custom-buttons`,
);

cy.skyReady('app-inline-form').screenshot(
`inlineformcomponent-inlineform--inline-form-closed-${theme}`,
);
cy.get('app-inline-form').percySnapshot(
`inlineformcomponent-inlineform--inline-form-closed-${theme}`,
{
widths: E2eVariations.DISPLAY_WIDTHS,
},
);
cy.skyReady('app-inline-form')
.skyBlur()
.screenshot(
`inlineformcomponent-inlineform--inline-form-closed-${theme}`,
);
cy.get('app-inline-form')
.skyBlur()
.percySnapshot(
`inlineformcomponent-inlineform--inline-form-closed-${theme}`,
{
widths: E2eVariations.DISPLAY_WIDTHS,
},
);
});
[
'custom',
Expand All @@ -40,15 +44,19 @@ describe('inline-form-storybook', () => {
.should('be.visible')
.click();

cy.get('app-inline-form').screenshot(
`inlineformcomponent-inlineform--inline-form-${buttonCombo}-buttons-${theme}`,
);
cy.get('app-inline-form').percySnapshot(
`inlineformcomponent-inlineform--inline-form-${buttonCombo}-buttons-${theme}`,
{
widths: E2eVariations.DISPLAY_WIDTHS,
},
);
cy.get('app-inline-form')
.skyBlur()
.screenshot(
`inlineformcomponent-inlineform--inline-form-${buttonCombo}-buttons-${theme}`,
);
cy.get('app-inline-form')
.skyBlur()
.percySnapshot(
`inlineformcomponent-inlineform--inline-form-${buttonCombo}-buttons-${theme}`,
{
widths: E2eVariations.DISPLAY_WIDTHS,
},
);
});
});
});
Expand Down
174 changes: 102 additions & 72 deletions apps/e2e/lookup-storybook-e2e/src/e2e/lookup.component.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,17 @@ describe('lookup-storybook', () => {
.viewport(1300, 900),
);
it(`should render the component`, () => {
cy.skyReady('app-lookup').screenshot(
`lookupcomponent-lookup--lookup-${mode}-${theme}`,
);
cy.get('app-lookup').percySnapshot(
`lookupcomponent-lookup--lookup-${mode}-${theme}`,
{
widths: E2eVariations.DISPLAY_WIDTHS,
},
);
cy.skyReady('app-lookup')
.skyBlur()
.screenshot(`lookupcomponent-lookup--lookup-${mode}-${theme}`);
cy.get('app-lookup')
.skyBlur()
.percySnapshot(
`lookupcomponent-lookup--lookup-${mode}-${theme}`,
{
widths: E2eVariations.DISPLAY_WIDTHS,
},
);
});
});
});
Expand All @@ -52,15 +54,19 @@ describe('lookup-storybook', () => {
.should('exist')
.should('be.visible');

cy.get('app-lookup').screenshot(
`lookupcomponent-lookup--lookup-${mode}-show-more-dropdown-with-filtering-${theme}`,
);
cy.get('app-lookup').percySnapshot(
`lookupcomponent-lookup--lookup-${mode}-show-more-dropdown-with-filtering-${theme}`,
{
widths: E2eVariations.DISPLAY_WIDTHS,
},
);
cy.get('app-lookup')
.skyBlur()
.screenshot(
`lookupcomponent-lookup--lookup-${mode}-show-more-dropdown-with-filtering-${theme}`,
);
cy.get('app-lookup')
.skyBlur()
.percySnapshot(
`lookupcomponent-lookup--lookup-${mode}-show-more-dropdown-with-filtering-${theme}`,
{
widths: E2eVariations.DISPLAY_WIDTHS,
},
);
});
it('should render show more dropdown without filtering', () => {
cy.skyReady('app-lookup');
Expand All @@ -75,15 +81,19 @@ describe('lookup-storybook', () => {
.should('exist')
.should('be.visible');

cy.get('app-lookup').screenshot(
`lookupcomponent-lookup--lookup-${mode}-show-more-dropdown-no-filtering-${theme}`,
);
cy.get('app-lookup').percySnapshot(
`lookupcomponent-lookup--lookup-${mode}-show-more-dropdown-no-filtering-${theme}`,
{
widths: E2eVariations.DISPLAY_WIDTHS,
},
);
cy.get('app-lookup')
.skyBlur()
.screenshot(
`lookupcomponent-lookup--lookup-${mode}-show-more-dropdown-no-filtering-${theme}`,
);
cy.get('app-lookup')
.skyBlur()
.percySnapshot(
`lookupcomponent-lookup--lookup-${mode}-show-more-dropdown-no-filtering-${theme}`,
{
widths: E2eVariations.DISPLAY_WIDTHS,
},
);
});
it('should render show more dropdown with no results', () => {
cy.skyReady('app-lookup');
Expand All @@ -97,15 +107,19 @@ describe('lookup-storybook', () => {
.should('exist')
.should('be.visible');

cy.get('app-lookup').screenshot(
`lookupcomponent-lookup--lookup-${mode}-show-more-dropdown-no-results-${theme}`,
);
cy.get('app-lookup').percySnapshot(
`lookupcomponent-lookup--lookup-${mode}-show-more-dropdown-no-results-${theme}`,
{
widths: E2eVariations.DISPLAY_WIDTHS,
},
);
cy.get('app-lookup')
.skyBlur()
.screenshot(
`lookupcomponent-lookup--lookup-${mode}-show-more-dropdown-no-results-${theme}`,
);
cy.get('app-lookup')
.skyBlur()
.percySnapshot(
`lookupcomponent-lookup--lookup-${mode}-show-more-dropdown-no-results-${theme}`,
{
widths: E2eVariations.DISPLAY_WIDTHS,
},
);
});
it('should render show more dropdown add button', () => {
cy.skyReady('app-lookup');
Expand All @@ -120,15 +134,19 @@ describe('lookup-storybook', () => {
.should('exist')
.should('be.visible');

cy.get('app-lookup').screenshot(
`lookupcomponent-lookup--lookup-${mode}-show-more-dropdown-add-more-button-${theme}`,
);
cy.get('app-lookup').percySnapshot(
`lookupcomponent-lookup--lookup-${mode}-show-more-dropdown-add-more-button-${theme}`,
{
widths: E2eVariations.DISPLAY_WIDTHS,
},
);
cy.get('app-lookup')
.skyBlur()
.screenshot(
`lookupcomponent-lookup--lookup-${mode}-show-more-dropdown-add-more-button-${theme}`,
);
cy.get('app-lookup')
.skyBlur()
.percySnapshot(
`lookupcomponent-lookup--lookup-${mode}-show-more-dropdown-add-more-button-${theme}`,
{
widths: E2eVariations.DISPLAY_WIDTHS,
},
);
});
describe('in show more modal', () => {
it('should open and render modal', () => {
Expand All @@ -147,15 +165,19 @@ describe('lookup-storybook', () => {

cy.get('.sky-modal').should('exist').should('be.visible');

cy.get('app-lookup').screenshot(
`lookupcomponent-lookup--lookup-${mode}-show-more-modal-${theme}`,
);
cy.get('app-lookup').percySnapshot(
`lookupcomponent-lookup--lookup-${mode}-show-more-modal-${theme}`,
{
widths: E2eVariations.DISPLAY_WIDTHS,
},
);
cy.get('app-lookup')
.skyBlur()
.screenshot(
`lookupcomponent-lookup--lookup-${mode}-show-more-modal-${theme}`,
);
cy.get('app-lookup')
.skyBlur()
.percySnapshot(
`lookupcomponent-lookup--lookup-${mode}-show-more-modal-${theme}`,
{
widths: E2eVariations.DISPLAY_WIDTHS,
},
);
});
it('should open and render modal with add more', () => {
cy.skyReady('app-lookup');
Expand All @@ -173,15 +195,19 @@ describe('lookup-storybook', () => {

cy.get('.sky-modal').should('exist').should('be.visible');

cy.get('app-lookup').screenshot(
`lookupcomponent-lookup--lookup-${mode}-show-more-modal-add-more-${theme}`,
);
cy.get('app-lookup').percySnapshot(
`lookupcomponent-lookup--lookup-${mode}-show-more-modal-add-more-${theme}`,
{
widths: E2eVariations.DISPLAY_WIDTHS,
},
);
cy.get('app-lookup')
.skyBlur()
.screenshot(
`lookupcomponent-lookup--lookup-${mode}-show-more-modal-add-more-${theme}`,
);
cy.get('app-lookup')
.skyBlur()
.percySnapshot(
`lookupcomponent-lookup--lookup-${mode}-show-more-modal-add-more-${theme}`,
{
widths: E2eVariations.DISPLAY_WIDTHS,
},
);
});
it('should open and render modal with preselected values', () => {
cy.skyReady('app-lookup');
Expand All @@ -199,15 +225,19 @@ describe('lookup-storybook', () => {

cy.get('.sky-modal').should('exist').should('be.visible');

cy.get('app-lookup').screenshot(
`lookupcomponent-lookup--lookup-${mode}-show-more-modal-preselected-values-${theme}`,
);
cy.get('app-lookup').percySnapshot(
`lookupcomponent-lookup--lookup-${mode}-show-more-modal-preselected-values-${theme}`,
{
widths: E2eVariations.DISPLAY_WIDTHS,
},
);
cy.get('app-lookup')
.skyBlur()
.screenshot(
`lookupcomponent-lookup--lookup-${mode}-show-more-modal-preselected-values-${theme}`,
);
cy.get('app-lookup')
.skyBlur()
.percySnapshot(
`lookupcomponent-lookup--lookup-${mode}-show-more-modal-preselected-values-${theme}`,
{
widths: E2eVariations.DISPLAY_WIDTHS,
},
);
});
});
});
Expand Down
1 change: 1 addition & 0 deletions libs/sdk/cypress-commands/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import './lib/blur-before-screenshot-command';
import './lib/choose-theme-command';
import './lib/ready-command';
import './lib/visual-test-command';
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// eslint-disable-next-line @typescript-eslint/no-namespace
declare namespace Cypress {
interface Chainable<Subject> {
/**
* Blur the active element to remove focus rings before taking a screenshot.
*/
skyBlur(): Chainable<Subject>;
}
}

/**
* Blur the active element to remove focus rings before taking a screenshot.
* This prevents focus rings from appearing in screenshots when components
* auto-focus elements via setTimeout or similar async patterns.
*/
Cypress.Commands.add('skyBlur', { prevSubject: 'optional' }, (subject) => {
cy.document({ log: false }).then({ timeout: 1000 }, (doc) => {
(doc.activeElement as HTMLElement)?.blur();
});

if (subject) {
return cy.wrap(subject, { log: false });
}

return;
});
Loading