-
Notifications
You must be signed in to change notification settings - Fork 16
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
[Storage] Validate errors on create bucket modal test #2224
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,16 +21,35 @@ describe("Bucket management", () => { | |
createBucketModal.cancelButton().click() | ||
createBucketModal.body().should("not.exist") | ||
|
||
// create a bucket and see it in the bucket table | ||
// go to create bucket modal | ||
bucketsPage.createBucketButton().click() | ||
createBucketModal.body().should("be.visible") | ||
|
||
// ensure can't create an empty bucket | ||
createBucketModal.submitButton().click() | ||
createBucketModal.bucketNameInput().should("have.class", "error") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Interesting, I've never thought about using the class name before like this. I would usually avoid doing that (as I'd be concerned about it being too generic and potentially picking up a false match from elsewhere on the page)...but you've scoped it to within the bucketNameInput element so I guess that's not a valid concern, nice! 🤩 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes! the other way around is checking that the modal is still present and validating the text... but we don't want to add validations that have hardcoded text, so I ended up doing that inside the input, so we shouldn't have any problem. Also, I added a validation when the input is correct that the class 'error' should not be present |
||
|
||
// ensure can't create a bucket with only spaces | ||
createBucketModal.bucketNameInput().type(" ") | ||
createBucketModal.submitButton().click() | ||
createBucketModal.bucketNameInput().should("have.class", "error") | ||
|
||
// create a bucket and see it in the bucket table | ||
createBucketModal.bucketNameInput().type(chainSafeBucketName) | ||
createBucketModal.bucketNameInput().should("not.have.class", "error") | ||
createBucketModal.chainsafeRadioInput().click() | ||
createBucketModal.submitButton().click() | ||
bucketsPage.bucketItemRow().should("have.length", 1) | ||
bucketsPage.bucketItemName().should("have.text", chainSafeBucketName) | ||
bucketsPage.bucketFileSystemType().should("have.text", "Chainsafe") | ||
|
||
// ensure can't create a bucket with the same name | ||
bucketsPage.createBucketButton().click() | ||
createBucketModal.bucketNameInput().type(chainSafeBucketName) | ||
createBucketModal.submitButton().click() | ||
createBucketModal.bucketNameInput().should("have.class", "error") | ||
createBucketModal.cancelButton().click() | ||
|
||
// open bucket and ensure header matches the expected value | ||
bucketsPage.bucketItemName().dblclick() | ||
bucketContentsPage.bucketHeaderLabel() | ||
|
@@ -67,16 +86,34 @@ describe("Bucket management", () => { | |
cy.web3Login({ clearPins: true, deleteFpsBuckets: true }) | ||
navigationMenu.bucketsNavButton().click() | ||
|
||
// create a bucket and see it in the bucket table | ||
// go to create bucket modal | ||
bucketsPage.createBucketButton().click() | ||
createBucketModal.body().should("be.visible") | ||
|
||
// ensure can't create an empty bucket | ||
createBucketModal.submitButton().click() | ||
createBucketModal.bucketNameInput().should("have.class", "error") | ||
|
||
// ensure can't create a bucket with only spaces | ||
createBucketModal.bucketNameInput().type(" ") | ||
createBucketModal.submitButton().click() | ||
createBucketModal.bucketNameInput().should("have.class", "error") | ||
|
||
// create a bucket and see it in the bucket table | ||
createBucketModal.bucketNameInput().type(ipfsBucketName) | ||
createBucketModal.ipfsRadioInput().click() | ||
createBucketModal.submitButton().click() | ||
bucketsPage.bucketItemRow().should("have.length", 1) | ||
bucketsPage.bucketItemName().should("have.text", ipfsBucketName) | ||
bucketsPage.bucketFileSystemType().should("have.text", "IPFS MFS") | ||
|
||
// ensure can't create a bucket with the same name | ||
bucketsPage.createBucketButton().click() | ||
createBucketModal.bucketNameInput().type(ipfsBucketName) | ||
createBucketModal.submitButton().click() | ||
createBucketModal.bucketNameInput().should("have.class", "error") | ||
createBucketModal.cancelButton().click() | ||
|
||
// open bucket and ensure header matches the expected value | ||
bucketsPage.bucketItemName().dblclick() | ||
bucketContentsPage.bucketHeaderLabel() | ||
|
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.
Minor thing but I find that leaving a whitespace before each comment / individual check in the flow of the test helps readability, it's not done here but is elsewhere in 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.
yep! it helps, done!