-
Notifications
You must be signed in to change notification settings - Fork 363
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
test: [M3-8608] - Cypress test for restricted user Image non-empty landing page #11335
base: develop
Are you sure you want to change the base?
Conversation
cy.wait('@getImages'); | ||
cy.url().should('endWith', '/images'); | ||
|
||
cy.contains('Custom Images') |
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.
To make the code more robust, search for "Custom Images" using the h3 tag and use .closest() to locate the parent div instead of relying on the div hierarchy. This approach avoids potential failures caused by changes in the div structure.
Suggested change
cy.contains('h3', 'Custom Images')
.closest('div[data-qa-paper="true"]')
.find('[role="table"]')
.should('exist')
.as('customImageTable');
.should('exist') | ||
.as('customImageTable'); | ||
|
||
cy.contains('Recovery Images') |
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.
same as above
cy.contains('h3', 'Recovery Images')
.closest('div[data-qa-paper="true"]')
.find('[role="table"]')
.should('exist')
.as('recoveryImageTable');
.find('tbody tr') | ||
.should('have.length', mockImages.length); | ||
|
||
function checkActionMenu(tableAlias: string) { |
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.
To enhance the readability of the test, I recommend moving this function outside the test block. This will help reduce nesting and make the test easier to follow.
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.
Please update the test file name to "images-non-empty-landing-page.spec.ts"
Cloud Manager UI test results🎉 463 passing tests on test run #4 ↗︎
|
Description 📝
Added cypress test for restricted user Image non-Empty landing page
Changes 🔄
Added below cypress tests under in spec file -
cypress/e2e/core/images/images-non-empty-landing-page.spec.ts
2. Navigate to images page with restricted user - https://cloud.linode.com/images
2. Validate that "Create Image" button is disabled.
3. Validate the tooltip warning message "You don't have permissions to create Images. Please contact your account administrator to request the necessary permissions."
4. Validate the action menu items are disabled for restricted user except "Deploy to New Linode"
How to test 🧪
yarn cy:run -s cypress/e2e/core/images/images-non-empty-landing-page.spec.ts
Verification steps
When test executed using this command
yarn cy:run -s cypress/e2e/core/images/images-non-empty-landing-page.spec.ts
all tests should pass successfully.As an Author I have considered 🤔
Check all that apply