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

CLI: Add common welcome MDX and cleanup #11422

Merged
merged 20 commits into from
Jul 10, 2020
Merged
Show file tree
Hide file tree
Changes from 2 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
8 changes: 5 additions & 3 deletions cypress/generated/basic.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ describe('Basic Flow', () => {
});

it('should load welcome flow', () => {
cy.navigateToStory('example-introduction', 'page');

// assert url changes
cy.url().should('include', 'path=/story/welcome--to-storybook');
cy.url().should('include', 'path=/story/example-introduction--page');

// check for selected element
cy.get('#welcome--to-storybook').should('have.class', 'selected');
cy.get('#example-introduction--page').should('have.class', 'selected');

// check for content
cy.getStoryElement().should('contain.text', 'Welcome to storybook');
cy.getDocsElement().should('contain.text', 'Welcome to Storybook');
});
});
17 changes: 16 additions & 1 deletion cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,28 @@ Cypress.Commands.add('getStoryElement', {}, () => {
.then((storyRoot) => cy.wrap(storyRoot, { log: false }));
});

Cypress.Commands.add('getDocsElement', {}, () => {
cy.log('getDocsElement');
return cy
.get(`#storybook-preview-iframe`, { log: false })
.its('0.contentDocument.body', { log: false })
.should('not.be.empty')
.then((body) => cy.wrap(body, { log: false }))
.find('#docs-root', { log: false })
.should('not.be.empty')
.then((storyRoot) => cy.wrap(storyRoot, { log: false }));
});

Cypress.Commands.add('navigateToStory', (kind, name) => {
const kindId = kind.replace(' ', '-').toLowerCase();
const storyId = name.replace(' ', '-').toLowerCase();

const storyLinkId = `#${kindId}--${storyId}`;
cy.log('navigateToStory');
cy.get(`#${kindId}`, { log: false }).click();

if (name !== 'page') {
cy.get(`#${kindId}`, { log: false }).click();
}
cy.get(storyLinkId, { log: false }).click();

// assert url changes
Expand Down
4 changes: 4 additions & 0 deletions cypress/support/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ declare namespace Cypress {
* Custom command to select the DOM element of a story in the canvas tab.
*/
getStoryElement(): Chainable<Element>;
/**
* Custom command to select the DOM element of a docs story in the canvas tab.
*/
getDocsElement(): Chainable<Element>;

/**
* Navigate to a story.
Expand Down
13 changes: 0 additions & 13 deletions lib/cli/src/frameworks/angular/0-Welcome.stories.ts

This file was deleted.

81 changes: 0 additions & 81 deletions lib/cli/src/frameworks/angular/welcome.component.ts

This file was deleted.

13 changes: 0 additions & 13 deletions lib/cli/src/frameworks/aurelia/0-Welcome.stories.ts

This file was deleted.

79 changes: 0 additions & 79 deletions lib/cli/src/frameworks/aurelia/welcome.ts

This file was deleted.

Loading