-
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
Add test coverage for storage summary adjustments #1536
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
042bb9d
Add identifiers for file delete toasts
c097b10
Add checks to ensure the storage summary updates on upload and deletion
7d73ef9
Merge branch 'dev' into mnt/add-test-for-storage-summary-1530
asnaith 1909dc8
lingui extract
actions-user 024b0fe
Merge branch 'dev' into mnt/add-test-for-storage-summary-1530
asnaith 9125263
Merge branch 'dev' into mnt/add-test-for-storage-summary-1530
Tbaut d797caf
Add ui tests for deleting and recovering multiple files (#1539)
asnaith b77ec6b
Merge branch 'dev' into mnt/add-test-for-storage-summary-1530
asnaith 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
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 |
---|---|---|
|
@@ -248,7 +248,7 @@ describe("File management", () => { | |
binPage.recoverMenuOption().click() | ||
recoverItemModal.folderList().should("exist") | ||
recoverItemModal.folderList().contains("Home").click() | ||
recoverItemModal.recoverButton().click() | ||
recoverItemModal.recoverButton().safeClick() | ||
binPage.fileItemRow().should("not.exist") | ||
|
||
// ensure recovered file is correct | ||
|
@@ -300,7 +300,7 @@ describe("File management", () => { | |
binPage.recoverMenuOption().click() | ||
recoverItemModal.folderList().should("exist") | ||
recoverItemModal.folderList().contains("Home").click() | ||
recoverItemModal.recoverButton().click() | ||
recoverItemModal.recoverButton().safeClick() | ||
binPage.fileItemRow().should("not.exist") | ||
|
||
// ensure recovered folder is correct | ||
|
@@ -350,5 +350,69 @@ describe("File management", () => { | |
createFolderModal.errorLabel().should("be.visible") | ||
createFolderModal.body().should("contain.text", "Name too long") | ||
}) | ||
|
||
it("can see storage space summary updated accordingly", () => { | ||
cy.web3Login({ clearCSFBucket: true, clearTrashBucket: true }) | ||
|
||
// Make sure elements exist and that we are starting with 0 | ||
navigationMenu.spaceUsedProgressBar().should("be.visible") | ||
navigationMenu.spaceUsedLabel().should("contain.text", "0 Bytes") | ||
|
||
// upload a file and ensure the storage space label adjusts | ||
homePage.uploadFile("../fixtures/uploadedFiles/logo.png") | ||
navigationMenu.spaceUsedLabel().should("not.contain.text", "0 Bytes") | ||
|
||
// delete the file from the bin and ensure the storage space label adjusts | ||
homePage.fileItemKebabButton().click() | ||
homePage.deleteMenuOption().click() | ||
deleteFileModal.confirmButton().safeClick() | ||
homePage.deleteSuccessToast().should("not.exist") | ||
navigationMenu.binNavButton().click() | ||
binPage.fileItemKebabButton().click() | ||
binPage.deleteMenuOption().click() | ||
deleteFileModal.confirmButton().safeClick() | ||
binPage.permanentDeleteSuccessToast().should("not.exist") | ||
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. same here |
||
navigationMenu.spaceUsedLabel().should("contain.text", "0 Bytes") | ||
}) | ||
|
||
it("can delete and recover multiple files", () => { | ||
cy.web3Login({ clearCSFBucket: true, clearTrashBucket: true }) | ||
|
||
// upload 2 files | ||
homePage.uploadFile("../fixtures/uploadedFiles/logo.png") | ||
homePage.uploadFile("../fixtures/uploadedFiles/text-file.txt") | ||
homePage.fileItemRow().should("have.length", 2) | ||
|
||
// store their file names as cypress aliases for later comparison | ||
homePage.fileItemName().eq(0).invoke("text").as("fileNameA") | ||
homePage.fileItemName().eq(1).invoke("text").as("fileNameB") | ||
|
||
// delete both of the files in the same action | ||
homePage.selectAllCheckbox().click() | ||
homePage.deleteSelectedButton().click() | ||
deleteFileModal.confirmButton().safeClick() | ||
homePage.deleteSuccessToast().should("not.exist") | ||
homePage.fileItemRow().should("have.length", 0) | ||
|
||
// recover both of the files in the same action | ||
navigationMenu.binNavButton().click() | ||
binPage.selectAllCheckbox().click() | ||
binPage.recoverSelectedButton().click() | ||
recoverItemModal.folderList().should("exist") | ||
recoverItemModal.folderList().contains("Home").click() | ||
recoverItemModal.recoverButton().safeClick() | ||
binPage.fileItemRow().should("not.exist") | ||
|
||
// return home and ensure both of the files were recovered | ||
navigationMenu.homeNavButton().click() | ||
|
||
cy.get("@fileNameA").then(($fileNameA) => { | ||
homePage.fileItemName().should("contain.text", $fileNameA) | ||
}) | ||
|
||
cy.get("@fileNameB").then(($fileNameB) => { | ||
homePage.fileItemName().should("contain.text", $fileNameB) | ||
}) | ||
}) | ||
}) | ||
}) |
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
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 |
---|---|---|
|
@@ -870,6 +870,7 @@ const FilesList = ({ isShared = false }: Props) => { | |
<CheckboxInput | ||
value={selectedItems.length === items.length} | ||
onChange={() => toggleAll()} | ||
testId="select-all" | ||
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. Thanks for this update to the way we add identifiers to checkbox's @Tbaut 👍 |
||
/> | ||
</TableHeadCell> | ||
<TableHeadCell> | ||
|
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.
Now that we have the ability to close the toasts, I think it'd be cool do it, this would speed up tests a bit rather than waiting 4 sec every time.
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 Yeah, it will definitely speed up the tests but waiting for them to disappear adds a lot of reliability as we know for certain we are not doing anything else before the upload / delete is fully complete.
Without waiting for the toast to disappear I have seen that sometimes the UI does not update quick enough before performing the next actions / assertions and as we don't want to add hardcoded waits this was the best thing I could think of.
I'm not sure if dismissing the toast will give us the same level of reliability but definitely something we can try (is it all good if we look into that separately out of the context of this PR?).
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 the moment the toast for success appears, we should 100% have the UI re-render, and actually see the results of our action. Cypress has a default 4s timeout, which should really suffice IMHO
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 Ah ok I think it's because all of the uploading status toasts have the same identifier at the moment then, maybe I need to specifically put one on the "upload complete" status and then dismiss.
We can address this separately in this issue : #1544