From f63a6755c8b3f9393e1e1f57f14c3d622eb4e0ee Mon Sep 17 00:00:00 2001 From: timngyn Date: Thu, 22 Aug 2024 22:48:46 -0700 Subject: [PATCH 01/24] chore(storage-browser): set up e2e tests for storage browser --- packages/e2e/.gitignore | 1 + .../integration/common/storage-browser.ts | 14 ++++++++++ .../render-storage-browser.feature | 28 +++++++++++++++++++ 3 files changed, 43 insertions(+) create mode 100644 packages/e2e/cypress/integration/common/storage-browser.ts create mode 100644 packages/e2e/features/ui/components/storage/storage-browser/render-storage-browser.feature diff --git a/packages/e2e/.gitignore b/packages/e2e/.gitignore index f024081e4ca..895c36bac02 100644 --- a/packages/e2e/.gitignore +++ b/packages/e2e/.gitignore @@ -2,6 +2,7 @@ cypress/fixtures/example.json cypress/screenshots cypress/videos +cypress/downloads detox/screenshots diff --git a/packages/e2e/cypress/integration/common/storage-browser.ts b/packages/e2e/cypress/integration/common/storage-browser.ts new file mode 100644 index 00000000000..c8f6a3f055b --- /dev/null +++ b/packages/e2e/cypress/integration/common/storage-browser.ts @@ -0,0 +1,14 @@ +import { Then, When } from '@badeball/cypress-cucumber-preprocessor'; + +Then( + 'I verify the downloaded file {string} has the contents {string}', + (fileName: string, fileContent: string) => { + const downloadsFolder = Cypress.config('downloadsFolder'); + + const filePath = `cypress/downloads/${fileName}`; + + cy.readFile(filePath, { timeout: 5000 }).then((content) => { + expect(content).to.include(fileContent); + }); + } +); diff --git a/packages/e2e/features/ui/components/storage/storage-browser/render-storage-browser.feature b/packages/e2e/features/ui/components/storage/storage-browser/render-storage-browser.feature new file mode 100644 index 00000000000..28c1bb125c3 --- /dev/null +++ b/packages/e2e/features/ui/components/storage/storage-browser/render-storage-browser.feature @@ -0,0 +1,28 @@ +Feature: Storage Browser with default environment + + Background: + Given I'm running the example "ui/components/storage/storage-browser/default-auth" + + @react + Scenario: Renders storage browser after login + When I type my "email" with status "CONFIRMED" + Then I type my password + Then I click the "Sign in" button + Then I see the "Sign Out" button + Then I see "Home" + Then I see the "s3://fileuploaderbucket121216-dev/public/*" button + + + @react + Scenario: Download file "test.txt" + When I type my "email" with status "CONFIRMED" + Then I type my password + Then I click the "Sign in" button + Then I see the "Sign Out" button + Then I see "Home" + Then I see the "s3://fileuploaderbucket121216-dev/public/*" button + Then I click the "s3://fileuploaderbucket121216-dev/public/*" button + Then I see "test.txt" + Then I click the "Download public/test.txt" button + Then I verify the downloaded file "test.txt" has the contents "file contents" + \ No newline at end of file From d712b0a6ed2e9438bfba99cd924f83a701bd2285 Mon Sep 17 00:00:00 2001 From: timngyn Date: Thu, 22 Aug 2024 22:58:16 -0700 Subject: [PATCH 02/24] remove unused variable --- packages/e2e/cypress/integration/common/storage-browser.ts | 2 -- .../storage/storage-browser/render-storage-browser.feature | 1 - 2 files changed, 3 deletions(-) diff --git a/packages/e2e/cypress/integration/common/storage-browser.ts b/packages/e2e/cypress/integration/common/storage-browser.ts index c8f6a3f055b..4c341d97746 100644 --- a/packages/e2e/cypress/integration/common/storage-browser.ts +++ b/packages/e2e/cypress/integration/common/storage-browser.ts @@ -3,8 +3,6 @@ import { Then, When } from '@badeball/cypress-cucumber-preprocessor'; Then( 'I verify the downloaded file {string} has the contents {string}', (fileName: string, fileContent: string) => { - const downloadsFolder = Cypress.config('downloadsFolder'); - const filePath = `cypress/downloads/${fileName}`; cy.readFile(filePath, { timeout: 5000 }).then((content) => { diff --git a/packages/e2e/features/ui/components/storage/storage-browser/render-storage-browser.feature b/packages/e2e/features/ui/components/storage/storage-browser/render-storage-browser.feature index 28c1bb125c3..7907945105c 100644 --- a/packages/e2e/features/ui/components/storage/storage-browser/render-storage-browser.feature +++ b/packages/e2e/features/ui/components/storage/storage-browser/render-storage-browser.feature @@ -12,7 +12,6 @@ Feature: Storage Browser with default environment Then I see "Home" Then I see the "s3://fileuploaderbucket121216-dev/public/*" button - @react Scenario: Download file "test.txt" When I type my "email" with status "CONFIRMED" From 1bd1f93a4f800c6defc5a21f2e2173f1b8cafc6f Mon Sep 17 00:00:00 2001 From: timngyn Date: Thu, 22 Aug 2024 23:43:43 -0700 Subject: [PATCH 03/24] remove unused var --- packages/e2e/cypress/integration/common/storage-browser.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/e2e/cypress/integration/common/storage-browser.ts b/packages/e2e/cypress/integration/common/storage-browser.ts index 4c341d97746..d65f047b356 100644 --- a/packages/e2e/cypress/integration/common/storage-browser.ts +++ b/packages/e2e/cypress/integration/common/storage-browser.ts @@ -1,4 +1,4 @@ -import { Then, When } from '@badeball/cypress-cucumber-preprocessor'; +import { Then } from '@badeball/cypress-cucumber-preprocessor'; Then( 'I verify the downloaded file {string} has the contents {string}', From 83fdc3b27d1d535fd264fe15189402b638eca700 Mon Sep 17 00:00:00 2001 From: timngyn Date: Tue, 27 Aug 2024 22:37:53 -0700 Subject: [PATCH 04/24] add e2e tests for create folder --- .../e2e/cypress/integration/common/shared.ts | 16 ++++++++ .../storage-browser/create-folder.feature | 40 +++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 packages/e2e/features/ui/components/storage/storage-browser/create-folder.feature diff --git a/packages/e2e/cypress/integration/common/shared.ts b/packages/e2e/cypress/integration/common/shared.ts index 810dad81a9f..9b399220107 100644 --- a/packages/e2e/cypress/integration/common/shared.ts +++ b/packages/e2e/cypress/integration/common/shared.ts @@ -228,6 +228,10 @@ const typeInInputHandler = (field: string, value: string) => { }; When('I type a new {string} with value {string}', typeInInputHandler); +When('I lose focus on {string} input', (field: string) => { + cy.findInputField(field).blur(); +}); + When('I click the {string} tab', (label: string) => { cy.findByRole('tab', { name: new RegExp(`^${escapeRegExp(label)}$`, 'i'), @@ -256,6 +260,18 @@ Then('I do not see the {string} button', (name: string) => { }).should('not.exist'); }); +When('I click the {string} menuitem', (label: string) => { + cy.findByRole('menuitem', { + name: new RegExp(`^${escapeRegExp(label)}$`, 'i'), + }).click(); +}); + +Then('I see the {string} menuitem', (label: string) => { + cy.findByRole('menuitem', { + name: new RegExp(`^${escapeRegExp(label)}$`, 'i'), + }).should('exist'); +}); + When('I click the {string} checkbox', (label: string) => { cy.findByLabelText(new RegExp(`^${escapeRegExp(label)}`, 'i')).click({ // We have to force this click because the checkbox button isn't visible by default diff --git a/packages/e2e/features/ui/components/storage/storage-browser/create-folder.feature b/packages/e2e/features/ui/components/storage/storage-browser/create-folder.feature new file mode 100644 index 00000000000..c3b44bdf774 --- /dev/null +++ b/packages/e2e/features/ui/components/storage/storage-browser/create-folder.feature @@ -0,0 +1,40 @@ +Feature: Create folder with Storage Browser + + Background: + Given I'm running the example "ui/components/storage/storage-browser/default-auth" + + @react + Scenario: Create 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 "s3://fileuploaderbucket121216-dev/public/*" button + Then I see the "Actions" button + When I click the "Actions" button + Then I see the "Create Folder" menuitem + When I click the "Create Folder" menuitem + Then I see "Enter folder name:" + Then I see the "Create Folder" button + Then the "Create Folder" button is disabled + When I type a new "Enter folder name:" with value "Blackberry" + Then I see the "Create Folder" button + When I click the "Create Folder" button + Then I see "Folder created." + + + @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 "s3://fileuploaderbucket121216-dev/public/*" button + Then I see the "Actions" button + When I click the "Actions" button + Then I see the "Create Folder" menuitem + When I click the "Create Folder" menuitem + Then I see "Enter folder name:" + Then I see the "Create Folder" button + Then the "Create Folder" button is disabled + When I type a new "Enter folder name:" with value "Blackberry/" + When I lose focus on "Enter folder name:" input + Then I see "Folder name must be at least one character and cannot contain a \"/\"." From a93eb9ecb9d7f47e64258b1e5ba0bc1bacc2a27b Mon Sep 17 00:00:00 2001 From: timngyn Date: Tue, 27 Aug 2024 22:38:19 -0700 Subject: [PATCH 05/24] add e2e tests for navigate control --- .../navigate-locations.feature | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 packages/e2e/features/ui/components/storage/storage-browser/navigate-locations.feature 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 new file mode 100644 index 00000000000..66cb79d747a --- /dev/null +++ b/packages/e2e/features/ui/components/storage/storage-browser/navigate-locations.feature @@ -0,0 +1,43 @@ +Feature: Storage Browser navigate breadcrumbs + + Background: + Given I'm running the example "ui/components/storage/storage-browser/default-auth" + + @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 "s3://fileuploaderbucket121216-dev/public/*" button + Then I see the "Home" button + When I click the "Home" button + Then I see "HOME" + Then I see the "s3://fileuploaderbucket121216-dev/public/*" button + + @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 "s3://fileuploaderbucket121216-dev/public/*" button + Then I see the "Blueberry/" button + When I click the "Blueberry/" button + Then I see "Blueberry/" + Then I see "fileuploaderbucket121216-dev/public" + When I click the "fileuploaderbucket121216-dev/public" button + Then I see "public/" + + @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 "s3://fileuploaderbucket121216-dev/public/*" button + Then I see the "Blueberry/" button + When I click the "Blueberry/" button + Then I see the "Acai/" button + When I click the "Acai/" button + Then I see "Acai/" + Then I see the "Blueberry" button + When I click the "Blueberry" button + Then I see "Blueberry/" \ No newline at end of file From 0d80349f297684e972b7d26b331d3aecc226fb02 Mon Sep 17 00:00:00 2001 From: timngyn Date: Tue, 27 Aug 2024 22:39:45 -0700 Subject: [PATCH 06/24] remove render-storage-browser.feature --- .../render-storage-browser.feature | 27 ------------------- 1 file changed, 27 deletions(-) delete mode 100644 packages/e2e/features/ui/components/storage/storage-browser/render-storage-browser.feature diff --git a/packages/e2e/features/ui/components/storage/storage-browser/render-storage-browser.feature b/packages/e2e/features/ui/components/storage/storage-browser/render-storage-browser.feature deleted file mode 100644 index 7907945105c..00000000000 --- a/packages/e2e/features/ui/components/storage/storage-browser/render-storage-browser.feature +++ /dev/null @@ -1,27 +0,0 @@ -Feature: Storage Browser with default environment - - Background: - Given I'm running the example "ui/components/storage/storage-browser/default-auth" - - @react - Scenario: Renders storage browser after login - When I type my "email" with status "CONFIRMED" - Then I type my password - Then I click the "Sign in" button - Then I see the "Sign Out" button - Then I see "Home" - Then I see the "s3://fileuploaderbucket121216-dev/public/*" button - - @react - Scenario: Download file "test.txt" - When I type my "email" with status "CONFIRMED" - Then I type my password - Then I click the "Sign in" button - Then I see the "Sign Out" button - Then I see "Home" - Then I see the "s3://fileuploaderbucket121216-dev/public/*" button - Then I click the "s3://fileuploaderbucket121216-dev/public/*" button - Then I see "test.txt" - Then I click the "Download public/test.txt" button - Then I verify the downloaded file "test.txt" has the contents "file contents" - \ No newline at end of file From 5c4bceef2662849dbceda2b3f3bebe64de05c04c Mon Sep 17 00:00:00 2001 From: timngyn Date: Tue, 27 Aug 2024 22:45:37 -0700 Subject: [PATCH 07/24] add e2e tests for download file --- .../storage-browser/download-file.feature | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 packages/e2e/features/ui/components/storage/storage-browser/download-file.feature diff --git a/packages/e2e/features/ui/components/storage/storage-browser/download-file.feature b/packages/e2e/features/ui/components/storage/storage-browser/download-file.feature new file mode 100644 index 00000000000..9f56d28e179 --- /dev/null +++ b/packages/e2e/features/ui/components/storage/storage-browser/download-file.feature @@ -0,0 +1,18 @@ +Feature: Download file with storage browser + + Background: + Given I'm running the example "ui/components/storage/storage-browser/default-auth" + + @react + Scenario: Download file "test.txt" + When I type my "email" with status "CONFIRMED" + Then I type my password + Then I click the "Sign in" button + Then I see the "Sign Out" button + Then I see "Home" + Then I see the "s3://fileuploaderbucket121216-dev/public/*" button + Then I click the "s3://fileuploaderbucket121216-dev/public/*" button + Then I see "test.txt" + Then I click the "Download public/test.txt" button + Then I verify the downloaded file "test.txt" has the contents "file contents" + \ No newline at end of file From e5832311b5c6f21cbb4eb0cabf82040bb5cde55b Mon Sep 17 00:00:00 2001 From: Jordan Van Ness Date: Tue, 3 Sep 2024 10:22:41 -0700 Subject: [PATCH 08/24] chore: add tests for 403 response and error boundary to forbidden actions --- .../e2e/cypress/integration/common/shared.ts | 14 ++++++++ .../storage-browser/error-boundary.feature | 33 +++++++++++++++++++ .../insufficient-permissions.feature | 33 +++++++++++++++++++ 3 files changed, 80 insertions(+) create mode 100644 packages/e2e/features/ui/components/storage/storage-browser/error-boundary.feature create mode 100644 packages/e2e/features/ui/components/storage/storage-browser/insufficient-permissions.feature diff --git a/packages/e2e/cypress/integration/common/shared.ts b/packages/e2e/cypress/integration/common/shared.ts index 9b399220107..0822fcda097 100644 --- a/packages/e2e/cypress/integration/common/shared.ts +++ b/packages/e2e/cypress/integration/common/shared.ts @@ -124,6 +124,20 @@ Given('I confirm request {string}', (json: string) => { }); }); +When( + 'I make a {string} request to {string} it returns a status code of {string}', + (method: string, url: string, statusCode: string) => { + cy.request({ + method, + url, + followRedirect: true, + failOnStatusCode: false, + }).then(({ status }) => { + expect(status).to.be.equal(+statusCode); + }); + } +); + Given( 'I intercept {string} with fixture {string} and add header {string} with value {string}', (json: string, fixture: string, headerName: string, headerValue: string) => { diff --git a/packages/e2e/features/ui/components/storage/storage-browser/error-boundary.feature b/packages/e2e/features/ui/components/storage/storage-browser/error-boundary.feature new file mode 100644 index 00000000000..dc2dcf765b9 --- /dev/null +++ b/packages/e2e/features/ui/components/storage/storage-browser/error-boundary.feature @@ -0,0 +1,33 @@ +Feature: Storage Browser uses error boundry + + Background: + Given I'm running the example "ui/components/storage/storage-browser/default-auth" + + @react + Scenario: Attempt to access forbidden folder + When I type my "email" with status "CONFIRMED" + Then I type my password + Then I see the "Sign in" button + When I click the "Sign in" button + When I click the "s3://fileuploaderbucket121216-dev/forbidden/*" button + Then I see "no identity-based policy allows the s3:ListBucket action" + + + @react + Scenario: Attempt to add folder without write access + When I type my "email" with status "CONFIRMED" + Then I type my password + Then I see the "Sign in" button + When I click the "Sign in" button + When I click the "s3://fileuploaderbucket121216-dev/forbidden/*" button + Then I see the "Actions" button + When I click the "Actions" button + Then I see the "Create Folder" menuitem + When I click the "Create Folder" menuitem + Then I see "Enter folder name:" + Then I see the "Create Folder" button + Then the "Create Folder" button is disabled + When I type a new "Enter folder name:" with value "Blackberry" + Then I see the "Create Folder" button + When I click the "Create Folder" button + Then I see "no identity-based policy allows the s3:PutObject action" \ No newline at end of file diff --git a/packages/e2e/features/ui/components/storage/storage-browser/insufficient-permissions.feature b/packages/e2e/features/ui/components/storage/storage-browser/insufficient-permissions.feature new file mode 100644 index 00000000000..e7208ebbf36 --- /dev/null +++ b/packages/e2e/features/ui/components/storage/storage-browser/insufficient-permissions.feature @@ -0,0 +1,33 @@ +Feature: Storage Browser denied access without sufficient permissions + + Background: + Given I'm running the example "ui/components/storage/storage-browser/default-auth" + + @react + Scenario: Attempt to access forbidden folder + When I type my "email" with status "CONFIRMED" + Then I type my password + Then I see the "Sign in" button + When I click the "Sign in" button + When I click the "s3://fileuploaderbucket121216-dev/forbidden/*" button + When I make a "GET" request to "https://fileuploaderbucket121216-dev.s3.us-east-2.amazonaws.com/?list-type=2&delimiter=%2F&max-keys=1000&prefix=forbidden%2F" it returns a status code of "403" + + + @react + Scenario: Attempt to add folder without write access + When I type my "email" with status "CONFIRMED" + Then I type my password + Then I see the "Sign in" button + When I click the "Sign in" button + When I click the "s3://fileuploaderbucket121216-dev/forbidden/*" button + Then I see the "Actions" button + When I click the "Actions" button + Then I see the "Create Folder" menuitem + When I click the "Create Folder" menuitem + Then I see "Enter folder name:" + Then I see the "Create Folder" button + Then the "Create Folder" button is disabled + When I type a new "Enter folder name:" with value "Blackberry" + Then I see the "Create Folder" button + When I click the "Create Folder" button + When I make a "POST" request to "https://fileuploaderbucket121216-dev.s3.us-east-2.amazonaws.com/forbidden/Blackberry/?uploads" it returns a status code of "403" \ No newline at end of file From 143cc0805970eb8db890c58123c5f0dd63dadd19 Mon Sep 17 00:00:00 2001 From: Jordan Van Ness Date: Tue, 3 Sep 2024 12:46:05 -0700 Subject: [PATCH 09/24] chore: making more generic references to button contents --- packages/e2e/cypress/integration/common/shared.ts | 12 ++++++++++++ .../storage/storage-browser/create-folder.feature | 4 ++-- .../storage/storage-browser/download-file.feature | 3 +-- .../storage-browser/error-boundary.feature | 4 ++-- .../insufficient-permissions.feature | 4 ++-- .../storage-browser/navigate-locations.feature | 15 ++++++++------- 6 files changed, 27 insertions(+), 15 deletions(-) diff --git a/packages/e2e/cypress/integration/common/shared.ts b/packages/e2e/cypress/integration/common/shared.ts index 0822fcda097..1ea8c557aa4 100644 --- a/packages/e2e/cypress/integration/common/shared.ts +++ b/packages/e2e/cypress/integration/common/shared.ts @@ -262,6 +262,18 @@ When('I click the {string} button', (name: string) => { }).click(); }); +When('I click the button containing {string}', (name: string) => { + cy.findByRole('button', { + name: new RegExp(`${escapeRegExp(name)}`, 'i'), + }).click(); +}); + +Then('I see the button containing {string}', (name: string) => { + cy.findByRole('button', { + name: new RegExp(`${escapeRegExp(name)}`, 'i'), + }).should('exist'); +}); + Then('I see the {string} button', (name: string) => { cy.findByRole('button', { name: new RegExp(`^${escapeRegExp(name)}$`, 'i'), diff --git a/packages/e2e/features/ui/components/storage/storage-browser/create-folder.feature b/packages/e2e/features/ui/components/storage/storage-browser/create-folder.feature index c3b44bdf774..575e666aa0e 100644 --- a/packages/e2e/features/ui/components/storage/storage-browser/create-folder.feature +++ b/packages/e2e/features/ui/components/storage/storage-browser/create-folder.feature @@ -8,7 +8,7 @@ Feature: Create folder with Storage Browser When I type my "email" with status "CONFIRMED" Then I type my password Then I click the "Sign in" button - When I click the "s3://fileuploaderbucket121216-dev/public/*" button + When I click the button containing "public" Then I see the "Actions" button When I click the "Actions" button Then I see the "Create Folder" menuitem @@ -27,7 +27,7 @@ Feature: Create folder with Storage Browser When I type my "email" with status "CONFIRMED" Then I type my password Then I click the "Sign in" button - When I click the "s3://fileuploaderbucket121216-dev/public/*" button + When I click the button containing "public" Then I see the "Actions" button When I click the "Actions" button Then I see the "Create Folder" menuitem diff --git a/packages/e2e/features/ui/components/storage/storage-browser/download-file.feature b/packages/e2e/features/ui/components/storage/storage-browser/download-file.feature index 9f56d28e179..1c71861d1e9 100644 --- a/packages/e2e/features/ui/components/storage/storage-browser/download-file.feature +++ b/packages/e2e/features/ui/components/storage/storage-browser/download-file.feature @@ -10,8 +10,7 @@ Feature: Download file with storage browser Then I click the "Sign in" button Then I see the "Sign Out" button Then I see "Home" - Then I see the "s3://fileuploaderbucket121216-dev/public/*" button - Then I click the "s3://fileuploaderbucket121216-dev/public/*" button + Then I click the button containing "public" Then I see "test.txt" Then I click the "Download public/test.txt" button Then I verify the downloaded file "test.txt" has the contents "file contents" diff --git a/packages/e2e/features/ui/components/storage/storage-browser/error-boundary.feature b/packages/e2e/features/ui/components/storage/storage-browser/error-boundary.feature index dc2dcf765b9..4dadc8076aa 100644 --- a/packages/e2e/features/ui/components/storage/storage-browser/error-boundary.feature +++ b/packages/e2e/features/ui/components/storage/storage-browser/error-boundary.feature @@ -9,7 +9,7 @@ Feature: Storage Browser uses error boundry Then I type my password Then I see the "Sign in" button When I click the "Sign in" button - When I click the "s3://fileuploaderbucket121216-dev/forbidden/*" button + When I click the button containing "forbidden" Then I see "no identity-based policy allows the s3:ListBucket action" @@ -19,7 +19,7 @@ Feature: Storage Browser uses error boundry Then I type my password Then I see the "Sign in" button When I click the "Sign in" button - When I click the "s3://fileuploaderbucket121216-dev/forbidden/*" button + When I click the button containing "forbidden" Then I see the "Actions" button When I click the "Actions" button Then I see the "Create Folder" menuitem diff --git a/packages/e2e/features/ui/components/storage/storage-browser/insufficient-permissions.feature b/packages/e2e/features/ui/components/storage/storage-browser/insufficient-permissions.feature index e7208ebbf36..2e1881aa024 100644 --- a/packages/e2e/features/ui/components/storage/storage-browser/insufficient-permissions.feature +++ b/packages/e2e/features/ui/components/storage/storage-browser/insufficient-permissions.feature @@ -9,7 +9,7 @@ Feature: Storage Browser denied access without sufficient permissions Then I type my password Then I see the "Sign in" button When I click the "Sign in" button - When I click the "s3://fileuploaderbucket121216-dev/forbidden/*" button + When I click the button containing "forbidden" When I make a "GET" request to "https://fileuploaderbucket121216-dev.s3.us-east-2.amazonaws.com/?list-type=2&delimiter=%2F&max-keys=1000&prefix=forbidden%2F" it returns a status code of "403" @@ -19,7 +19,7 @@ Feature: Storage Browser denied access without sufficient permissions Then I type my password Then I see the "Sign in" button When I click the "Sign in" button - When I click the "s3://fileuploaderbucket121216-dev/forbidden/*" button + When I click the button containing "forbidden" Then I see the "Actions" button When I click the "Actions" button Then I see the "Create Folder" menuitem 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 66cb79d747a..069bb99b239 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 @@ -8,31 +8,32 @@ Feature: Storage Browser navigate breadcrumbs When I type my "email" with status "CONFIRMED" Then I type my password Then I click the "Sign in" button - When I click the "s3://fileuploaderbucket121216-dev/public/*" button + When I click the button containing "public" Then I see the "Home" button When I click the "Home" button Then I see "HOME" - Then I see the "s3://fileuploaderbucket121216-dev/public/*" button + Then I see the button containing "public" @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 "s3://fileuploaderbucket121216-dev/public/*" button + When I click the button containing "public" Then I see the "Blueberry/" button When I click the "Blueberry/" button + Then I see "Blackberry/" + When I click the "Blackberry/" button + Then I see "Blueberry/" + When I click the "Blueberry" button Then I see "Blueberry/" - Then I see "fileuploaderbucket121216-dev/public" - When I click the "fileuploaderbucket121216-dev/public" button - Then I see "public/" @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 "s3://fileuploaderbucket121216-dev/public/*" button + When I click the button containing "public" Then I see the "Blueberry/" button When I click the "Blueberry/" button Then I see the "Acai/" button From 050ea17f435cab68066c38d158a3afa66ed15822 Mon Sep 17 00:00:00 2001 From: Jordan Van Ness Date: Tue, 3 Sep 2024 12:48:51 -0700 Subject: [PATCH 10/24] chore: temporarily removing status code validation prior to cleaner approach --- .../storage/storage-browser/insufficient-permissions.feature | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/e2e/features/ui/components/storage/storage-browser/insufficient-permissions.feature b/packages/e2e/features/ui/components/storage/storage-browser/insufficient-permissions.feature index 2e1881aa024..69c2bdb4a1c 100644 --- a/packages/e2e/features/ui/components/storage/storage-browser/insufficient-permissions.feature +++ b/packages/e2e/features/ui/components/storage/storage-browser/insufficient-permissions.feature @@ -10,7 +10,6 @@ Feature: Storage Browser denied access without sufficient permissions Then I see the "Sign in" button When I click the "Sign in" button When I click the button containing "forbidden" - When I make a "GET" request to "https://fileuploaderbucket121216-dev.s3.us-east-2.amazonaws.com/?list-type=2&delimiter=%2F&max-keys=1000&prefix=forbidden%2F" it returns a status code of "403" @react @@ -29,5 +28,4 @@ Feature: Storage Browser denied access without sufficient permissions Then the "Create Folder" button is disabled When I type a new "Enter folder name:" with value "Blackberry" Then I see the "Create Folder" button - When I click the "Create Folder" button - When I make a "POST" request to "https://fileuploaderbucket121216-dev.s3.us-east-2.amazonaws.com/forbidden/Blackberry/?uploads" it returns a status code of "403" \ No newline at end of file + When I click the "Create Folder" button \ No newline at end of file From 7c0287efea7a6d7b4695094019b00741dcb2c930 Mon Sep 17 00:00:00 2001 From: Jordan Van Ness Date: Tue, 3 Sep 2024 14:21:37 -0700 Subject: [PATCH 11/24] chore: restoring resolution to unauthed tests with cleaner solution --- .../e2e/cypress/integration/common/shared.ts | 20 ++++++------------- .../insufficient-permissions.feature | 5 +++-- 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/packages/e2e/cypress/integration/common/shared.ts b/packages/e2e/cypress/integration/common/shared.ts index 1ea8c557aa4..38cdc991e9d 100644 --- a/packages/e2e/cypress/integration/common/shared.ts +++ b/packages/e2e/cypress/integration/common/shared.ts @@ -124,20 +124,6 @@ Given('I confirm request {string}', (json: string) => { }); }); -When( - 'I make a {string} request to {string} it returns a status code of {string}', - (method: string, url: string, statusCode: string) => { - cy.request({ - method, - url, - followRedirect: true, - failOnStatusCode: false, - }).then(({ status }) => { - expect(status).to.be.equal(+statusCode); - }); - } -); - Given( 'I intercept {string} with fixture {string} and add header {string} with value {string}', (json: string, fixture: string, headerName: string, headerValue: string) => { @@ -328,6 +314,12 @@ Then('I see {string}', (message: string) => { .should('exist'); }); +Then('I do not see {string}', (message: string) => { + cy.findByRole('document') + .contains(new RegExp(escapeRegExp(message), 'i')) + .should('not.exist'); +}); + Then('I see {string} element', (id: string) => { cy.findByTestId(id).should('exist'); }); diff --git a/packages/e2e/features/ui/components/storage/storage-browser/insufficient-permissions.feature b/packages/e2e/features/ui/components/storage/storage-browser/insufficient-permissions.feature index 69c2bdb4a1c..f1541beea3c 100644 --- a/packages/e2e/features/ui/components/storage/storage-browser/insufficient-permissions.feature +++ b/packages/e2e/features/ui/components/storage/storage-browser/insufficient-permissions.feature @@ -10,7 +10,7 @@ Feature: Storage Browser denied access without sufficient permissions Then I see the "Sign in" button When I click the "Sign in" button When I click the button containing "forbidden" - + Then I don't see "amplify-table" @react Scenario: Attempt to add folder without write access @@ -28,4 +28,5 @@ Feature: Storage Browser denied access without sufficient permissions Then the "Create Folder" button is disabled When I type a new "Enter folder name:" with value "Blackberry" Then I see the "Create Folder" button - When I click the "Create Folder" button \ No newline at end of file + When I click the "Create Folder" button + Then I do not see "Folder created." \ No newline at end of file From 18c3d4cb0e7179a96e7ed224223aa4d55e41e193 Mon Sep 17 00:00:00 2001 From: Jordan Van Ness Date: Tue, 3 Sep 2024 15:04:55 -0700 Subject: [PATCH 12/24] chore: removing file download test for now to ensure passing pipeline in first set of tests --- .../integration/common/storage-browser.ts | 12 ------------ .../storage-browser/download-file.feature | 17 ----------------- 2 files changed, 29 deletions(-) delete mode 100644 packages/e2e/cypress/integration/common/storage-browser.ts delete mode 100644 packages/e2e/features/ui/components/storage/storage-browser/download-file.feature diff --git a/packages/e2e/cypress/integration/common/storage-browser.ts b/packages/e2e/cypress/integration/common/storage-browser.ts deleted file mode 100644 index d65f047b356..00000000000 --- a/packages/e2e/cypress/integration/common/storage-browser.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { Then } from '@badeball/cypress-cucumber-preprocessor'; - -Then( - 'I verify the downloaded file {string} has the contents {string}', - (fileName: string, fileContent: string) => { - const filePath = `cypress/downloads/${fileName}`; - - cy.readFile(filePath, { timeout: 5000 }).then((content) => { - expect(content).to.include(fileContent); - }); - } -); diff --git a/packages/e2e/features/ui/components/storage/storage-browser/download-file.feature b/packages/e2e/features/ui/components/storage/storage-browser/download-file.feature deleted file mode 100644 index 1c71861d1e9..00000000000 --- a/packages/e2e/features/ui/components/storage/storage-browser/download-file.feature +++ /dev/null @@ -1,17 +0,0 @@ -Feature: Download file with storage browser - - Background: - Given I'm running the example "ui/components/storage/storage-browser/default-auth" - - @react - Scenario: Download file "test.txt" - When I type my "email" with status "CONFIRMED" - Then I type my password - Then I click the "Sign in" button - Then I see the "Sign Out" button - Then I see "Home" - Then I click the button containing "public" - Then I see "test.txt" - Then I click the "Download public/test.txt" button - Then I verify the downloaded file "test.txt" has the contents "file contents" - \ No newline at end of file From f4daeb205cae0504af0a7f73746ef307414095b7 Mon Sep 17 00:00:00 2001 From: Jordan Van Ness Date: Wed, 4 Sep 2024 08:08:17 -0700 Subject: [PATCH 13/24] chore: add newline charactersd --- .../components/storage/storage-browser/error-boundary.feature | 2 +- .../storage/storage-browser/insufficient-permissions.feature | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/e2e/features/ui/components/storage/storage-browser/error-boundary.feature b/packages/e2e/features/ui/components/storage/storage-browser/error-boundary.feature index 4dadc8076aa..4b2b49d0007 100644 --- a/packages/e2e/features/ui/components/storage/storage-browser/error-boundary.feature +++ b/packages/e2e/features/ui/components/storage/storage-browser/error-boundary.feature @@ -30,4 +30,4 @@ Feature: Storage Browser uses error boundry When I type a new "Enter folder name:" with value "Blackberry" Then I see the "Create Folder" button When I click the "Create Folder" button - Then I see "no identity-based policy allows the s3:PutObject action" \ No newline at end of file + Then I see "no identity-based policy allows the s3:PutObject action" diff --git a/packages/e2e/features/ui/components/storage/storage-browser/insufficient-permissions.feature b/packages/e2e/features/ui/components/storage/storage-browser/insufficient-permissions.feature index f1541beea3c..4afcc01a634 100644 --- a/packages/e2e/features/ui/components/storage/storage-browser/insufficient-permissions.feature +++ b/packages/e2e/features/ui/components/storage/storage-browser/insufficient-permissions.feature @@ -29,4 +29,4 @@ Feature: Storage Browser denied access without sufficient permissions When I type a new "Enter folder name:" with value "Blackberry" Then I see the "Create Folder" button When I click the "Create Folder" button - Then I do not see "Folder created." \ No newline at end of file + Then I do not see "Folder created." From b72bfef29caba6d5d31e1fde5b7e473d3d29df33 Mon Sep 17 00:00:00 2001 From: Jordan Van Ness Date: Wed, 4 Sep 2024 08:11:26 -0700 Subject: [PATCH 14/24] chore: adding additional newline character --- .../storage/storage-browser/navigate-locations.feature | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 069bb99b239..554a5a36d1a 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 @@ -41,4 +41,4 @@ Feature: Storage Browser navigate breadcrumbs Then I see "Acai/" Then I see the "Blueberry" button When I click the "Blueberry" button - Then I see "Blueberry/" \ No newline at end of file + Then I see "Blueberry/" From 7100d8192d519a89e9086a48a4e0a07330e7e6e8 Mon Sep 17 00:00:00 2001 From: Heather Date: Wed, 4 Sep 2024 16:03:10 -0400 Subject: [PATCH 15/24] loading e2e tests for storage browser --- .../integration/common/storage-browser.ts | 15 +++++++++++++ .../loading.default-auth.feature | 21 +++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 packages/e2e/cypress/integration/common/storage-browser.ts create mode 100644 packages/e2e/features/ui/components/storage/storage-browser/loading.default-auth.feature diff --git a/packages/e2e/cypress/integration/common/storage-browser.ts b/packages/e2e/cypress/integration/common/storage-browser.ts new file mode 100644 index 00000000000..b6af9892be1 --- /dev/null +++ b/packages/e2e/cypress/integration/common/storage-browser.ts @@ -0,0 +1,15 @@ +import { When } from '@badeball/cypress-cucumber-preprocessor'; +import { escapeRegExp } from 'lodash'; + +When('I click the {string} button on a slow network', (name: string) => { + cy.intercept({ method: 'GET' }, (req) => { + alert('intercepted'); + req.on('response', (res) => { + res.setDelay(5000); + }); + }); + + cy.findByRole('button', { + name: new RegExp(`^${escapeRegExp(name)}$`, 'i'), + }).click(); +}); diff --git a/packages/e2e/features/ui/components/storage/storage-browser/loading.default-auth.feature b/packages/e2e/features/ui/components/storage/storage-browser/loading.default-auth.feature new file mode 100644 index 00000000000..090250de1e1 --- /dev/null +++ b/packages/e2e/features/ui/components/storage/storage-browser/loading.default-auth.feature @@ -0,0 +1,21 @@ +Feature: Loading spinner on Storage Browser views + + Background: + Given I'm running the example "ui/components/storage/storage-browser/default-auth" + + @react + Scenario: Loading spinner on LocationDetailView + When I type my "email" with status "CONFIRMED" + Then I type my password + Then I click the "Sign in" button + Then I click the button containing "public" + Then I see "Loading" + + @react + Scenario: Loading spinner on LocationDetailView + When I type my "email" with status "CONFIRMED" + Then I type my password + Then I click the "Sign in" button + Then I click the button containing "public" + Then I click the "Refresh table" button on a slow network + Then I see "Loading" \ No newline at end of file From 9c43991c1d29cc9c78af7cff65213b34476a4131 Mon Sep 17 00:00:00 2001 From: Heather Date: Wed, 4 Sep 2024 16:05:08 -0400 Subject: [PATCH 16/24] new line --- .../storage/storage-browser/loading.default-auth.feature | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/e2e/features/ui/components/storage/storage-browser/loading.default-auth.feature b/packages/e2e/features/ui/components/storage/storage-browser/loading.default-auth.feature index 090250de1e1..e6ed6bdd5df 100644 --- a/packages/e2e/features/ui/components/storage/storage-browser/loading.default-auth.feature +++ b/packages/e2e/features/ui/components/storage/storage-browser/loading.default-auth.feature @@ -18,4 +18,5 @@ Feature: Loading spinner on Storage Browser views Then I click the "Sign in" button Then I click the button containing "public" Then I click the "Refresh table" button on a slow network - Then I see "Loading" \ No newline at end of file + Then I see "Loading" + \ No newline at end of file From c6895702a7a3f1ab882c4763e9b69164c638e5d3 Mon Sep 17 00:00:00 2001 From: Heather Date: Wed, 4 Sep 2024 16:17:10 -0400 Subject: [PATCH 17/24] updates --- .../cypress/integration/common/storage-browser.ts | 3 +-- .../storage-browser/loading.default-auth.feature | 12 ++++++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/packages/e2e/cypress/integration/common/storage-browser.ts b/packages/e2e/cypress/integration/common/storage-browser.ts index b6af9892be1..74f3e524f72 100644 --- a/packages/e2e/cypress/integration/common/storage-browser.ts +++ b/packages/e2e/cypress/integration/common/storage-browser.ts @@ -3,9 +3,8 @@ import { escapeRegExp } from 'lodash'; When('I click the {string} button on a slow network', (name: string) => { cy.intercept({ method: 'GET' }, (req) => { - alert('intercepted'); req.on('response', (res) => { - res.setDelay(5000); + res.setDelay(3000); }); }); diff --git a/packages/e2e/features/ui/components/storage/storage-browser/loading.default-auth.feature b/packages/e2e/features/ui/components/storage/storage-browser/loading.default-auth.feature index e6ed6bdd5df..94c664ac4d1 100644 --- a/packages/e2e/features/ui/components/storage/storage-browser/loading.default-auth.feature +++ b/packages/e2e/features/ui/components/storage/storage-browser/loading.default-auth.feature @@ -3,6 +3,15 @@ Feature: Loading spinner on Storage Browser views Background: Given I'm running the example "ui/components/storage/storage-browser/default-auth" + @react + Scenario: Loading spinner on LocationsView after using the Refresh control + When I type my "email" with status "CONFIRMED" + Then I type my password + Then I click the "Sign in" button + Then I see the "Refresh table" button + Then I click the "Refresh table" button on a slow network + Then I see "Loading" + @react Scenario: Loading spinner on LocationDetailView When I type my "email" with status "CONFIRMED" @@ -12,11 +21,10 @@ Feature: Loading spinner on Storage Browser views Then I see "Loading" @react - Scenario: Loading spinner on LocationDetailView + Scenario: Loading spinner on LocationDetailView after using the Refresh control When I type my "email" with status "CONFIRMED" Then I type my password Then I click the "Sign in" button Then I click the button containing "public" Then I click the "Refresh table" button on a slow network Then I see "Loading" - \ No newline at end of file From 36aa6cc6482b338ef368f55ff8d75d899809709b Mon Sep 17 00:00:00 2001 From: Heather Date: Thu, 5 Sep 2024 12:58:02 -0400 Subject: [PATCH 18/24] updates --- .../cypress/integration/common/storage-browser.ts | 3 ++- .../storage-browser/loading.default-auth.feature | 11 ++++------- .../storage-browser/loading.managed-auth.feature | 12 ++++++++++++ 3 files changed, 18 insertions(+), 8 deletions(-) create mode 100644 packages/e2e/features/ui/components/storage/storage-browser/loading.managed-auth.feature diff --git a/packages/e2e/cypress/integration/common/storage-browser.ts b/packages/e2e/cypress/integration/common/storage-browser.ts index 74f3e524f72..e57fb0e5731 100644 --- a/packages/e2e/cypress/integration/common/storage-browser.ts +++ b/packages/e2e/cypress/integration/common/storage-browser.ts @@ -2,7 +2,8 @@ import { When } from '@badeball/cypress-cucumber-preprocessor'; import { escapeRegExp } from 'lodash'; When('I click the {string} button on a slow network', (name: string) => { - cy.intercept({ method: 'GET' }, (req) => { + cy.intercept({ method: '' }, (req) => { + console.log('intercepted'); req.on('response', (res) => { res.setDelay(3000); }); diff --git a/packages/e2e/features/ui/components/storage/storage-browser/loading.default-auth.feature b/packages/e2e/features/ui/components/storage/storage-browser/loading.default-auth.feature index 94c664ac4d1..b1c211d238f 100644 --- a/packages/e2e/features/ui/components/storage/storage-browser/loading.default-auth.feature +++ b/packages/e2e/features/ui/components/storage/storage-browser/loading.default-auth.feature @@ -1,16 +1,13 @@ -Feature: Loading spinner on Storage Browser views +Feature: (Default Auth) Loading spinner on Storage Browser views Background: Given I'm running the example "ui/components/storage/storage-browser/default-auth" + @react + Scenario: Loading spinner on LocationsView + @react Scenario: Loading spinner on LocationsView after using the Refresh control - When I type my "email" with status "CONFIRMED" - Then I type my password - Then I click the "Sign in" button - Then I see the "Refresh table" button - Then I click the "Refresh table" button on a slow network - Then I see "Loading" @react Scenario: Loading spinner on LocationDetailView diff --git a/packages/e2e/features/ui/components/storage/storage-browser/loading.managed-auth.feature b/packages/e2e/features/ui/components/storage/storage-browser/loading.managed-auth.feature new file mode 100644 index 00000000000..17c0febbc8e --- /dev/null +++ b/packages/e2e/features/ui/components/storage/storage-browser/loading.managed-auth.feature @@ -0,0 +1,12 @@ +Feature: (Managed Auth) Loading spinner on Storage Browser views + + Background: + Given I'm running the example "ui/components/storage/storage-browser/managed-auth" + + @react + Scenario: Loading spinner on LocationDetailView + + + @react + Scenario: Loading spinner on LocationDetailView after using the Refresh control + From 6768e01181b5ae5c024493f75d3ad2809e4526c1 Mon Sep 17 00:00:00 2001 From: Heather Date: Thu, 5 Sep 2024 13:22:30 -0400 Subject: [PATCH 19/24] test --- .../e2e/cypress/integration/common/loading.ts | 34 +++++++++++++++++++ .../integration/common/storage-browser.ts | 15 -------- .../loading.default-auth.feature | 2 +- 3 files changed, 35 insertions(+), 16 deletions(-) create mode 100644 packages/e2e/cypress/integration/common/loading.ts delete mode 100644 packages/e2e/cypress/integration/common/storage-browser.ts diff --git a/packages/e2e/cypress/integration/common/loading.ts b/packages/e2e/cypress/integration/common/loading.ts new file mode 100644 index 00000000000..fe5f9041ce3 --- /dev/null +++ b/packages/e2e/cypress/integration/common/loading.ts @@ -0,0 +1,34 @@ +import { Before, Given, When } from '@badeball/cypress-cucumber-preprocessor'; +import { escapeRegExp } from 'lodash'; + +let language = 'en-US'; + +Given( + "I'm running the StorageBrowser example {string} on a slow connection", + (example: string) => { + beforeEach(() => { + cy.intercept({ method: '' }, (req) => { + console.log('intercepted'); + req.on('response', (res) => { + res.setDelay(3000); + }); + }); + }); + + cy.visit(example, { + // See: https://glebbahmutov.com/blog/cypress-tips-and-tricks/#control-navigatorlanguage + onBeforeLoad(win) { + Object.defineProperty(win.navigator, 'language', { value: language }); + }, + onLoad(contentWindow) { + window = contentWindow; + }, + }); + } +); + +// When('I click the {string} button on a slow network', (name: string) => { +// cy.findByRole('button', { +// name: new RegExp(`^${escapeRegExp(name)}$`, 'i'), +// }).click(); +// }); diff --git a/packages/e2e/cypress/integration/common/storage-browser.ts b/packages/e2e/cypress/integration/common/storage-browser.ts deleted file mode 100644 index e57fb0e5731..00000000000 --- a/packages/e2e/cypress/integration/common/storage-browser.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { When } from '@badeball/cypress-cucumber-preprocessor'; -import { escapeRegExp } from 'lodash'; - -When('I click the {string} button on a slow network', (name: string) => { - cy.intercept({ method: '' }, (req) => { - console.log('intercepted'); - req.on('response', (res) => { - res.setDelay(3000); - }); - }); - - cy.findByRole('button', { - name: new RegExp(`^${escapeRegExp(name)}$`, 'i'), - }).click(); -}); diff --git a/packages/e2e/features/ui/components/storage/storage-browser/loading.default-auth.feature b/packages/e2e/features/ui/components/storage/storage-browser/loading.default-auth.feature index b1c211d238f..c373ab5216b 100644 --- a/packages/e2e/features/ui/components/storage/storage-browser/loading.default-auth.feature +++ b/packages/e2e/features/ui/components/storage/storage-browser/loading.default-auth.feature @@ -1,7 +1,7 @@ Feature: (Default Auth) Loading spinner on Storage Browser views Background: - Given I'm running the example "ui/components/storage/storage-browser/default-auth" + Given I'm running the StorageBrowser example "ui/components/storage/storage-browser/default-auth" on a slow connection @react Scenario: Loading spinner on LocationsView From b9c140b91f78fddd42b6c9a029c5ac0876753f51 Mon Sep 17 00:00:00 2001 From: Heather Date: Thu, 5 Sep 2024 14:50:36 -0400 Subject: [PATCH 20/24] use step file --- .../e2e/cypress/integration/common/loading.ts | 34 ------------------- .../loading.default-auth.steps.ts | 26 ++++++++++++++ .../loading.default-auth.feature | 10 ++---- 3 files changed, 28 insertions(+), 42 deletions(-) delete mode 100644 packages/e2e/cypress/integration/common/loading.ts create mode 100644 packages/e2e/cypress/integration/ui/components/storage/storage-browser/loading.default-auth/loading.default-auth.steps.ts diff --git a/packages/e2e/cypress/integration/common/loading.ts b/packages/e2e/cypress/integration/common/loading.ts deleted file mode 100644 index fe5f9041ce3..00000000000 --- a/packages/e2e/cypress/integration/common/loading.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { Before, Given, When } from '@badeball/cypress-cucumber-preprocessor'; -import { escapeRegExp } from 'lodash'; - -let language = 'en-US'; - -Given( - "I'm running the StorageBrowser example {string} on a slow connection", - (example: string) => { - beforeEach(() => { - cy.intercept({ method: '' }, (req) => { - console.log('intercepted'); - req.on('response', (res) => { - res.setDelay(3000); - }); - }); - }); - - cy.visit(example, { - // See: https://glebbahmutov.com/blog/cypress-tips-and-tricks/#control-navigatorlanguage - onBeforeLoad(win) { - Object.defineProperty(win.navigator, 'language', { value: language }); - }, - onLoad(contentWindow) { - window = contentWindow; - }, - }); - } -); - -// When('I click the {string} button on a slow network', (name: string) => { -// cy.findByRole('button', { -// name: new RegExp(`^${escapeRegExp(name)}$`, 'i'), -// }).click(); -// }); diff --git a/packages/e2e/cypress/integration/ui/components/storage/storage-browser/loading.default-auth/loading.default-auth.steps.ts b/packages/e2e/cypress/integration/ui/components/storage/storage-browser/loading.default-auth/loading.default-auth.steps.ts new file mode 100644 index 00000000000..0ce55947667 --- /dev/null +++ b/packages/e2e/cypress/integration/ui/components/storage/storage-browser/loading.default-auth/loading.default-auth.steps.ts @@ -0,0 +1,26 @@ +import { Before, Given } from '@badeball/cypress-cucumber-preprocessor'; + +let language = 'en-US'; + +Before(() => { + cy.intercept({ method: 'GET', query: { 'list-type': '2' } }, (req) => { + req.on('response', (res) => { + res.setDelay(2000); + }); + }); +}); + +Given( + "I'm running the StorageBrowser example {string} on a slow connection", + (example: string) => { + cy.visit(example, { + // See: https://glebbahmutov.com/blog/cypress-tips-and-tricks/#control-navigatorlanguage + onBeforeLoad(win) { + Object.defineProperty(win.navigator, 'language', { value: language }); + }, + onLoad(contentWindow) { + window = contentWindow; + }, + }); + } +); diff --git a/packages/e2e/features/ui/components/storage/storage-browser/loading.default-auth.feature b/packages/e2e/features/ui/components/storage/storage-browser/loading.default-auth.feature index c373ab5216b..b36dec5051f 100644 --- a/packages/e2e/features/ui/components/storage/storage-browser/loading.default-auth.feature +++ b/packages/e2e/features/ui/components/storage/storage-browser/loading.default-auth.feature @@ -2,13 +2,7 @@ Feature: (Default Auth) Loading spinner on Storage Browser views Background: Given I'm running the StorageBrowser example "ui/components/storage/storage-browser/default-auth" on a slow connection - - @react - Scenario: Loading spinner on LocationsView - - @react - Scenario: Loading spinner on LocationsView after using the Refresh control - + @react Scenario: Loading spinner on LocationDetailView When I type my "email" with status "CONFIRMED" @@ -23,5 +17,5 @@ Feature: (Default Auth) Loading spinner on Storage Browser views Then I type my password Then I click the "Sign in" button Then I click the button containing "public" - Then I click the "Refresh table" button on a slow network + Then I click the "Refresh table" button Then I see "Loading" From 53fa02ccdd63ead23fbd1e536c7a7c7c62f82a86 Mon Sep 17 00:00:00 2001 From: Heather Date: Fri, 6 Sep 2024 11:41:38 -0400 Subject: [PATCH 21/24] increase delay time for ci --- .../loading.default-auth/loading.default-auth.steps.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/e2e/cypress/integration/ui/components/storage/storage-browser/loading.default-auth/loading.default-auth.steps.ts b/packages/e2e/cypress/integration/ui/components/storage/storage-browser/loading.default-auth/loading.default-auth.steps.ts index 0ce55947667..592fb0f6e40 100644 --- a/packages/e2e/cypress/integration/ui/components/storage/storage-browser/loading.default-auth/loading.default-auth.steps.ts +++ b/packages/e2e/cypress/integration/ui/components/storage/storage-browser/loading.default-auth/loading.default-auth.steps.ts @@ -5,7 +5,7 @@ let language = 'en-US'; Before(() => { cy.intercept({ method: 'GET', query: { 'list-type': '2' } }, (req) => { req.on('response', (res) => { - res.setDelay(2000); + res.setDelay(3000); }); }); }); From f082af274fc487c27bc521cac5233652c6027316 Mon Sep 17 00:00:00 2001 From: Heather Date: Fri, 6 Sep 2024 12:10:01 -0400 Subject: [PATCH 22/24] increase delay --- .../loading.default-auth/loading.default-auth.steps.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/e2e/cypress/integration/ui/components/storage/storage-browser/loading.default-auth/loading.default-auth.steps.ts b/packages/e2e/cypress/integration/ui/components/storage/storage-browser/loading.default-auth/loading.default-auth.steps.ts index 592fb0f6e40..5f5e8ea36db 100644 --- a/packages/e2e/cypress/integration/ui/components/storage/storage-browser/loading.default-auth/loading.default-auth.steps.ts +++ b/packages/e2e/cypress/integration/ui/components/storage/storage-browser/loading.default-auth/loading.default-auth.steps.ts @@ -5,7 +5,7 @@ let language = 'en-US'; Before(() => { cy.intercept({ method: 'GET', query: { 'list-type': '2' } }, (req) => { req.on('response', (res) => { - res.setDelay(3000); + res.setDelay(10000); }); }); }); From f0439ebbd256b1bbee22c16d57470cd499292b03 Mon Sep 17 00:00:00 2001 From: Heather Date: Fri, 6 Sep 2024 12:20:06 -0400 Subject: [PATCH 23/24] change when we intercept requests for delay --- .../loading.default-auth.steps.ts | 33 +++++++------------ .../loading.default-auth.feature | 6 ++-- 2 files changed, 15 insertions(+), 24 deletions(-) diff --git a/packages/e2e/cypress/integration/ui/components/storage/storage-browser/loading.default-auth/loading.default-auth.steps.ts b/packages/e2e/cypress/integration/ui/components/storage/storage-browser/loading.default-auth/loading.default-auth.steps.ts index 5f5e8ea36db..a0cef15b7b8 100644 --- a/packages/e2e/cypress/integration/ui/components/storage/storage-browser/loading.default-auth/loading.default-auth.steps.ts +++ b/packages/e2e/cypress/integration/ui/components/storage/storage-browser/loading.default-auth/loading.default-auth.steps.ts @@ -1,26 +1,17 @@ -import { Before, Given } from '@badeball/cypress-cucumber-preprocessor'; +import { When } from '@badeball/cypress-cucumber-preprocessor'; +import { escapeRegExp } from 'lodash'; -let language = 'en-US'; - -Before(() => { - cy.intercept({ method: 'GET', query: { 'list-type': '2' } }, (req) => { - req.on('response', (res) => { - res.setDelay(10000); +When( + 'I click the button containing {string} on a slow connection', + (name: string) => { + cy.intercept({ method: 'GET', query: { 'list-type': '2' } }, (req) => { + req.on('response', (res) => { + res.setDelay(3000); + }); }); - }); -}); -Given( - "I'm running the StorageBrowser example {string} on a slow connection", - (example: string) => { - cy.visit(example, { - // See: https://glebbahmutov.com/blog/cypress-tips-and-tricks/#control-navigatorlanguage - onBeforeLoad(win) { - Object.defineProperty(win.navigator, 'language', { value: language }); - }, - onLoad(contentWindow) { - window = contentWindow; - }, - }); + cy.findByRole('button', { + name: new RegExp(`${escapeRegExp(name)}`, 'i'), + }).click(); } ); diff --git a/packages/e2e/features/ui/components/storage/storage-browser/loading.default-auth.feature b/packages/e2e/features/ui/components/storage/storage-browser/loading.default-auth.feature index b36dec5051f..1e3d069bb5d 100644 --- a/packages/e2e/features/ui/components/storage/storage-browser/loading.default-auth.feature +++ b/packages/e2e/features/ui/components/storage/storage-browser/loading.default-auth.feature @@ -1,14 +1,14 @@ Feature: (Default Auth) Loading spinner on Storage Browser views Background: - Given I'm running the StorageBrowser example "ui/components/storage/storage-browser/default-auth" on a slow connection + Given I'm running the example "ui/components/storage/storage-browser/default-auth" @react Scenario: Loading spinner on LocationDetailView When I type my "email" with status "CONFIRMED" Then I type my password Then I click the "Sign in" button - Then I click the button containing "public" + Then I click the button containing "public" on a slow connection Then I see "Loading" @react @@ -17,5 +17,5 @@ Feature: (Default Auth) Loading spinner on Storage Browser views Then I type my password Then I click the "Sign in" button Then I click the button containing "public" - Then I click the "Refresh table" button + Then I click the button containing "Refresh table" on a slow connection Then I see "Loading" From ba6f2a101a266ef90df426a7754b472cc593c5e5 Mon Sep 17 00:00:00 2001 From: Heather Date: Fri, 6 Sep 2024 12:51:06 -0400 Subject: [PATCH 24/24] increase delay --- .../loading.default-auth/loading.default-auth.steps.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/e2e/cypress/integration/ui/components/storage/storage-browser/loading.default-auth/loading.default-auth.steps.ts b/packages/e2e/cypress/integration/ui/components/storage/storage-browser/loading.default-auth/loading.default-auth.steps.ts index a0cef15b7b8..0cce8a7d2b9 100644 --- a/packages/e2e/cypress/integration/ui/components/storage/storage-browser/loading.default-auth/loading.default-auth.steps.ts +++ b/packages/e2e/cypress/integration/ui/components/storage/storage-browser/loading.default-auth/loading.default-auth.steps.ts @@ -6,7 +6,7 @@ When( (name: string) => { cy.intercept({ method: 'GET', query: { 'list-type': '2' } }, (req) => { req.on('response', (res) => { - res.setDelay(3000); + res.setDelay(5000); }); });