storj/testsuite/ui/satellite/signup_same_email_twice_test.go
nadimhq bde3a884c4 testsuite/ui/satellite: email verification UI tests
Added UI tests surrounding email verification
2022-01-05 14:24:04 +01:00

51 lines
2.2 KiB
Go

// 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 TestSignUpTwiceUsingSameEmail(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 := "signuptwice@test.mail"
password := "qazwsx123"
page := browser.MustPage(signupPageURL)
page.MustSetViewport(1350, 600, 1, false)
// First time User signup
page.MustElement("[placeholder=\"Enter Full Name\"]").MustInput(fullName)
page.MustElement("[placeholder=\"example@email.com\"]").MustInput(emailAddress)
page.MustElement("[placeholder=\"Enter Password\"]").MustInput(password)
page.MustElement("[placeholder=\"Retype Password\"]").MustInput(password)
page.MustElement(".checkmark").MustClick()
page.Keyboard.MustPress(input.Enter)
confirmAccountEmailMessage := page.MustElement(".register-success-area__form-container__title").MustText()
require.Contains(t, confirmAccountEmailMessage, "You're almost there!")
// Go back to registration page by clicking on login link and then registration link
page.MustElement("a.register-success-area__login-link").MustClick()
page.MustElement("a.login-area__content-area__register-link").MustClick()
// Second time User signup with same email, check for error message "This email is already in use; try another"
page.MustElement("[placeholder=\"Enter Full Name\"]").MustInput(fullName)
page.MustElement("[placeholder=\"example@email.com\"]").MustInput(emailAddress)
page.MustElement("[placeholder=\"Enter Password\"]").MustInput(password)
page.MustElement("[placeholder=\"Retype Password\"]").MustInput(password)
page.MustElement(".checkmark").MustClick()
page.Keyboard.MustPress(input.Enter)
require.Contains(t, page.MustElement(".notification-wrap__text-area__message").MustText(), "This email is already in use; try another")
})
}