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

add ability to skip cypress tests based on framework #16285

Merged
merged 1 commit into from
Oct 8, 2021
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
38 changes: 22 additions & 16 deletions cypress/generated/addon-docs.spec.ts
Original file line number Diff line number Diff line change
@@ -1,30 +1,36 @@
import { skipOn } from '@cypress/skip-test';

describe('addon-action', () => {
before(() => {
beforeEach(() => {
cy.visitStorybook();
});

it('should have docs tab', () => {
cy.navigateToStory('example-button', 'primary');
cy.viewAddonTab('Docs');
});

it('should have docs tab', () => {
// MDX rendering
cy.getDocsElement().find('h1').should('contain.text', 'Button');

// inline story rendering
cy.getDocsElement().find('button').should('contain.text', 'Button');
});

cy.getDocsElement()
.find('.docblock-code-toggle')
.first()
.should('contain.text', 'Show code')
.click();
skipOn('vue3', () => {
it('should provide source snippet', () => {
cy.getDocsElement()
.find('.docblock-code-toggle')
.first()
.should('contain.text', 'Show code')
// use force click so cypress does not automatically scroll, making the source block visible on this step
.click({ force: true });

cy.getDocsElement()
.find('pre.prismjs')
.first()
.should(($div) => {
const text = $div.text();
expect(text).not.match(/^\(args\) => /);
});
cy.getDocsElement()
.find('pre.prismjs')
.first()
.should(($div) => {
const text = $div.text();
expect(text).not.match(/^\(args\) => /);
});
});
});
});
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@
}
},
"optionalDependencies": {
"@cypress/skip-test": "^2.6.1",
"@cypress/webpack-preprocessor": "^5.7.0",
"cypress": "6.8.0",
"puppeteer": "^2.1.1",
Expand Down
2 changes: 1 addition & 1 deletion scripts/run-e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const serveStorybook = async ({ cwd }: Options, port: string) => {
const runCypress = async (location: string, name: string) => {
const cypressCommand = openCypressInUIMode ? 'open' : 'run';
await exec(
`yarn cypress ${cypressCommand} --config pageLoadTimeout=4000,execTimeout=4000,taskTimeout=4000,responseTimeout=4000,defaultCommandTimeout=4000,integrationFolder="cypress/generated",videosFolder="/tmp/cypress-record/${name}" --env location="${location}"`,
`CYPRESS_ENVIRONMENT=${name} yarn cypress ${cypressCommand} --config pageLoadTimeout=4000,execTimeout=4000,taskTimeout=4000,responseTimeout=4000,defaultCommandTimeout=4000,integrationFolder="cypress/generated",videosFolder="/tmp/cypress-record/${name}" --env location="${location}"`,
{ cwd: rootDir },
{
startMessage: `🤖 Running Cypress tests`,
Expand Down
Loading