storj/testsuite/ui/satellite/onboarding_wizard_browser_test.go
Egon Elbre dfd2977a01 testsuite/ui: fixes to setup
* Remove "enable-logging", because it ends up spawning consoles on
  Windows.
* Remove "disable-gpu", if we have a GPU, then let's use it.
* Create custom client, so we can attach logging to CDP.
* Ignore potential context.Canceled.
* Fix onboarding wizard test for new objects browser.
* Return an error on a context cancellation.
* Wire all loggers to planet.

Change-Id: I67eb138ba31252f55ac5b383679d033bcf71f1b2
2021-11-15 15:56:35 +02:00

76 lines
2.8 KiB
Go

// Copyright (C) 2021 Storj Labs, Inc.
// See LICENSE for copying information.
package satellite_test
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/testsuite/ui/uitest"
)
func TestOnboardingWizardBrowser(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.com"
password := "qazwsx123"
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)
// testing onboarding workflow browser
wait := page.MustWaitRequestIdle()
page.MustElementX("(//span[text()=\"Continue in web\"])").MustClick()
wait()
// Buckets Page
bucketsTitle := page.MustElement("[aria-roledescription=title]").MustText()
require.Contains(t, bucketsTitle, "Buckets")
page.Race().ElementR("p", "demo-bucket").MustHandle(func(el *rod.Element) {
el.MustClick()
waitVueTick(page)
}).MustDo()
// Passphrase screen
encryptionTitle := page.MustElement("[aria-roledescription=objects-title]").MustText()
require.Contains(t, encryptionTitle, "The object browser uses server side encryption.")
customPassphrase := page.MustElement("[aria-roledescription=enter-passphrase-label]")
customPassphraseLabel := customPassphrase.MustText()
require.Contains(t, customPassphraseLabel, "Enter your own passphrase")
customPassphrase.MustClick()
waitVueTick(page)
page.MustElement("[aria-roledescription=passphrase] input").MustInput("password123")
page.MustElement(".checkmark").MustClick()
waitVueTick(page)
page.MustElementX("(//span[text()=\"Next >\"])").MustClick()
waitVueTick(page)
// Verify that browser component has loaded and that the dropzone is present
page.MustElementR("p", "Drop Files Here to Upload")
})
}