2021-09-16 13:04:26 +01:00
|
|
|
// Copyright (C) 2021 Storj Labs, Inc.
|
|
|
|
// See LICENSE for copying information.
|
|
|
|
|
|
|
|
package satellite
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/go-rod/rod"
|
|
|
|
"github.com/go-rod/rod/lib/input"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
|
|
|
|
"storj.io/common/testcontext"
|
|
|
|
"storj.io/storj/private/testplanet"
|
|
|
|
"storj.io/storj/testsuite/ui/uitest"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestOnboardingWizardCLIFlow(t *testing.T) {
|
|
|
|
uitest.Run(t, func(t *testing.T, ctx *testcontext.Context, planet *testplanet.Planet, browser *rod.Browser) {
|
|
|
|
signupPageURL := planet.Satellites[0].ConsoleURL() + "/signup"
|
|
|
|
fullName := "John Doe"
|
|
|
|
emailAddress := "test@email.com"
|
|
|
|
password := "qazwsx123"
|
|
|
|
|
|
|
|
page := browser.MustPage(signupPageURL)
|
|
|
|
page.MustSetViewport(1350, 600, 1, false)
|
|
|
|
|
|
|
|
// First time User signup
|
|
|
|
page.MustElement("[aria-roledescription=name]").MustInput(fullName)
|
|
|
|
page.MustElement("[aria-roledescription=email]").MustInput(emailAddress)
|
|
|
|
page.MustElement("[aria-roledescription=password]").MustInput(password)
|
|
|
|
page.MustElement("[aria-roledescription=retype-password]").MustInput(password)
|
|
|
|
page.MustElement(".checkmark").MustClick()
|
|
|
|
page.Keyboard.MustPress(input.Enter)
|
|
|
|
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()
|
|
|
|
page.MustElement("[aria-roledescription=email]").MustInput(emailAddress)
|
|
|
|
page.MustElement("[aria-roledescription=password]").MustInput(password)
|
|
|
|
page.Keyboard.MustPress(input.Enter)
|
|
|
|
|
|
|
|
// Testing onboarding workflow uplinkCLI method
|
2021-09-23 18:00:40 +01:00
|
|
|
// Welcome screen
|
2021-09-22 12:41:54 +01:00
|
|
|
page.MustElementX("(//span[text()=\"Continue in cli\"])").MustClick()
|
2021-09-23 18:00:40 +01:00
|
|
|
page.MustWaitNavigation()
|
|
|
|
|
|
|
|
// API key generated screen
|
2021-09-16 13:04:26 +01:00
|
|
|
apiKeyGeneratedTitle := page.MustElement("[aria-roledescription=title]").MustText()
|
|
|
|
require.Contains(t, apiKeyGeneratedTitle, "API Key Generated")
|
|
|
|
satelliteAddress := page.MustElement("[aria-roledescription=satellite-address]").MustText()
|
|
|
|
require.NotEmpty(t, satelliteAddress)
|
|
|
|
apiKey := page.MustElement("[aria-roledescription=api-key]").MustText()
|
|
|
|
require.NotEmpty(t, apiKey)
|
2021-09-23 18:00:40 +01:00
|
|
|
page.MustElementX("(//span[text()=\"< Back\"])").MustClick()
|
|
|
|
page.MustWaitNavigation()
|
|
|
|
welcomeTitle := page.MustElement("[aria-roledescription=title]").MustText()
|
|
|
|
require.Contains(t, welcomeTitle, "Welcome")
|
|
|
|
page.MustElementX("(//span[text()=\"Continue in cli\"])").MustClick()
|
2021-09-16 13:04:26 +01:00
|
|
|
page.MustElementX("(//span[text()=\"Next >\"])").MustClick()
|
2021-09-23 18:00:40 +01:00
|
|
|
page.MustWaitNavigation()
|
2021-09-16 13:04:26 +01:00
|
|
|
|
2021-09-23 18:00:40 +01:00
|
|
|
// API key generated screen
|
2021-09-16 13:04:26 +01:00
|
|
|
cliInstallTitle := page.MustElement("[aria-roledescription=title]").MustText()
|
|
|
|
require.Contains(t, cliInstallTitle, "Install Uplink CLI")
|
2021-09-23 18:00:40 +01:00
|
|
|
page.MustElementX("(//span[text()=\"< Back\"])").MustClick()
|
|
|
|
page.MustWaitNavigation()
|
|
|
|
apiKeyGeneratedTitle1 := page.MustElement("[aria-roledescription=title]").MustText()
|
|
|
|
require.Contains(t, apiKeyGeneratedTitle1, "API Key Generated")
|
2021-09-16 13:04:26 +01:00
|
|
|
page.MustElementX("(//span[text()=\"Next >\"])").MustClick()
|
2021-09-23 18:00:40 +01:00
|
|
|
page.MustWaitNavigation()
|
|
|
|
page.MustElementX("(//span[text()=\"Next >\"])").MustClick()
|
|
|
|
page.MustWaitNavigation()
|
2021-09-16 13:04:26 +01:00
|
|
|
|
2021-09-23 18:00:40 +01:00
|
|
|
// CLI setup screen
|
2021-09-16 13:04:26 +01:00
|
|
|
cliSetupTitle := page.MustElement("[aria-roledescription=title]").MustText()
|
|
|
|
require.Contains(t, cliSetupTitle, "CLI Setup")
|
2021-09-23 18:00:40 +01:00
|
|
|
page.MustElementX("(//span[text()=\"< Back\"])").MustClick()
|
|
|
|
page.MustWaitNavigation()
|
|
|
|
cliInstallTitle1 := page.MustElement("[aria-roledescription=title]").MustText()
|
|
|
|
require.Contains(t, cliInstallTitle1, "Install Uplink CLI")
|
2021-09-16 13:04:26 +01:00
|
|
|
page.MustElementX("(//span[text()=\"Next >\"])").MustClick()
|
2021-09-23 18:00:40 +01:00
|
|
|
page.MustWaitNavigation()
|
2021-09-16 13:04:26 +01:00
|
|
|
page.MustElementX("(//span[text()=\"Next >\"])").MustClick()
|
2021-09-23 18:00:40 +01:00
|
|
|
page.MustWaitNavigation()
|
2021-09-16 13:04:26 +01:00
|
|
|
|
2021-09-23 18:00:40 +01:00
|
|
|
// Create bucket screen
|
2021-09-16 13:04:26 +01:00
|
|
|
createBucketTitle := page.MustElement("[aria-roledescription=title]").MustText()
|
|
|
|
require.Contains(t, createBucketTitle, "Create a bucket")
|
2021-09-23 18:00:40 +01:00
|
|
|
page.MustElementX("(//span[text()=\"< Back\"])").MustClick()
|
|
|
|
page.MustWaitNavigation()
|
|
|
|
cliSetupTitle1 := page.MustElement("[aria-roledescription=title]").MustText()
|
|
|
|
require.Contains(t, cliSetupTitle1, "CLI Setup")
|
2021-09-16 13:04:26 +01:00
|
|
|
page.MustElementX("(//span[text()=\"Next >\"])").MustClick()
|
2021-09-23 18:00:40 +01:00
|
|
|
page.MustWaitNavigation()
|
|
|
|
page.MustElementX("(//span[text()=\"Next >\"])").MustClick()
|
|
|
|
page.MustWaitNavigation()
|
2021-09-16 13:04:26 +01:00
|
|
|
|
2021-09-23 18:00:40 +01:00
|
|
|
// Ready to upload screen
|
2021-09-16 13:04:26 +01:00
|
|
|
readyToUploadTitle := page.MustElement("[aria-roledescription=title]").MustText()
|
|
|
|
require.Contains(t, readyToUploadTitle, "Ready to upload")
|
2021-09-23 18:00:40 +01:00
|
|
|
page.MustElementX("(//span[text()=\"< Back\"])").MustClick()
|
|
|
|
page.MustWaitNavigation()
|
|
|
|
createBucketTitle1 := page.MustElement("[aria-roledescription=title]").MustText()
|
|
|
|
require.Contains(t, createBucketTitle1, "Create a bucket")
|
|
|
|
page.MustElementX("(//span[text()=\"Next >\"])").MustClick()
|
|
|
|
page.MustWaitNavigation()
|
2021-09-16 13:04:26 +01:00
|
|
|
page.MustElementX("(//span[text()=\"Next >\"])").MustClick()
|
2021-09-23 18:00:40 +01:00
|
|
|
page.MustWaitNavigation()
|
2021-09-16 13:04:26 +01:00
|
|
|
|
2021-09-23 18:00:40 +01:00
|
|
|
// List a bucket screen
|
2021-09-16 13:04:26 +01:00
|
|
|
listTitle := page.MustElement("[aria-roledescription=title]").MustText()
|
|
|
|
require.Contains(t, listTitle, "Listing a bucket")
|
2021-09-23 18:00:40 +01:00
|
|
|
page.MustElementX("(//span[text()=\"< Back\"])").MustClick()
|
|
|
|
page.MustWaitNavigation()
|
|
|
|
readyToUploadTitle1 := page.MustElement("[aria-roledescription=title]").MustText()
|
|
|
|
require.Contains(t, readyToUploadTitle1, "Ready to upload")
|
|
|
|
page.MustElementX("(//span[text()=\"Next >\"])").MustClick()
|
|
|
|
page.MustWaitNavigation()
|
2021-09-16 13:04:26 +01:00
|
|
|
page.MustElementX("(//span[text()=\"Next >\"])").MustClick()
|
2021-09-23 18:00:40 +01:00
|
|
|
page.MustWaitNavigation()
|
2021-09-16 13:04:26 +01:00
|
|
|
|
2021-09-23 18:00:40 +01:00
|
|
|
// Download screen
|
2021-09-16 13:04:26 +01:00
|
|
|
downloadTitle := page.MustElement("[aria-roledescription=title]").MustText()
|
|
|
|
require.Contains(t, downloadTitle, "Download")
|
2021-09-23 18:00:40 +01:00
|
|
|
page.MustElementX("(//span[text()=\"< Back\"])").MustClick()
|
|
|
|
page.MustWaitNavigation()
|
|
|
|
listTitle1 := page.MustElement("[aria-roledescription=title]").MustText()
|
|
|
|
require.Contains(t, listTitle1, "Listing a bucket")
|
2021-09-16 13:04:26 +01:00
|
|
|
page.MustElementX("(//span[text()=\"Next >\"])").MustClick()
|
2021-09-23 18:00:40 +01:00
|
|
|
page.MustWaitNavigation()
|
|
|
|
page.MustElementX("(//span[text()=\"Next >\"])").MustClick()
|
|
|
|
page.MustWaitNavigation()
|
2021-09-16 13:04:26 +01:00
|
|
|
|
2021-09-23 18:00:40 +01:00
|
|
|
// Share link screen
|
2021-09-16 13:04:26 +01:00
|
|
|
shareLinkTitle := page.MustElement("[aria-roledescription=title]").MustText()
|
|
|
|
require.Contains(t, shareLinkTitle, "Share a link")
|
2021-09-23 18:00:40 +01:00
|
|
|
page.MustElementX("(//span[text()=\"< Back\"])").MustClick()
|
|
|
|
page.MustWaitNavigation()
|
|
|
|
downloadTitle1 := page.MustElement("[aria-roledescription=title]").MustText()
|
|
|
|
require.Contains(t, downloadTitle1, "Download")
|
|
|
|
page.MustElementX("(//span[text()=\"Next >\"])").MustClick()
|
|
|
|
page.MustWaitNavigation()
|
2021-09-16 13:04:26 +01:00
|
|
|
page.MustElementX("(//span[text()=\"Next >\"])").MustClick()
|
2021-09-23 18:00:40 +01:00
|
|
|
page.MustWaitNavigation()
|
2021-09-16 13:04:26 +01:00
|
|
|
|
2021-09-23 18:00:40 +01:00
|
|
|
// Success screen
|
2021-09-16 13:04:26 +01:00
|
|
|
successTitle := page.MustElement("[aria-roledescription=title]").MustText()
|
|
|
|
require.Contains(t, successTitle, "Wonderful")
|
2021-09-23 18:00:40 +01:00
|
|
|
page.MustElementX("(//span[text()=\"Finish\"])").MustClick()
|
|
|
|
page.MustWaitNavigation()
|
|
|
|
dashboardTitle := page.MustElement("[aria-roledescription=title]").MustText()
|
|
|
|
require.Contains(t, dashboardTitle, "My First Project Dashboard")
|
|
|
|
page.MustNavigateBack()
|
|
|
|
successTitle1 := page.MustElement("[aria-roledescription=title]").MustText()
|
|
|
|
require.Contains(t, successTitle1, "Wonderful")
|
2021-09-16 13:04:26 +01:00
|
|
|
page.MustElementX("(//button[contains(., 'Upgrade')])").MustClick()
|
|
|
|
|
2021-09-23 18:00:40 +01:00
|
|
|
// Upgrade to pro account modal
|
2021-09-16 13:04:26 +01:00
|
|
|
addPMModalTitle := page.MustElement("[aria-roledescription=modal-title]").MustText()
|
|
|
|
require.Contains(t, addPMModalTitle, "Upgrade to Pro Account")
|
|
|
|
page.MustElement(".close-cross-container").MustClick()
|
|
|
|
|
2021-09-23 18:00:40 +01:00
|
|
|
// Dashboard screen
|
|
|
|
dashboardTitle1 := page.MustElement("[aria-roledescription=title]").MustText()
|
|
|
|
require.Contains(t, dashboardTitle1, "My First Project Dashboard")
|
2021-09-16 13:04:26 +01:00
|
|
|
})
|
|
|
|
}
|