Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[tests] fix e2e-storybook tests #12085

Merged
Merged
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
5 changes: 4 additions & 1 deletion .github/workflows/e2e-tests-parallel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,10 @@ jobs:
id: cypress-tests-wc
continue-on-error: true
working-directory: packages/web-components
run: yarn test:e2e-storybook:test:parallel
run: |
export CYPRESS_VERIFY_TIMEOUT=60000
yarn cypress:verify
yarn test:e2e-storybook:test:parallel
env:
CI_BUILD_ID: '${{ github.sha }}-${{ github.workflow }}-wc'
CYPRESS_API_URL: "https://sorry-cypress-director.qfl95m0zv01.us-east.codeengine.appdomain.cloud"
Expand Down
3 changes: 2 additions & 1 deletion packages/web-components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@
"typecheck": "tsc --noEmit -p tsconfig.json",
"upgrade-carbon": "yarn upgrade-interactive @carbon/web-components @carbon/icon-helpers @carbon/icons --latest --exact",
"visual-snapshot": "yarn percy storybook:start ./storybook-static",
"wca": "web-component-analyzer analyze src --outFile custom-elements.json"
"wca": "web-component-analyzer analyze src --outFile custom-elements.json",
"cypress:verify": "cypress verify"
m4olivei marked this conversation as resolved.
Show resolved Hide resolved
},
"dependencies": {
"@carbon/ibmdotcom-services": "2.15.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ export const Default = (args) => {
customVideoTitle,
} = args?.Card ?? {};
/* eslint-disable no-nested-ternary */

let videoCopy;
let videoFooterCopy;

Expand Down Expand Up @@ -97,7 +96,7 @@ export const Default = (args) => {
: ``}
<c4d-card-eyebrow>${eyebrow}</c4d-card-eyebrow>
<c4d-card-heading>${videoCopy ?? heading}</c4d-card-heading>
${copy ? html`<p></p>` : ``}
${copy ? html`<p>${copy}</p>` : ``}
${tagGroup ? html` ${tagGroupContent} ` : ``}
${ctaType === CTA_TYPE.VIDEO
? html` <c4d-card-footer> ${videoFooterCopy} </c4d-card-footer> `
Expand Down
4 changes: 2 additions & 2 deletions packages/web-components/tests/e2e-storybook/cypress.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
"screenshotOnRunFailure": false,
"video": false,
"testFiles": "**/*.e2e.js",
"pageLoadTimeout": 90000,
"defaultCommandTimeout": 90000,
"pageLoadTimeout": 30000,
"defaultCommandTimeout": 4000,
m4olivei marked this conversation as resolved.
Show resolved Hide resolved
"retries": {
"runMode": 2,
"openMode": 0
Expand Down
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 All @@ -17,7 +17,7 @@ const _paths = {
};

/**
* Collection of all tests for cds-card-section-simple
* Collection of all tests for c4d-card-section-simple
*
* @function checkForBlocklink - Asserts a full-sized pseudoelement from the footer link
* @function checkForTitlePosition - Asserts left-aligned title (16 || 32)px from left edge
Expand All @@ -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
Loading
Loading