-
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
Update file management ui tests #1113
Merged
Merged
Changes from 15 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
92e9afe
Fix mistake
asnaith cb84270
Update homepage page object and file management tests
asnaith 09039b3
Merge branch 'dev' into mnt/filemanagement-test-update-1085
asnaith 01f24a1
Fix typo in test identifier
asnaith 7d6d649
update homePage object
asnaith 0813226
use api client in tests
FSM1 57067db
fix detached from the Dom (#1096)
FSM1 8541f5f
wip
asnaith 17d8db8
Simplify homePage convenience func
asnaith 2151997
Merge branch 'dev' into mnt/filemanagement-test-update-1085
asnaith 60faf43
Merge branch 'dev' into mnt/filemanagement-test-update-1085
asnaith cb53493
Merge branch 'dev' into mnt/filemanagement-test-update-1085
asnaith 40eae21
Increase cypress page load timeout
asnaith 9dd992c
Rename element and update page object
asnaith 162ef9a
Update file management ui tests
asnaith 17e027c
Remove white space
asnaith ff66fa8
Revert to default page load timeout
asnaith 987d1d0
Remove white space
asnaith d311583
Merge branch 'dev' into mnt/filemanagement-test-update-1085
Tbaut File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
{ | ||
"integrationFolder": "cypress/tests", | ||
"pageLoadTimeout": 10000, | ||
"video": false | ||
} |
41 changes: 39 additions & 2 deletions
41
packages/files-ui/cypress/support/page-objects/homePage.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,44 @@ | ||
import { basePage } from "./basePage" | ||
|
||
export const homePage = { | ||
...basePage | ||
// TODO: Andrew - add declarations for unique elements #1085 | ||
...basePage, | ||
|
||
// main browser elements | ||
uploadButton: () => cy.get("[data-cy=upload-modal-button]"), | ||
uploadFileForm: () => cy.get("[data-cy=upload-file-form] input"), | ||
|
||
// file browser row elements | ||
fileItemRow: () => cy.get("[data-cy=file-item-row]", { timeout: 20000 }), | ||
fileItemName: () => cy.get("[data-cy=file-item-name]"), | ||
fileRenameInput: () => cy.get("[data-cy=rename-form] input"), | ||
fileRenameSubmitButton: () => cy.get("[data-cy=rename-submit-button]"), | ||
fileRenameErrorLabel: () => cy.get("[data-cy=rename-form] span.minimal.error"), | ||
fileItemKebabButton: () => cy.get("[data-testid=dropdown-title-fileDropdown]"), | ||
|
||
// upload modal elements | ||
startUploadButton: () => cy.get("[data-cy=upload-ok-button]"), | ||
uploadCancelButton: () => cy.get("[data-cy=upload-cancel-button"), | ||
fileListRemoveButton: () => cy.get("[data-testid=file-list-remove-button-fileUpload]"), | ||
fileUploadList: () => cy.get("[data-testid=file-list-fileUpload] li"), | ||
fileUploadDropzone : () => cy.get("[data-testid=file-input-dropzone-fileUpload]"), | ||
|
||
// menu elements | ||
previewMenuOption: () => cy.get("[data-cy=menu-preview]"), | ||
downloadMenuOption: () => cy.get("[data-cy=menu-download]"), | ||
infoMenuOption: () => cy.get("[data-cy=menu-info]"), | ||
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 | ||
uploadFile(filePath: string) { | ||
this.uploadButton().click() | ||
this.uploadFileForm().attachFile(filePath) | ||
this.fileUploadList().should("have.length", 1) | ||
this.startUploadButton().click() | ||
this.uploadFileForm().should("not.exist") | ||
} | ||
} | ||
|
||
|
||
|
||
asnaith marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,70 @@ | ||
import { homePage } from "../support/page-objects/homePage" | ||
|
||
describe("File management", () => { | ||
|
||
context("desktop", () => { | ||
|
||
it("can add files and cancel", () => { | ||
cy.web3Login() | ||
cy.get("[data-cy=upload-modal-button]").click() | ||
cy.get("[data-cy=upload-file-form] input").attachFile("../fixtures/uploadedFiles/text-file.txt") | ||
cy.get("[data-testid=file-list-fileUpload] li").should("have.length", 1) | ||
cy.get("[data-cy=upload-cancel-button").click() | ||
cy.get("[data-cy=files-app-header").should("be.visible") | ||
|
||
// upload a file and see it in the file list | ||
homePage.uploadButton().click() | ||
homePage.uploadFileForm().attachFile("../fixtures/uploadedFiles/text-file.txt") | ||
homePage.fileUploadList().should("have.length", 1) | ||
|
||
// cancel and ensure that the upload modal is dismissed | ||
homePage.uploadCancelButton().click() | ||
homePage.uploadCancelButton().should("not.exist") | ||
homePage.uploadFileForm().should("not.exist") | ||
}) | ||
|
||
it("can add/remove files and upload", () => { | ||
it("can add/remove multiple files and upload", () => { | ||
cy.web3Login({ clearCSFBucket: true }) | ||
cy.get("[data-cy=upload-modal-button]").click() | ||
cy.get("[data-cy=upload-file-form] input").attachFile("../fixtures/uploadedFiles/text-file.txt") | ||
cy.get("[data-testid=file-list-fileUpload] li").should("have.length", 1) | ||
cy.get("[data-cy=upload-file-form] input").attachFile("../fixtures/uploadedFiles/logo.png") | ||
cy.get("[data-testid=file-list-fileUpload] li").should("have.length", 2) | ||
cy.get("[data-testid=file-list-close-button-fileUpload]").first().click() | ||
cy.get("[data-testid=file-list-fileUpload] li").should("have.length", 1) | ||
cy.get("[data-cy=upload-file-form] input").attachFile("../fixtures/uploadedFiles/text-file.txt") | ||
cy.get("[data-testid=file-list-fileUpload] li").should("have.length", 2) | ||
cy.get("[data-cy=upload-ok-button]").click() | ||
cy.get("[data-cy=files-app-header]").should("be.visible") | ||
cy.get("[data-cy=file-item-row]").should("have.length", 2) | ||
|
||
// attach 2 files to the file list | ||
homePage.uploadButton().click() | ||
homePage.uploadFileForm().attachFile("../fixtures/uploadedFiles/text-file.txt") | ||
homePage.fileUploadList().should("have.length", 1) | ||
homePage.uploadFileForm().attachFile("../fixtures/uploadedFiles/logo.png") | ||
homePage.fileUploadList().should("have.length", 2) | ||
|
||
// remove 1 file from the list and ensure 1 remains | ||
homePage.fileListRemoveButton().first().click() | ||
homePage.fileUploadList().should("have.length", 1) | ||
|
||
// attach an additional file to the file list and upload | ||
homePage.uploadFileForm().attachFile("../fixtures/uploadedFiles/text-file.txt") | ||
homePage.fileUploadList().should("have.length", 2) | ||
homePage.startUploadButton().click() | ||
homePage.uploadFileForm().should("not.exist") | ||
homePage.fileItemRow().should("have.length", 2) | ||
}) | ||
|
||
it("can rename a file with error handling", () => { | ||
const newName = "awesome new name" | ||
|
||
cy.web3Login({ clearCSFBucket: true }) | ||
cy.get("[data-cy=upload-modal-button]").click() | ||
cy.get("[data-cy=upload-file-form] input").attachFile("../fixtures/uploadedFiles/text-file.txt") | ||
cy.get("[data-cy=upload-ok-button]").click() | ||
cy.get("[data-cy=files-app-header]").should("be.visible") | ||
|
||
cy.get("[data-testid=drowpdown-title-fileDropdown]").first().click() | ||
cy.get("[data-cy=menu-rename]").click() | ||
cy.get("[data-cy=rename-form] input").type("{selectall}{del}") | ||
cy.get("[data-cy=rename-form] span.minimal.error").should("be.visible") | ||
cy.get("[data-cy=rename-form] input").type(`${newName}{enter}`) | ||
cy.get("[data-cy=file-item-name]").contains(newName) | ||
|
||
cy.get("[data-testid=drowpdown-title-fileDropdown]").first().click() | ||
cy.get("[data-cy=menu-rename]").click() | ||
cy.get("[data-cy=rename-form] input").type("{selectall}{del}{esc}") | ||
cy.get("[data-cy=rename-form] input").should("not.exist") | ||
cy.get("[data-cy=file-item-name]").contains(newName) | ||
|
||
// upload a file | ||
homePage.uploadFile("../fixtures/uploadedFiles/text-file.txt") | ||
homePage.fileItemRow().should("have.length", 1) | ||
|
||
// ensure an error is displayed if the edited name is blank | ||
homePage.fileItemKebabButton().first().click() | ||
homePage.renameMenuOption().click() | ||
homePage.fileRenameInput().type("{selectall}{del}") | ||
homePage.fileRenameErrorLabel().should("be.visible") | ||
|
||
// rename a file | ||
homePage.fileRenameInput().type(`${newName}{enter}`) | ||
homePage.fileItemName().contains(newName) | ||
|
||
// ensure the original name persists if the rename submission is blank | ||
homePage.fileItemKebabButton().first().click() | ||
homePage.renameMenuOption().click() | ||
homePage.fileRenameInput().type("{selectall}{del}{esc}") | ||
homePage.fileRenameInput().should("not.exist") | ||
homePage.fileItemName().contains(newName) | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Hmm are you sure, this is effectively reducing the page timeout afaiu, the default is 60s, (60000) according to https://docs.cypress.io/guides/references/configuration#Timeouts
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.
@Tbaut Oh good catch, thank you. I'd misread.
After making the change I ran the test 100 times and didn't see a page load error so I thought that had solved the issue but I'd actually lowered it and got lucky.
I've reverted this change now. I think it's fine to keep the timeout as the default, if it's longer than 60 seconds it is probably a genuine problem and not a test related issue.