From 747f2a09f7f8ec734ead9c896055b1d0ec9e8c04 Mon Sep 17 00:00:00 2001 From: Vitalii Date: Fri, 13 May 2022 16:09:33 +0300 Subject: [PATCH] testsuite/satellite: updated test for new onboarding cli flow Updated onboarding cli flow go-rod test Change-Id: I72a5e3e8b650434fdd2375d19d79099b9b90dd20 --- testsuite/ui/satellite/onboarding_test.go | 138 ++++++++---------- .../permissions/DurationSelection.vue | 1 + .../steps/cliFlow/PermissionsSelect.vue | 1 + 3 files changed, 64 insertions(+), 76 deletions(-) diff --git a/testsuite/ui/satellite/onboarding_test.go b/testsuite/ui/satellite/onboarding_test.go index 2d60d1c12..949d8d943 100644 --- a/testsuite/ui/satellite/onboarding_test.go +++ b/testsuite/ui/satellite/onboarding_test.go @@ -17,36 +17,15 @@ import ( func TestOnboarding_WizardBrowser(t *testing.T) { uitest.Edge(t, func(t *testing.T, ctx *testcontext.Context, planet *uitest.EdgePlanet, browser *rod.Browser) { - signupPageURL := planet.Satellites[0].ConsoleURL() + "/signup" - fullName := "John Doe" - emailAddress := "test@email.test" - password := "qazwsx123" + page := openPage(browser, planet.Satellites[0].ConsoleURL()) - page := openPage(browser, signupPageURL) - - // first time User signup - page.MustElement("[aria-roledescription=name] input").MustInput(fullName) - page.MustElement("[aria-roledescription=email] input").MustInput(emailAddress) - page.MustElement("[aria-roledescription=password] input").MustInput(password) - page.MustElement("[aria-roledescription=retype-password] input").MustInput(password) - page.MustElement(".checkmark").MustClick() - page.Keyboard.MustPress(input.Enter) - waitVueTick(page) - confirmAccountEmailMessage := page.MustElement("[aria-roledescription=title]").MustText() - require.Contains(t, confirmAccountEmailMessage, "You're almost there!") - - // first time user log in - page.MustElement("[href=\"/login\"]").MustClick() - waitVueTick(page) - page.MustElement("[aria-roledescription=email] input").MustInput(emailAddress) - page.MustElement("[aria-roledescription=password] input").MustInput(password) - page.Keyboard.MustPress(input.Enter) - waitVueTick(page) + // Sign up and login. + signUpWithUser(t, planet, page) + loginWithUser(t, planet, page) // testing onboarding workflow browser - wait := page.MustWaitRequestIdle() - page.MustElementX("(//span[text()=\"Continue in web\"])").MustClick() - wait() + page.MustElementR("span", "Continue in web ->").MustClick() + waitVueTick(page) // Buckets Page bucketsTitle := page.MustElement("[aria-roledescription=title]").MustText() @@ -105,28 +84,45 @@ func TestOnboarding_WizardCLIFlow(t *testing.T) { // Testing onboarding workflow uplinkCLI method // Welcome screen - wait := page.MustWaitRequestIdle() - page.MustElementX("(//span[text()=\"Continue in cli\"])").MustClick() - wait() + page.MustElementR("span", "Continue in cli ->").MustClick() + waitVueTick(page) + + // Create Access Grant screen + page.MustElementR("[aria-roledescription=title]", "Create an Access Grant") + page.MustElement("[aria-roledescription=name] input").MustInput("name") + page.MustElementR("span", "Continue ->").MustClick() + waitVueTick(page) + + // Access Grant permissions screen + page.MustElementR("[aria-roledescription=title]", "Access Permissions") + page.MustElement("[aria-roledescription=select-permissions]").MustClick() + page.MustElementR("label", "Download").MustClick() + page.MustElementR("label", "Upload").MustClick() + page.MustElementR("label", "List").MustClick() + page.MustElementR("label", "Delete").MustClick() + page.MustElement("[aria-roledescription=select-permissions]").MustClick() + page.MustElement("[aria-roledescription=select-duration]").MustClick() + page.MustElementR("li", "6 Months").MustClick() + page.MustElementR("span", "Continue ->").MustClick() + waitVueTick(page) // API key generated screen apiKeyGeneratedTitle := page.MustElement("[aria-roledescription=title]").MustText() require.Contains(t, apiKeyGeneratedTitle, "API Key Generated") - page.Race().Element("[aria-roledescription=satellite-address]").MustHandle(func(el *rod.Element) { - require.NotEmpty(t, el.MustText()) - }).MustDo() - page.Race().Element("[aria-roledescription=api-key]").MustHandle(func(el *rod.Element) { - require.NotEmpty(t, el.MustText()) - }).MustDo() - page.MustElementX("(//span[text()=\"< Back\"])").MustClick() + address := page.MustElement("[aria-roledescription=satellite-address]").MustText() + require.NotEmpty(t, address) + key := page.MustElement("[aria-roledescription=api-key]").MustText() + require.NotEmpty(t, key) + page.MustElementR("span", "Back").MustClick() waitVueTick(page) - welcomeTitle := page.MustElement("[aria-roledescription=title]").MustText() - require.Contains(t, welcomeTitle, "Welcome") - page.MustElementX("(//span[text()=\"Continue in cli\"])").MustClick() - page.MustElementX("(//span[text()=\"Next >\"])").MustClick() + permissionsTitle := page.MustElement("[aria-roledescription=title]").MustText() + require.Contains(t, permissionsTitle, "Access Permissions") + page.MustElementR("span", "Continue ->").MustClick() + waitVueTick(page) + page.MustElementR("span", "Continue ->").MustClick() waitVueTick(page) - // API key generated screen + // Install Uplink CLI screen cliInstallTitle := page.MustElement("[aria-roledescription=title]").MustText() require.Contains(t, cliInstallTitle, "Install Uplink CLI") @@ -148,18 +144,18 @@ func TestOnboarding_WizardCLIFlow(t *testing.T) { require.Equal(t, *macOSBinaryLink, "https://github.com/storj/storj/releases/latest/download/uplink_darwin_amd64.zip") // Back and forth click test - page.MustElementX("(//span[text()=\"< Back\"])").MustClick() + page.MustElementR("span", "Back").MustClick() waitVueTick(page) apiKeyGeneratedTitle1 := page.MustElement("[aria-roledescription=title]").MustText() require.Contains(t, apiKeyGeneratedTitle1, "API Key Generated") - page.MustElementX("(//span[text()=\"Next >\"])").MustClick() + page.MustElementR("span", "Continue ->").MustClick() waitVueTick(page) - page.MustElementX("(//span[text()=\"Next >\"])").MustClick() + page.MustElementR("span", "Continue ->").MustClick() waitVueTick(page) // CLI setup screen cliSetupTitle := page.MustElement("[aria-roledescription=title]").MustText() - require.Contains(t, cliSetupTitle, "CLI Setup") + require.Contains(t, cliSetupTitle, "Uplink setup") // OS tabs page.MustElement("[aria-roledescription=windows]").MustClick() @@ -173,13 +169,13 @@ func TestOnboarding_WizardCLIFlow(t *testing.T) { require.Equal(t, "uplink setup", macosCLISetupCmd) // Back and forth click test - page.MustElementX("(//span[text()=\"< Back\"])").MustClick() + page.MustElementR("span", "Back").MustClick() waitVueTick(page) cliInstallTitle1 := page.MustElement("[aria-roledescription=title]").MustText() require.Contains(t, cliInstallTitle1, "Install Uplink CLI") - page.MustElementX("(//span[text()=\"Next >\"])").MustClick() + page.MustElementR("span", "Continue ->").MustClick() waitVueTick(page) - page.MustElementX("(//span[text()=\"Next >\"])").MustClick() + page.MustElementR("span", "Continue ->").MustClick() waitVueTick(page) // Create bucket screen @@ -198,13 +194,13 @@ func TestOnboarding_WizardCLIFlow(t *testing.T) { require.Equal(t, "uplink mb sj://cakes", macosCreateBucketCmd) // Back and forth click test - page.MustElementX("(//span[text()=\"< Back\"])").MustClick() + page.MustElementR("span", "Back").MustClick() waitVueTick(page) cliSetupTitle1 := page.MustElement("[aria-roledescription=title]").MustText() - require.Contains(t, cliSetupTitle1, "CLI Setup") - page.MustElementX("(//span[text()=\"Next >\"])").MustClick() + require.Contains(t, cliSetupTitle1, "Uplink setup") + page.MustElementR("span", "Continue ->").MustClick() waitVueTick(page) - page.MustElementX("(//span[text()=\"Next >\"])").MustClick() + page.MustElementR("span", "Continue ->").MustClick() waitVueTick(page) // Ready to upload screen @@ -223,13 +219,13 @@ func TestOnboarding_WizardCLIFlow(t *testing.T) { require.Equal(t, "uplink cp ~/Desktop/cheesecake.jpg sj://cakes", macosUploadCmd) // Back and forth click test - page.MustElementX("(//span[text()=\"< Back\"])").MustClick() + page.MustElementR("span", "Back").MustClick() waitVueTick(page) createBucketTitle1 := page.MustElement("[aria-roledescription=title]").MustText() require.Contains(t, createBucketTitle1, "Create a bucket") - page.MustElementX("(//span[text()=\"Next >\"])").MustClick() + page.MustElementR("span", "Continue ->").MustClick() waitVueTick(page) - page.MustElementX("(//span[text()=\"Next >\"])").MustClick() + page.MustElementR("span", "Continue ->").MustClick() waitVueTick(page) // List a bucket screen @@ -248,13 +244,13 @@ func TestOnboarding_WizardCLIFlow(t *testing.T) { require.Equal(t, "uplink ls sj://cakes", macosListCmd) // Back and forth click test - page.MustElementX("(//span[text()=\"< Back\"])").MustClick() + page.MustElementR("span", "Back").MustClick() waitVueTick(page) readyToUploadTitle1 := page.MustElement("[aria-roledescription=title]").MustText() require.Contains(t, readyToUploadTitle1, "Ready to upload") - page.MustElementX("(//span[text()=\"Next >\"])").MustClick() + page.MustElementR("span", "Continue ->").MustClick() waitVueTick(page) - page.MustElementX("(//span[text()=\"Next >\"])").MustClick() + page.MustElementR("span", "Continue ->").MustClick() waitVueTick(page) // Download screen @@ -273,13 +269,13 @@ func TestOnboarding_WizardCLIFlow(t *testing.T) { require.Equal(t, "uplink cp sj://cakes/cheesecake.jpg ~/Downloads/cheesecake.jpg", macosDownloadCmd) // Back and forth click test - page.MustElementX("(//span[text()=\"< Back\"])").MustClick() + page.MustElementR("span", "Back").MustClick() waitVueTick(page) listTitle1 := page.MustElement("[aria-roledescription=title]").MustText() require.Contains(t, listTitle1, "Listing a bucket") - page.MustElementX("(//span[text()=\"Next >\"])").MustClick() + page.MustElementR("span", "Continue ->").MustClick() waitVueTick(page) - page.MustElementX("(//span[text()=\"Next >\"])").MustClick() + page.MustElementR("span", "Continue ->").MustClick() waitVueTick(page) // Share link screen @@ -298,35 +294,25 @@ func TestOnboarding_WizardCLIFlow(t *testing.T) { require.Equal(t, "uplink share --url sj://cakes/cheesecake.jpg", macosShareCmd) // Back and forth click test - page.MustElementX("(//span[text()=\"< Back\"])").MustClick() + page.MustElementR("span", "Back").MustClick() waitVueTick(page) downloadTitle1 := page.MustElement("[aria-roledescription=title]").MustText() require.Contains(t, downloadTitle1, "Download") - page.MustElementX("(//span[text()=\"Next >\"])").MustClick() + page.MustElementR("span", "Continue ->").MustClick() waitVueTick(page) - page.MustElementX("(//span[text()=\"Next >\"])").MustClick() + page.MustElementR("span", "Continue ->").MustClick() waitVueTick(page) // Success screen successTitle := page.MustElement("[aria-roledescription=title]").MustText() require.Contains(t, successTitle, "Wonderful") - page.MustElementX("(//span[text()=\"Finish\"])").MustClick() + page.MustElementR("span", "Finish").MustClick() waitVueTick(page) dashboardTitle := page.MustElement("[aria-roledescription=title]").MustText() require.Contains(t, dashboardTitle, "Dashboard") page.MustNavigateBack() successTitle1 := page.MustElement("[aria-roledescription=title]").MustText() require.Contains(t, successTitle1, "Wonderful") - page.MustElementX("(//button[contains(., 'Upgrade')])").MustClick() - - // Upgrade to pro account modal - addPMModalTitle := page.MustElement("[aria-roledescription=modal-title]").MustText() - require.Contains(t, addPMModalTitle, "Upgrade to Pro Account") - page.MustElement(".close-cross-container").MustClick() - - // Dashboard screen - dashboardTitle1 := page.MustElement("[aria-roledescription=title]").MustText() - require.Contains(t, dashboardTitle1, "Dashboard") }) } diff --git a/web/satellite/src/components/accessGrants/permissions/DurationSelection.vue b/web/satellite/src/components/accessGrants/permissions/DurationSelection.vue index 71447292f..1405b0c51 100644 --- a/web/satellite/src/components/accessGrants/permissions/DurationSelection.vue +++ b/web/satellite/src/components/accessGrants/permissions/DurationSelection.vue @@ -5,6 +5,7 @@

{{ dateRangeLabel }}

diff --git a/web/satellite/src/components/onboardingTour/steps/cliFlow/PermissionsSelect.vue b/web/satellite/src/components/onboardingTour/steps/cliFlow/PermissionsSelect.vue index ccb0349e3..6fcf9c01c 100644 --- a/web/satellite/src/components/onboardingTour/steps/cliFlow/PermissionsSelect.vue +++ b/web/satellite/src/components/onboardingTour/steps/cliFlow/PermissionsSelect.vue @@ -5,6 +5,7 @@