From 84bc46a928f3b85465ef38b224b50b2da3379bed Mon Sep 17 00:00:00 2001 From: Ashwin Kumar Date: Mon, 25 Nov 2024 16:34:41 -0500 Subject: [PATCH] test(e2e): add storage-browser offline tests --- .../e2e/cypress/integration/common/shared.ts | 6 ++ .../storage-browser/action-menu.feature | 68 +++++++++++++++++++ 2 files changed, 74 insertions(+) diff --git a/packages/e2e/cypress/integration/common/shared.ts b/packages/e2e/cypress/integration/common/shared.ts index 904689cf1e..add555cc16 100644 --- a/packages/e2e/cypress/integration/common/shared.ts +++ b/packages/e2e/cypress/integration/common/shared.ts @@ -687,3 +687,9 @@ When( (folderName: string, count: string) => fileInputUpload(parseInt(count), folderName) ); + +When('I simulate network disconnection', () => { + cy.intercept('', (req) => { + req.destroy(); + }); +}); diff --git a/packages/e2e/features/ui/components/storage/storage-browser/action-menu.feature b/packages/e2e/features/ui/components/storage/storage-browser/action-menu.feature index 7371490c47..19fdd44e43 100644 --- a/packages/e2e/features/ui/components/storage/storage-browser/action-menu.feature +++ b/packages/e2e/features/ui/components/storage/storage-browser/action-menu.feature @@ -139,3 +139,71 @@ Feature: Create folder with Storage Browser # verify all files are deleted Then I see "No files" + @react + Scenario: Upload file shows a Network error if offline + When I type my "email" with status "CONFIRMED" + Then I type my password + Then I click the "Sign in" button + When I click the first button containing "public" + Then I see the "Menu Toggle" button + When I click the "Menu Toggle" button + Then I see the "Upload" menuitem + When I click the "Upload" menuitem + Then I upload "1" files with random names + Then I simulate network disconnection + When I click the "Upload" button + Then I see "All files failed to upload" + + @react + Scenario: List location items shows a Network error if offline + When I type my "email" with status "CONFIRMED" + Then I type my password + Then I click the "Sign in" button + When I see the first button containing "public" + Then I simulate network disconnection + When I click the first button containing "public" + Then I see "Network Error" + + @react + Scenario: Create folder shows a Network error if offline + When I type my "email" with status "CONFIRMED" + Then I type my password + Then I click the "Sign in" button + When I click the first button containing "public" + Then I see the "Menu Toggle" button + When I click the "Menu Toggle" button + Then I see the "Create Folder" menuitem + When I click the "Create Folder" menuitem + Then I see "Folder name" + When I type a new "Folder name" with random value + Then I simulate network disconnection + When I click the "Create Folder" button + Then I see "There was an issue creating the folder" + + @react + Scenario: Copy file shows a Network error if offline + When I type my "email" with status "CONFIRMED" + Then I type my password + Then I click the "Sign in" button + When I click the first button containing "public" + Then I click checkbox for file "001_dont_delete_file.txt" + When I click the "Menu Toggle" button + When I click the "Copy" menuitem + Then I click the "DoNotDeleteThisFolder_CanDeleteAllChildren/" button + Then I simulate network disconnection + Then I click the "Copy" button + Then I see "All files failed to copy" + + @react + Scenario: Delete file shows a Network error if offline + When I type my "email" with status "CONFIRMED" + Then I type my password + Then I click the "Sign in" button + When I click the first button containing "public" + Then I click checkbox for file "001_dont_delete_file.txt" + When I click the "Menu Toggle" button + When I click the "Delete" menuitem + Then I simulate network disconnection + Then I click the "Delete" button + Then I see "All files failed to delete" +