-
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
Rename folder and file in Storage test #2214
Conversation
Your Render PR Server URL is https://chainsafe-components-stage-pr-2214.onrender.com. Follow its progress at https://dashboard.render.com/static/srv-cb28iada4991n33vpgeg. |
Your Render PR Server URL is https://files-ui-stage-pr-2214.onrender.com. Follow its progress at https://dashboard.render.com/static/srv-cb28ibta4991n33vpgj0. |
Your Render PR Server URL is https://storage-ui-stage-pr-2214.onrender.com. Follow its progress at https://dashboard.render.com/static/srv-cb28idda4991n33vph4g. |
import { basePage } from "./basePage" | ||
import { createBucketModal } from "./modals/createBucketModal" | ||
|
||
type BucketType = "ipfs" | "chainsafe" |
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.
improvement suggested by Thibaut in #2207 (comment)
// ensure the original name of the folder persists if the rename submission is blank | ||
bucketContentsPage.renameFileOrFolder("{selectall}{del}{esc}") | ||
bucketContentsPage.fileRenameInput().should("not.exist") | ||
bucketContentsPage.fileItemName().contains(newFolderName) |
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.
Original name has already been updated to the new one by this point (see assertion) so just to make the test read better then probably makes sense to swap the order of this check to before the rename, what do you think?
// ensure that the name of the folder is reset when renaming is canceled | ||
bucketContentsPage.renameFileOrFolder("{selectall}abc{del}{esc}") | ||
bucketContentsPage.fileRenameInput().should("not.exist") | ||
bucketContentsPage.fileItemKebabButton().first().click() |
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.
I don't think first
is necessary as there is only one folder present?
bucketContentsPage.fileItemKebabButton().first().click() | |
bucketContentsPage.fileItemKebabButton().click() |
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.
I will fix this ones and the {selectall}{del} error in Files as well
bucketContentsPage.fileItemName().contains(newFolderName) | ||
|
||
// ensure that the name of the folder is reset when renaming is canceled | ||
bucketContentsPage.renameFileOrFolder("{selectall}abc{del}{esc}") |
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.
bucketContentsPage.renameFileOrFolder("{selectall}abc{del}{esc}") | |
bucketContentsPage.renameFileOrFolder("{selectall}{del}abc{esc}") |
bucketContentsPage.fileItemName().contains(newFolderName) | ||
|
||
// ensure that the name of the folder is reset when renaming is canceled | ||
bucketContentsPage.renameFileOrFolder("{selectall}abc{del}{esc}") |
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.
bucketContentsPage.renameFileOrFolder("{selectall}abc{del}{esc}") | |
bucketContentsPage.renameFileOrFolder("{selectall}{del}abc{esc}") |
bucketContentsPage.fileItemName().contains(newFileName) | ||
|
||
// ensure that the name of the file is reset when renaming is canceled | ||
bucketContentsPage.renameFileOrFolder("{selectall}abc{del}{esc}") |
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.
bucketContentsPage.renameFileOrFolder("{selectall}abc{del}{esc}") | |
bucketContentsPage.renameFileOrFolder("{selectall}{del}abc{esc}") |
bucketContentsPage.fileItemName().contains(newFileName) | ||
|
||
// ensure that the name of the file is reset when renaming is canceled | ||
bucketContentsPage.renameFileOrFolder("{selectall}abc{del}{esc}") |
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.
bucketContentsPage.renameFileOrFolder("{selectall}abc{del}{esc}") | |
bucketContentsPage.renameFileOrFolder("{selectall}{del}abc{esc}") |
}, | ||
|
||
renameFileOrFolder(newName: string) { | ||
bucketContentsPage.fileItemKebabButton().first().click() |
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.
bucketContentsPage.fileItemKebabButton().first().click() | |
bucketContentsPage.fileItemKebabButton().click() |
// ensure that the name of the folder is reset when renaming is canceled | ||
bucketContentsPage.renameFileOrFolder("{selectall}abc{del}{esc}") | ||
bucketContentsPage.fileRenameInput().should("not.exist") | ||
bucketContentsPage.fileItemKebabButton().first().click() |
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.
bucketContentsPage.fileItemKebabButton().first().click() | |
bucketContentsPage.fileItemKebabButton().click() |
// ensure that the name of the file is reset when renaming is canceled | ||
bucketContentsPage.renameFileOrFolder("{selectall}abc{del}{esc}") | ||
bucketContentsPage.fileRenameInput().should("not.exist") | ||
bucketContentsPage.fileItemKebabButton().first().click() |
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.
bucketContentsPage.fileItemKebabButton().first().click() | |
bucketContentsPage.fileItemKebabButton().click() |
// ensure that the name of the file is reset when renaming is canceled | ||
bucketContentsPage.renameFileOrFolder("{selectall}abc{del}{esc}") | ||
bucketContentsPage.fileRenameInput().should("not.exist") | ||
bucketContentsPage.fileItemKebabButton().first().click() |
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.
bucketContentsPage.fileItemKebabButton().first().click() | |
bucketContentsPage.fileItemKebabButton().click() |
cy.wait("@refresh") | ||
}, | ||
|
||
createBucket(bucketName: string, bucketType: BucketType) { |
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.
You could do this
createBucket(bucketName: string, bucketType: BucketType) { | |
createBucket(bucketName: string, bucketType: "ipfs" | "chainsafe") { |
and then no need to have type BucketType = "ipfs" | "chainsafe"
declared towards the top of the file.
As there are only two types of bucket you could also get rid of the switch for a simpler if / else statement
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.
make sense to have it as a parameter because is only used there! and... yeah as well make sense that can be solved with if/else because is only 2 types of file system
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.
Looks good @juans-chainsafe! Just left some minor suggestions.
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.
Great one and great review by Andrew, nothing else to add :)
closes #2204