2021-09-29 13:20:20 +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 TestSignUpContent(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"
|
|
|
|
invalidEmailAddress := "test@email"
|
|
|
|
password := "qazwsx123"
|
|
|
|
page := browser.MustPage(signupPageURL)
|
|
|
|
page.MustSetViewport(1350, 600, 1, false)
|
|
|
|
|
|
|
|
// Satellites dropdown
|
|
|
|
page.MustElement("[aria-roledescription=satellites-dropdown]").MustClick()
|
2021-09-30 14:27:46 +01:00
|
|
|
usSatLink := page.MustElement("[href=\"https://us1.storj.io/signup\"]").MustText()
|
2021-09-29 13:20:20 +01:00
|
|
|
require.Contains(t, usSatLink, "US1")
|
2021-09-30 14:27:46 +01:00
|
|
|
euSatLink := page.MustElement("[href=\"https://eu1.storj.io/signup\"]").MustText()
|
2021-09-29 13:20:20 +01:00
|
|
|
require.Contains(t, euSatLink, "EU1")
|
2021-09-30 14:27:46 +01:00
|
|
|
apSatLink := page.MustElement("[href=\"https://ap1.storj.io/signup\"]").MustText()
|
2021-09-29 13:20:20 +01:00
|
|
|
require.Contains(t, apSatLink, "AP1")
|
|
|
|
page.MustElement("[aria-roledescription=satellites-dropdown]").MustClick()
|
|
|
|
|
|
|
|
// User signup with invalid email
|
2021-09-30 14:27:46 +01:00
|
|
|
page.MustElement("[aria-roledescription=name] input").MustInput(fullName)
|
|
|
|
page.MustElement("[aria-roledescription=email] input").MustInput(invalidEmailAddress)
|
|
|
|
page.MustElement("[aria-roledescription=password] input").MustInput(password)
|
|
|
|
page.MustElement("[aria-roledescription=retype-password] input").MustInput(password)
|
2021-09-29 13:20:20 +01:00
|
|
|
page.MustElement(".checkmark").MustClick()
|
|
|
|
page.Keyboard.MustPress(input.Enter)
|
2021-09-30 14:27:46 +01:00
|
|
|
invalidEmailMessage := page.MustElement("[aria-roledescription=email] [aria-roledescription=error-text]").MustText()
|
2021-09-29 13:20:20 +01:00
|
|
|
require.Contains(t, invalidEmailMessage, "Invalid Email")
|
|
|
|
|
|
|
|
// User signup with no email or password
|
2021-09-30 14:27:46 +01:00
|
|
|
page.MustElement("[aria-roledescription=email] input").MustSelectAllText().MustInput("")
|
|
|
|
page.MustElement("[aria-roledescription=password] input").MustSelectAllText().MustInput("")
|
|
|
|
page.MustElement("[aria-roledescription=retype-password] input").MustSelectAllText().MustInput("")
|
2021-09-29 13:20:20 +01:00
|
|
|
page.Keyboard.MustPress(input.Enter)
|
2021-09-30 14:27:46 +01:00
|
|
|
invalidEmailMessage1 := page.MustElement("[aria-roledescription=email] [aria-roledescription=error-text]").MustText()
|
2021-09-29 13:20:20 +01:00
|
|
|
require.Contains(t, invalidEmailMessage1, "Invalid Email")
|
2021-09-30 14:27:46 +01:00
|
|
|
invalidPasswordMessage := page.MustElement("[aria-roledescription=password] [aria-roledescription=error-text]").MustText()
|
2021-09-29 13:20:20 +01:00
|
|
|
require.Contains(t, invalidPasswordMessage, "Invalid Password")
|
|
|
|
})
|
|
|
|
}
|