From 84bc46a928f3b85465ef38b224b50b2da3379bed Mon Sep 17 00:00:00 2001 From: Ashwin Kumar Date: Mon, 25 Nov 2024 16:34:41 -0500 Subject: [PATCH 1/6] 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" + From a03f8e0ca0591708b4c59aebe86c5a68466a5333 Mon Sep 17 00:00:00 2001 From: Ashwin Kumar Date: Mon, 25 Nov 2024 18:35:54 -0500 Subject: [PATCH 2/6] address feedback --- .../storage-browser/action-menu.feature | 54 +++++-------------- .../storage/storage-browser/download.feature | 9 ++-- .../storage-browser/drag-and-drop.feature | 14 ++--- .../storage-browser/filter-locations.feature | 1 - .../navigate-locations.feature | 12 ++--- .../storage-browser/search-locations.feature | 9 ++-- 6 files changed, 25 insertions(+), 74 deletions(-) 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 19fdd44e43..eb36c25023 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 @@ -2,12 +2,12 @@ Feature: Create folder with Storage Browser Background: Given I'm running the example "ui/components/storage/storage-browser/default-auth" + And I type my "email" with status "CONFIRMED" + And I type my password + And I click the "Sign in" button @react Scenario: Create folder successfully creates a new empty folder - 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" When I click the first button containing "DoNotDeleteThisFolder_CanDeleteAllChildren" Then I see the "Menu Toggle" button @@ -29,9 +29,6 @@ Feature: Create folder with Storage Browser @react Scenario: Create folder fails on overwrite of existing folder name - 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 @@ -47,9 +44,6 @@ Feature: Create folder with Storage Browser @react Scenario: Create folder input shows error message when folder name contains "/" - 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 @@ -64,9 +58,6 @@ Feature: Create folder with Storage Browser @react Scenario: upload, list, copy and delete a file using toggle menu - 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 @@ -109,9 +100,6 @@ Feature: Create folder with Storage Browser @react Scenario: upload a folder - 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 @@ -141,69 +129,53 @@ Feature: Create folder with Storage Browser @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 + When I simulate network disconnection + Then 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" + When I simulate network disconnection + Then 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 type a new "Folder name" with random value + When I simulate network disconnection + Then 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 + When 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" menuitem + When I simulate network disconnection Then I click the "Delete" button Then I see "All files failed to delete" - diff --git a/packages/e2e/features/ui/components/storage/storage-browser/download.feature b/packages/e2e/features/ui/components/storage/storage-browser/download.feature index 74d7c34673..3859c60a79 100644 --- a/packages/e2e/features/ui/components/storage/storage-browser/download.feature +++ b/packages/e2e/features/ui/components/storage/storage-browser/download.feature @@ -2,20 +2,17 @@ Feature: Download on Storage Browser Background: Given I'm running the example "ui/components/storage/storage-browser/default-auth" + And I type my "email" with status "CONFIRMED" + And I type my password + And I click the "Sign in" button @react Scenario: Download is available for files - 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 download for file "001_dont_delete_file.txt" Then I click and see download succeed for "001_dont_delete_file.txt" @react Scenario: Download is not available for folder - 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 no download for folder "DO_NOT_DELETE/" diff --git a/packages/e2e/features/ui/components/storage/storage-browser/drag-and-drop.feature b/packages/e2e/features/ui/components/storage/storage-browser/drag-and-drop.feature index 616dd8c9a2..39eb86884c 100644 --- a/packages/e2e/features/ui/components/storage/storage-browser/drag-and-drop.feature +++ b/packages/e2e/features/ui/components/storage/storage-browser/drag-and-drop.feature @@ -2,12 +2,12 @@ Feature: Drag and drop files within Storage Browser Background: Given I'm running the example "ui/components/storage/storage-browser/default-auth" + And I type my "email" with status "CONFIRMED" + And I type my password + And I click the "Sign in" button @react Scenario: Drag and drop file into Location Detail view - 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" When I drag and drop a file into the storage browser with file name "test.txt" Then I see "Upload" @@ -15,20 +15,13 @@ Feature: Drag and drop files within Storage Browser @react Scenario: Drag and drop folder into Location Detail view - 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" When I drag and drop a folder into the storage browser with name "test" Then I see "Upload" Then I see "test" - @react Scenario: Drag and drop file into Upload Action view - 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 @@ -38,4 +31,3 @@ Feature: Drag and drop files within Storage Browser Then I press the "{esc}" key When I drag and drop a file into the storage browser with file name "test.txt" Then I see "test.txt" - \ No newline at end of file diff --git a/packages/e2e/features/ui/components/storage/storage-browser/filter-locations.feature b/packages/e2e/features/ui/components/storage/storage-browser/filter-locations.feature index 60a7a44fc4..7f32e9b976 100644 --- a/packages/e2e/features/ui/components/storage/storage-browser/filter-locations.feature +++ b/packages/e2e/features/ui/components/storage/storage-browser/filter-locations.feature @@ -15,4 +15,3 @@ Feature: StorageBrowser Filter Locations Then I do not see the button containing "private" When I click the button containing "Clear search" Then I see the first button containing "private" - diff --git a/packages/e2e/features/ui/components/storage/storage-browser/navigate-locations.feature b/packages/e2e/features/ui/components/storage/storage-browser/navigate-locations.feature index 03f0566cfe..e6aca9ac0f 100644 --- a/packages/e2e/features/ui/components/storage/storage-browser/navigate-locations.feature +++ b/packages/e2e/features/ui/components/storage/storage-browser/navigate-locations.feature @@ -2,12 +2,12 @@ Feature: Storage Browser navigate breadcrumbs Background: Given I'm running the example "ui/components/storage/storage-browser/default-auth" + And I type my "email" with status "CONFIRMED" + And I type my password + And I click the "Sign in" button @react Scenario: Navigate back to Home - 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 "Home" button When I click the "Home" button @@ -16,9 +16,6 @@ Feature: Storage Browser navigate breadcrumbs @react Scenario: Navigate back up to prefix - 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 "DO_NOT_DELETE/" button When I click the "DO_NOT_DELETE/" button @@ -29,9 +26,6 @@ Feature: Storage Browser navigate breadcrumbs @react Scenario: Navigate to parent folder from nested child folder - 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 "DO_NOT_DELETE/" button When I click the "DO_NOT_DELETE/" button diff --git a/packages/e2e/features/ui/components/storage/storage-browser/search-locations.feature b/packages/e2e/features/ui/components/storage/storage-browser/search-locations.feature index 0858699da8..cd4289967e 100644 --- a/packages/e2e/features/ui/components/storage/storage-browser/search-locations.feature +++ b/packages/e2e/features/ui/components/storage/storage-browser/search-locations.feature @@ -2,12 +2,12 @@ Feature: Search with Storage Browser Background: Given I'm running the example "ui/components/storage/storage-browser/default-auth" + And I type my "email" with status "CONFIRMED" + And I type my password + And I click the "Sign in" button @react Scenario: Search folders and subfolders with matching results - 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 button containing "DoNotDeleteThisFolder_CanDeleteAllChildren" When I see input with placeholder "Search current folder" and type "DO_NOT" @@ -26,9 +26,6 @@ Feature: Search with Storage Browser @react Scenario: Search with no matching results - 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" When I see input with placeholder "Search current folder" and type "XXXXXXXX" Then I click the "Search" button From fe83c0f52808819df27f2424984209966515f85f Mon Sep 17 00:00:00 2001 From: Ashwin Kumar Date: Tue, 7 Jan 2025 18:07:42 -0800 Subject: [PATCH 3/6] fix EOF --- .../ui/components/storage/storage-browser/drag-and-drop.feature | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/e2e/features/ui/components/storage/storage-browser/drag-and-drop.feature b/packages/e2e/features/ui/components/storage/storage-browser/drag-and-drop.feature index 39eb86884c..767a30ecd2 100644 --- a/packages/e2e/features/ui/components/storage/storage-browser/drag-and-drop.feature +++ b/packages/e2e/features/ui/components/storage/storage-browser/drag-and-drop.feature @@ -31,3 +31,4 @@ Feature: Drag and drop files within Storage Browser Then I press the "{esc}" key When I drag and drop a file into the storage browser with file name "test.txt" Then I see "test.txt" + From e7815b275025c551b6c9e696bf3e567edaeb422c Mon Sep 17 00:00:00 2001 From: Ashwin Kumar Date: Tue, 7 Jan 2025 18:10:59 -0800 Subject: [PATCH 4/6] fix EOF --- .../ui/components/storage/storage-browser/drag-and-drop.feature | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/e2e/features/ui/components/storage/storage-browser/drag-and-drop.feature b/packages/e2e/features/ui/components/storage/storage-browser/drag-and-drop.feature index 767a30ecd2..39eb86884c 100644 --- a/packages/e2e/features/ui/components/storage/storage-browser/drag-and-drop.feature +++ b/packages/e2e/features/ui/components/storage/storage-browser/drag-and-drop.feature @@ -31,4 +31,3 @@ Feature: Drag and drop files within Storage Browser Then I press the "{esc}" key When I drag and drop a file into the storage browser with file name "test.txt" Then I see "test.txt" - From 2cb8e455ddf6bfc2a74e9dd56acac36be1fd3faa Mon Sep 17 00:00:00 2001 From: Ashwin Kumar Date: Wed, 8 Jan 2025 13:09:21 -0800 Subject: [PATCH 5/6] Update packages/e2e/cypress/integration/common/shared.ts Co-authored-by: Caleb Pollman --- packages/e2e/cypress/integration/common/shared.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/e2e/cypress/integration/common/shared.ts b/packages/e2e/cypress/integration/common/shared.ts index beb08a579e..6b1f22b963 100644 --- a/packages/e2e/cypress/integration/common/shared.ts +++ b/packages/e2e/cypress/integration/common/shared.ts @@ -656,7 +656,7 @@ When( cy.fileInputUpload(`${folderName}/${randomFileName}`, parseInt(count)) ); -When('I simulate network disconnection', () => { +When('A network failure occurs', () => { cy.intercept('', (req) => { req.destroy(); }); From fd6ba66eee0a20276cc6864fceb312b2fd400da5 Mon Sep 17 00:00:00 2001 From: Ashwin Kumar Date: Wed, 8 Jan 2025 13:16:22 -0800 Subject: [PATCH 6/6] address feedback --- .../storage/storage-browser/action-menu.feature | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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 5c418a2a0d..e2e4f2dcd3 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 @@ -130,14 +130,14 @@ Feature: Create folder with Storage Browser Then I see the "Upload" menuitem When I click the "Upload" menuitem Then I upload "1" files with random names - When I simulate network disconnection + When A network failure occurs Then 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 see the first button containing "public" - When I simulate network disconnection + When A network failure occurs Then I click the first button containing "public" Then I see "Network Error" @@ -150,7 +150,7 @@ Feature: Create folder with Storage Browser When I click the "Create Folder" menuitem Then I see "Folder name" Then I type a new "Folder name" with random value - When I simulate network disconnection + When A network failure occurs Then I click the "Create Folder" button Then I see "There was an issue creating the folder" @@ -161,7 +161,7 @@ Feature: Create folder with Storage Browser When I click the "Menu Toggle" button When I click the "Copy" menuitem Then I click the "DoNotDeleteThisFolder_CanDeleteAllChildren/" button - When I simulate network disconnection + When A network failure occurs Then I click the "Copy" button Then I see "All files failed to copy" @@ -171,6 +171,6 @@ Feature: Create folder with Storage Browser Then I click checkbox for file "001_dont_delete_file.txt" When I click the "Menu Toggle" button Then I click the "Delete" menuitem - When I simulate network disconnection + When A network failure occurs Then I click the "Delete" button Then I see "All files failed to delete"