-
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
Improve bucket upload ui tests #2117
Changes from 12 commits
5e73520
8250582
850f336
44a994f
e2e186b
465c50d
b5b5158
3237046
4c5fec8
21b5276
424e91c
4985fdb
cc72533
03c33ae
3bf32f2
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
export const bucketName = "test bucket" | ||
export const chainSafeBucketName = `cs bucket ${Date.now()}` | ||
export const ipfsBucketName = `ipfs bucket ${Date.now()}` | ||
export const testCid = "QmZEE7Ymh2mRMURLnFLipJTovb44AoUYDzx7aipYZwvxX5" | ||
export const testCidAlternative = "QmSMNExVSNKwWNeXL3o6a2og13441g1eUqLgTeuCSDvN2W" | ||
export const testCidName = "cute cat" | ||
export const testCidName = "cute cat" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { basePage } from "./basePage" | ||
|
||
export const bucketContentsPage = { | ||
...basePage, | ||
|
||
// bucket content browser elements | ||
bucketHeaderLabel: () => cy.get("[data-cy=header-bucket]", { timeout: 20000 }), | ||
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. this timeout is because this type of web elements take longer to load than usual, right? 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. Actually...this was unnecessary 😄. It was left there by accident. I have pushed a commit to remove it and some others which aren't needed. The default is 6 seconds and that will be ok. |
||
newFolderButton: () => cy.get("[data-testid=button-new-folder] "), | ||
uploadButton: () => cy.get("[data-testid=button-upload-file]"), | ||
|
||
// file or folder browser row elements | ||
fileItemKebabButton: () => cy.get("[data-testid=icon-file-item-kebab]", { timeout: 10000 }), | ||
fileItemName: () => cy.get("[data-cy=label-file-item-name]"), | ||
fileItemRow: () => cy.get("[data-cy=row-file-item]", { timeout: 20000 }), | ||
|
||
// kebab menu elements | ||
downloadMenuOption: () => cy.get("[data-cy=menu-download]"), | ||
renameMenuOption: () => cy.get("[data-cy=menu-rename]"), | ||
moveMenuOption: () => cy.get("[data-cy=menu-move]"), | ||
deleteMenuOption: () => cy.get("[data-cy=menu-delete]"), | ||
|
||
// helpers and convenience functions | ||
awaitBucketRefresh() { | ||
cy.intercept("POST", "**/bucket/*/ls").as("refresh") | ||
cy.wait("@refresh") | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
export const createBucketModal = { | ||
body: () => cy.get("[data-testid=modal-container-create-bucket]", { timeout: 10000 }), | ||
bucketNameInput: () => cy.get("[data-cy=input-bucket-name]"), | ||
chainsafeRadioInput: () => cy.get("[data-testid=radio-input-chainsafe]"), | ||
ipfsRadioInput: () => cy.get("[data-testid=radio-input-ipfs]"), | ||
cancelButton: () => cy.get("[data-cy=button-cancel-create]"), | ||
submitButton: () => cy.get("[data-cy=button-submit-create]") | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
export const fileUploadModal = { | ||
body: () => cy.get("[data-cy=form-upload-file] input", { timeout: 10000 }), | ||
cancelButton: () => cy.get("[data-testid=button-cancel-upload]"), | ||
fileList: () => cy.get("[data-testid=list-fileUpload] li"), | ||
removeFileButton: () => cy.get("[data-testid=button-remove-from-file-list]"), | ||
uploadButton: () => cy.get("[data-testid=button-start-upload]"), | ||
uploadDropzone : () => cy.get("[data-testid=input-file-dropzone-fileUpload]"), | ||
errorLabel: () => cy.get("[data-testid=meta-error-message-fileUpload]") | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export const uploadStatusToast = { | ||
body: () => cy.get("[data-cy=upload_status_toast_message]", { timeout: 20000 }) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -136,7 +136,7 @@ const UploadFileModal = ({ modalOpen, close }: IUploadFileModuleProps) => { | |
/> | ||
<footer className={classes.footer}> | ||
<Button | ||
data-cy="upload-cancel-button" | ||
testId="cancel-upload" | ||
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. why testId and not data-cy? this modal es reusable? 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. @juans-chainsafe In this example specifically, the button component already has a testId prop so I'm just passing something through to that, as opposed to writing a custom attribute directly on the element. It's a little cleaner / more readable ("testId" is instantly obvious to all reading the code what it's for). For buttons, either type of locator will work, but there are instances with other components where this is not the case:
I am certain you will encounter this too at some point. Hopefully, this explanation makes sense but we can also discuss it further if you want :) |
||
onClick={close} | ||
size="medium" | ||
className={classes.cancelButton} | ||
|
@@ -146,7 +146,7 @@ const UploadFileModal = ({ modalOpen, close }: IUploadFileModuleProps) => { | |
<Trans>Cancel</Trans> | ||
</Button> | ||
<Button | ||
data-cy="upload-ok-button" | ||
testId="start-upload" | ||
size="medium" | ||
type="submit" | ||
variant="primary" | ||
|
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.
We remove the bucket from the UI instantly and don't wait for any confirmation so to avoid issues I'm using unique names here.