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

fix(react): align component and e2e test generation #6535

Merged
merged 1 commit into from Jul 29, 2021

Conversation

juristr
Copy link
Member

@juristr juristr commented Jul 29, 2021

Current Behavior

Right now if you generate a new React component it generates the welcome message in a "dasherized" name.

image

It doesn't make a lot of sense since the actual selector of the React component would be TopicButton and not topic-button. But apart from that, what happens when generating a Cypress storybook test is that the test right now is generated as follows:

describe('shared-ui: TopicButton component', () => {
  beforeEach(() => cy.visit('/iframe.html?id=topicbutton--primary'));
    
    it('should render the component', () => {
      cy.get('h1').should('contain', 'Welcome to shared-ui!');
    });
});

Basically it checks whether the name is the project name, rather than component name, thus the pre-generated e2e test fails. Which is bad.

Expected Behavior

This PR aligns the React component generator with the e2e test generator s.t. when just using code generation tests pass. Which should always be the case

To test

  • generate a new workspace
  • generate a library
  • generate a storybook story including Cypress e2e tests
  • run the cypress e2e tests => should succeed

Related Issue(s)

Fixes #

@vercel
Copy link

vercel bot commented Jul 29, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/nrwl/nx-dev/2aBq1f1SdvasMXKUF2qKEnvUP7fH
✅ Preview: Canceled

[Deployment for a34c1f1 canceled]

@juristr juristr requested review from jaysoo and mandarini July 29, 2021 08:59
@nx-cloud
Copy link

nx-cloud bot commented Jul 29, 2021

Nx Cloud Report

We didn't find any information for the current pull request with the commit a34c1f1.
Please make sure you set the \ NX_BRANCH\ environment variable in your CI pipeline .

Check the Getting started section to configure the app.


Sent with 💌 from NxCloud.

@jaysoo jaysoo merged commit 7c26151 into master Jul 29, 2021
ManojBahuguna pushed a commit to ManojBahuguna/nx that referenced this pull request Sep 16, 2021
@bcabanes bcabanes deleted the fix-react-cypress-generator branch December 10, 2021 00:19
@github-actions
Copy link

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants