-
Notifications
You must be signed in to change notification settings - Fork 30
add basic component cypress tests #134
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a typo in the file name. Also, the test seem to be incomplete
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh oops I forgot about that one. Looking at the failed test screenshot, it looks like the ErrorBoundary doesn't get rendered. Not sure what's going on there.
| import InvalidObject from '../../packages/module/dist/dynamic/InvalidObject'; | ||
|
|
||
| describe('InvalidObject', () => { | ||
| /* eslint-disable no-console */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this one needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh 😅 the problem of copy-paste. I took these out.
| import ShortcutGrid from '../../packages/module/dist/dynamic/ShortcutGrid'; | ||
|
|
||
| describe('ShortcutGrid', () => { | ||
| /* eslint-disable no-console */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| /* eslint-disable no-console */ |
| import SkeletonTable from '../../packages/module/dist/dynamic/SkeletonTable'; | ||
|
|
||
| describe('SkeletonTable', () => { | ||
| /* eslint-disable no-console */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| /* eslint-disable no-console */ |
cypress/component/Ansible.cy.tsx
Outdated
|
|
||
| describe('Ansible', () => { | ||
| it('renders supported Ansible', () => { | ||
| /* eslint-disable no-console */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| /* eslint-disable no-console */ |
cypress/component/Ansible.cy.tsx
Outdated
| cy.get('i').should('have.class', 'ansibleSupported-0-2-2'); | ||
| }); | ||
| it('renders unsupported Ansible', () => { | ||
| /* eslint-disable no-console */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| /* eslint-disable no-console */ |
| /* eslint-disable no-console */ | ||
| it('renders the Close button', () => { | ||
| cy.mount(<ErrorState errorTitle='Sample error title' errorDescription='Sample error description' />); | ||
| cy.get('h4').should('have.text', 'Sample error title'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please check also the description?
| it('renders InvalidObject', () => { | ||
| cy.mount(<InvalidObject />) | ||
| cy.get('[class="pf-v5-c-empty-state"]').should('exist') | ||
| cy.get('h1').should('have.text', 'We lost that page'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please also check the description and button?
| describe('LogSnippet', () => { | ||
| it('renders LogSnippet', () => { | ||
| cy.mount(<LogSnippet logSnippet='test test code' message='A test message'/>) | ||
| cy.get('div div p').should('have.text', 'A test message'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the code content could be tested as well
| serviceName="Test bundle" | ||
| prevPageButtonText="Go to previous page" | ||
| />); | ||
| cy.get('div div div h5').should('have.text', 'You do not have access to Test bundle'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please also add the description check?
| it('renders UnavailableContent', () => { | ||
| cy.mount(<UnavailableContent />) | ||
| cy.get('[class="pf-v5-c-empty-state__content"').should('exist'); | ||
| cy.get('div div div h5').should('have.text', 'This page is temporarily unavailable'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you please check the description?
|
@InsaneZein it looks good, just posted some smaller comments. It looks good as a base. It would probably require follow-up tickets to cover all variants of multi-content card and warning modal callbacks. What do you think? |
|
I agree @fhlavac I tried going through the whole document, but had to miss a couple because of lack of bandwidth. |
| describe('ErrorBoundary', () => { | ||
| it('renders the ErrorBoundary ', () => { | ||
| cy.mount(<ErrorBoundary headerTitle="My app header" errorTitle="Something wrong happened"/>) | ||
| // cy.get('div h1').should('have.text', 'Something wrong happened'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is the assertion commented out? Without it we probably even don't need to run the test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For some reason ErrorBoundary is not getting rendered. I'm not sure what's going on. Could we make fixing this as part of the next ticket?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@InsaneZein sounds good, can you please add a description of the issue to that ticket? Thank you
No problem, I've opened a follow-up ticket RHCLOUD-32488 to cover the rest from the document |
| @@ -0,0 +1,9 @@ | |||
| import React from 'react'; | |||
| import ErrorBoundary from '../../packages/module/dist/esm/ErrorBoundary'; | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| import ErrorBoundary from '../../packages/module/dist/esm/ErrorBoundary'; | |
| import ErrorBoundary from '../../packages/module/dist/dynamic/ErrorBoundary'; |
|
🎉 This PR is included in version 5.2.0-prerelease.4 🎉 The release is available on: Your semantic-release bot 📦🚀 |
part of RHCLOUD-31955