Skip to content

Commit

Permalink
test(e2e-storybook): fix card-section-simple e2e test
Browse files Browse the repository at this point in the history
  • Loading branch information
m4olivei committed Oct 25, 2024
1 parent 5184e3e commit 24f6470
Showing 1 changed file with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright IBM Corp. 2021, 2022
* Copyright IBM Corp. 2021, 2024
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
Expand Down Expand Up @@ -29,11 +29,11 @@ const _tests = {
cy.checkAxeA11y();
},
checkForBlocklink: () => {
cy.get('cds-card-group-item > cds-card-cta-footer').each(footer => {
cy.get('c4d-card-group-item > c4d-card-footer').each((footer) => {
cy.get(footer)
.shadow()
.find('a')
.then($els => {
.then(($els) => {
const win = $els[0].ownerDocument.defaultView;
const after = win.getComputedStyle($els[0], ':after');
const positionValue = after.getPropertyValue('position');
Expand All @@ -47,13 +47,15 @@ const _tests = {
});
},
checkForTitlePosition: () => {
cy.get('cds-content-section-heading').then(heading => {
expect(heading.offset().left == 16 || heading.offset().left == 32).to.be.eq(true);
cy.get('c4d-content-section-heading').then((heading) => {
expect(
heading.offset().left == 16 || heading.offset().left == 32
).to.be.eq(true);
expect(heading.css('textAlign')).to.be.eq('start');
});
},
checkForCardContent: () => {
cy.get('cds-card-group-item').each(card => {
cy.get('c4d-card-group-item').each((card) => {
card.children().each((_i, child) => {
const cardRoot = card[0].shadowRoot;
expect(child.assignedSlot.getRootNode()).to.be.eq(cardRoot);
Expand All @@ -62,13 +64,13 @@ const _tests = {
},
checkCTACard: () => {
cy.visit(`${_paths.default}&knob-With%20CTA:=true`);
cy.get('cds-card-group-item')
cy.get('c4d-card-group-item')
.last()
.should('have.attr', 'color-scheme', 'inverse');
},
checkCardWithImages: () => {
cy.visit(`${_paths.default}&knob-With%20images:=true`);
cy.get('cds-card-group-item > cds-image').each($img => {
cy.get('c4d-card-group-item > c4d-image').each(($img) => {
cy.wrap($img).should('be.visible');
});
},
Expand All @@ -77,7 +79,7 @@ const _tests = {
},
};

describe('cds-card-section-simple | default (desktop)', () => {
describe('c4d-card-section-simple | default (desktop)', () => {
beforeEach(() => {
cy.viewport(1280, 720);
cy.visit(`/${_paths.default}`);
Expand All @@ -93,7 +95,7 @@ describe('cds-card-section-simple | default (desktop)', () => {
it('should check a11y', _tests.checkA11y);
});

describe('cds-card-section-simple | default (mobile)', () => {
describe('c4d-card-section-simple | default (mobile)', () => {
beforeEach(() => {
cy.viewport(375, 720);
cy.visit(`/${_paths.default}`);
Expand Down

0 comments on commit 24f6470

Please sign in to comment.