testuite/ui/satellite: cleanup and skip tests

Each test doesn't need to be in a separate file.
Keep naming consistent such that relevant tests can be run together.
Also skip test that do not work at the moment.

No functional changes.

Change-Id: Icd314d383ec5b683dea8afaaf2790e2e4b306671
This commit is contained in:
Egon Elbre 2022-01-05 17:01:33 +02:00
parent d06ba56bc6
commit 5d3085f38d
15 changed files with 546 additions and 682 deletions

View File

@ -1,185 +0,0 @@
// Copyright (C) 2021 Storj Labs, Inc.
// See LICENSE for copying information.
package satellite_test
import (
"os"
"testing"
"time"
"github.com/go-rod/rod"
"github.com/stretchr/testify/require"
"storj.io/common/memory"
"storj.io/common/testcontext"
"storj.io/storj/testsuite/ui/uitest"
)
func TestBrowserFolderAndDifferentFileSizesUpload(t *testing.T) {
uitest.Edge(t, func(t *testing.T, ctx *testcontext.Context, planet *uitest.EdgePlanet, browser *rod.Browser) {
page := openPage(browser, planet.Satellites[0].ConsoleURL())
// Sign up and login.
signUpWithUser(t, planet, page)
loginWithUser(t, planet, page)
// Navigate into browser with new onboarding.
page.MustElementR("a", "Skip and go directly to dashboard").MustClick()
page.MustElementR("p", "Buckets").MustClick()
wait := page.MustWaitRequestIdle()
page.MustElementR("p", "demo-bucket").MustClick()
wait()
page.MustElementR("label", "I understand, and I have saved the passphrase.").MustClick()
page.MustElementR("span", "Next >").MustClick()
// Verify that browser component has loaded and that the dropzone is present.
page.MustElementR("p", "Drop Files Here to Upload")
// Create a Folder.
page.MustElementR("button", "New Folder").MustClick()
page.MustElement("[placeholder=\"Name of the folder\"]").MustInput("testing")
page.MustElementR("button", "Save Folder").MustClick()
page.MustElementR("[aria-roledescription=folder]", "testing").MustClick()
// Attempt to create a folder with spaces.
page.MustElementR("button", "New Folder").MustClick()
page.MustElement("[placeholder=\"Name of the folder\"]").MustInput(" ")
require.Equal(t, "true", page.MustElementR("button", "Save Folder").MustProperty("disabled").Str(), "Folder is not disabled on invalid folder name with spaces")
require.Equal(t, " ", page.MustElement("[placeholder=\"Name of the folder\"]").MustText(), "Folder input does not contain the empty invalid name")
page.MustElementR("button", "Cancel").MustClick()
// Upload a folder (folder upload doesn't work when headless).
if os.Getenv("STORJ_TEST_SHOW_BROWSER") == "" {
// Create folder
page.MustElementR("button", "New Folder").MustClick()
page.MustElement("[placeholder=\"Name of the folder\"]").MustInput("testData")
page.MustElementR("button", "Save Folder").MustClick()
// Navigate into folder and upload file.
page.MustElementR("[aria-roledescription=folder]", "testData").MustClick()
page.MustElement("[href=\"/objects/upload/testing/testData/\"]")
page.MustElementR("p", "Drop Files Here to Upload").MustText()
// Attempt to create a folder with spaces.
page.MustElementR("button", "New Folder").MustClick()
page.MustElement("[placeholder=\"Name of the folder\"]").MustInput(" ")
require.Equal(t, "true", page.MustElementR("button", "Save Folder").MustProperty("disabled").Str(), "Folder is not disabled on invalid folder name with spaces")
require.Equal(t, " ", page.MustElement("[placeholder=\"Name of the folder\"]").MustText(), "Folder input does not contain the empty invalid name")
page.MustElementR("button", "Cancel").MustClick()
wait1 := page.MustWaitRequestIdle()
page.MustElement("input[aria-roledescription=file-upload]").MustSetFiles("./testdata/test0bytes.txt")
wait1()
page.MustElementR("span", "testing/testData/test0bytes.txt")
page.MustElement("#close-modal").MustClick()
page.MustElementR("[aria-roledescription=file]", "test0bytes.txt").MustClick()
require.Contains(t, page.MustElement("[aria-roledescription=preview-placeholder]").String(), "svg", "The modal did not open upon clicking the test0bytes.txt file")
} else {
wait2 := page.MustWaitRequestIdle()
page.MustElement("input[aria-roledescription=folder-upload]").MustSetFiles("./testdata")
wait2()
page.MustElementR("[aria-roledescription=folder]", "testdata").MustClick()
page.MustElementR("[aria-roledescription=file]", "test0bytes.txt").MustClick()
require.Contains(t, page.MustElement("[aria-roledescription=preview-placeholder]").String(), "svg", "The uploaded folder did not upload the files correctly")
}
page.MustElement("#close-modal").MustClick()
page.MustElement("#navigate-back").MustClick()
// Upload duplicate folder (folder upload doesn't work when headless).
if os.Getenv("STORJ_TEST_SHOW_BROWSER") == "" {
// Create folder.
page.MustElementR("button", "New Folder").MustClick()
page.MustElement("[placeholder=\"Name of the folder\"]").MustInput("testdata (1)")
page.MustElementR("button", "Save Folder").MustClick()
// Navigate into folder and upload file.
page.MustElementR("[aria-roledescription=folder]", "testdata \\(1\\)").MustClick()
page.MustElement("[href=\"/objects/upload/testing/testdata (1)/\"]")
page.MustElementR("p", "Drop Files Here to Upload")
// Attempt to create a folder with spaces.
page.MustElementR("button", "New Folder").MustClick()
page.MustElement("[placeholder=\"Name of the folder\"]").MustInput(" ")
require.Equal(t, "true", page.MustElementR("button", "Save Folder").MustProperty("disabled").Str(), "Folder is not disabled on invalid folder name with spaces")
require.Equal(t, " ", page.MustElement("[placeholder=\"Name of the folder\"]").MustText(), "Folder input does not contain the empty invalid name")
page.MustElementR("button", "Cancel").MustClick()
wait3 := page.MustWaitRequestIdle()
page.MustElement("input[aria-roledescription=file-upload]").MustSetFiles("./testdata/test0bytes.txt")
wait3()
page.MustElementR("span", "testing/testdata \\(1\\)/test0bytes.txt")
page.MustElement("#close-modal").MustClick()
page.MustElementR("[aria-roledescription=file]", "test0bytes.txt").MustClick()
require.Contains(t, page.MustElement("[aria-roledescription=preview-placeholder]").String(), "svg", "The modal did not open upon clicking the test0bytes.txt file")
} else {
wait4 := page.MustWaitRequestIdle()
page.MustElement("input[aria-roledescription=folder-upload]").MustSetFiles("./testdata")
wait4()
page.MustElementR("table > tbody > tr:nth-child(1) > td", "..")
page.MustElementR("[aria-roledescription=folder]", "testdata \\(1\\)").MustClick()
page.MustElementR("[aria-roledescription=file]", "test0bytes.txt").MustClick()
require.Contains(t, page.MustElement("[aria-roledescription=preview-placeholder]").String(), "svg", "The uploaded folder did not upload the files correctly")
}
page.MustElement("#close-modal").MustClick()
page.MustElement("#navigate-back").MustClick()
// Upload a 0 byte file.
page.MustElement("input[aria-roledescription=file-upload]").MustSetFiles("./testdata/test0bytes.txt")
page.MustElementR("span", "testing/test0bytes.txt")
page.MustElement("#close-modal").MustClick()
page.MustElementR("[aria-roledescription=file]", "test0bytes.txt").MustClick()
require.Contains(t, page.MustElement("[aria-roledescription=preview-placeholder]").String(), "svg", "The modal did not open upon clicking the 0 byte file")
page.MustElement("#close-modal").MustClick()
// Upload duplicate 0 byte file.
page.MustElement("input[aria-roledescription=file-upload]").MustSetFiles("./testdata/test0bytes.txt")
page.MustElementR("[aria-roledescription=file]", "test0bytes \\(1\\).txt").MustClick()
require.Contains(t, page.MustElement("[aria-roledescription=preview-placeholder]").String(), "svg", "The modal did not open upon clicking the duplicate file")
page.MustElement("#close-modal").MustClick()
if !testing.Short() {
slowpage := page.Sleeper(uitest.MaxDuration(20 * time.Second))
// Upload a 50 MB file.
testFile := generateEmptyFile(t, ctx, "testFile", 5*memory.MiB)
wait5 := slowpage.MustWaitRequestIdle()
slowpage.MustElement("input[aria-roledescription=file-upload]").MustSetFiles(testFile)
wait5()
slowpage.MustElementR("[aria-roledescription=file]", "testFile").MustClick()
require.Contains(t, slowpage.MustElement("[aria-roledescription=preview-placeholder]").String(), "svg", "The modal did not open upon clicking the 50 MB file")
slowpage.MustElement("#close-modal").MustClick()
// Attempt to upload a large file and cancel the upload after a few segments have been uploaded successfully.
testFile2 := generateEmptyFile(t, ctx, "testFile2", 130*memory.MiB)
slowpage.MustElement("input[aria-roledescription=file-upload]").MustSetFiles(testFile2)
require.Equal(t, " testing/testFile2", slowpage.MustElement("[aria-roledescription=file-uploading]").MustText(), "The testFile2 file has not started uploading")
slowpage.MustElementR("[aria-roledescription=files-uploading-count]", "1 file waiting to be uploaded...")
slowpage.MustElementR("[aria-roledescription=progress-bar]", "1")
slowpage.MustElementR("button", "Cancel").MustClick()
slowpage.MustElementR("table > tbody > tr:nth-child(6) > td > span", "testFile")
slowpage.MustElementR("[aria-roledescription=file]", "testFile").MustClick()
slowpage.MustElement("#close-modal").MustClick()
// Upload a 130MB file.
wait6 := slowpage.MustWaitRequestIdle()
slowpage.MustElement("input[aria-roledescription=file-upload]").MustSetFiles(testFile2)
require.Equal(t, " testing/testFile2", slowpage.MustElement("[aria-roledescription=file-uploading]").MustText(), "The testFile2 file has not started uploading")
slowpage.MustElementR("[aria-roledescription=files-uploading-count]", "1 file waiting to be uploaded...")
wait6()
slowpage.MustElementR("[aria-roledescription=file]", "testFile2").MustClick()
require.Contains(t, slowpage.MustElement("[aria-roledescription=preview-placeholder]").String(), "svg", "The modal did not open upon clicking the 130MB file")
slowpage.MustElement("#close-modal").MustClick()
}
// Navigate out of nested folder and delete everything.
page.MustElement("#navigate-back").MustClick()
page.MustElement("button[aria-roledescription=dropdown]").MustClick()
page.MustElementR("button", "Delete").MustClick()
wait7 := page.MustWaitRequestIdle()
page.MustElementR("button", "Yes").MustClick()
wait7()
})
}

View File

@ -5,16 +5,19 @@ package satellite_test
import ( import (
"fmt" "fmt"
"os"
"testing" "testing"
"time"
"github.com/go-rod/rod" "github.com/go-rod/rod"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"storj.io/common/memory"
"storj.io/common/testcontext" "storj.io/common/testcontext"
"storj.io/storj/testsuite/ui/uitest" "storj.io/storj/testsuite/ui/uitest"
) )
func TestBrowserFeatures(t *testing.T) { func TestBrowser_Features(t *testing.T) {
uitest.Edge(t, func(t *testing.T, ctx *testcontext.Context, planet *uitest.EdgePlanet, browser *rod.Browser) { uitest.Edge(t, func(t *testing.T, ctx *testcontext.Context, planet *uitest.EdgePlanet, browser *rod.Browser) {
page := openPage(browser, planet.Satellites[0].ConsoleURL()) page := openPage(browser, planet.Satellites[0].ConsoleURL())
@ -251,3 +254,171 @@ func TestBrowserFeatures(t *testing.T) {
wait5() wait5()
}) })
} }
func TestBrowser_FolderAndDifferentFileSizesUpload(t *testing.T) {
uitest.Edge(t, func(t *testing.T, ctx *testcontext.Context, planet *uitest.EdgePlanet, browser *rod.Browser) {
page := openPage(browser, planet.Satellites[0].ConsoleURL())
// Sign up and login.
signUpWithUser(t, planet, page)
loginWithUser(t, planet, page)
// Navigate into browser with new onboarding.
page.MustElementR("a", "Skip and go directly to dashboard").MustClick()
page.MustElementR("p", "Buckets").MustClick()
wait := page.MustWaitRequestIdle()
page.MustElementR("p", "demo-bucket").MustClick()
wait()
page.MustElementR("label", "I understand, and I have saved the passphrase.").MustClick()
page.MustElementR("span", "Next >").MustClick()
// Verify that browser component has loaded and that the dropzone is present.
page.MustElementR("p", "Drop Files Here to Upload")
// Create a Folder.
page.MustElementR("button", "New Folder").MustClick()
page.MustElement("[placeholder=\"Name of the folder\"]").MustInput("testing")
page.MustElementR("button", "Save Folder").MustClick()
page.MustElementR("[aria-roledescription=folder]", "testing").MustClick()
// Attempt to create a folder with spaces.
page.MustElementR("button", "New Folder").MustClick()
page.MustElement("[placeholder=\"Name of the folder\"]").MustInput(" ")
require.Equal(t, "true", page.MustElementR("button", "Save Folder").MustProperty("disabled").Str(), "Folder is not disabled on invalid folder name with spaces")
require.Equal(t, " ", page.MustElement("[placeholder=\"Name of the folder\"]").MustText(), "Folder input does not contain the empty invalid name")
page.MustElementR("button", "Cancel").MustClick()
// Upload a folder (folder upload doesn't work when headless).
if os.Getenv("STORJ_TEST_SHOW_BROWSER") == "" {
// Create folder
page.MustElementR("button", "New Folder").MustClick()
page.MustElement("[placeholder=\"Name of the folder\"]").MustInput("testData")
page.MustElementR("button", "Save Folder").MustClick()
// Navigate into folder and upload file.
page.MustElementR("[aria-roledescription=folder]", "testData").MustClick()
page.MustElement("[href=\"/objects/upload/testing/testData/\"]")
page.MustElementR("p", "Drop Files Here to Upload").MustText()
// Attempt to create a folder with spaces.
page.MustElementR("button", "New Folder").MustClick()
page.MustElement("[placeholder=\"Name of the folder\"]").MustInput(" ")
require.Equal(t, "true", page.MustElementR("button", "Save Folder").MustProperty("disabled").Str(), "Folder is not disabled on invalid folder name with spaces")
require.Equal(t, " ", page.MustElement("[placeholder=\"Name of the folder\"]").MustText(), "Folder input does not contain the empty invalid name")
page.MustElementR("button", "Cancel").MustClick()
wait1 := page.MustWaitRequestIdle()
page.MustElement("input[aria-roledescription=file-upload]").MustSetFiles("./testdata/test0bytes.txt")
wait1()
page.MustElementR("span", "testing/testData/test0bytes.txt")
page.MustElement("#close-modal").MustClick()
page.MustElementR("[aria-roledescription=file]", "test0bytes.txt").MustClick()
require.Contains(t, page.MustElement("[aria-roledescription=preview-placeholder]").String(), "svg", "The modal did not open upon clicking the test0bytes.txt file")
} else {
wait2 := page.MustWaitRequestIdle()
page.MustElement("input[aria-roledescription=folder-upload]").MustSetFiles("./testdata")
wait2()
page.MustElementR("[aria-roledescription=folder]", "testdata").MustClick()
page.MustElementR("[aria-roledescription=file]", "test0bytes.txt").MustClick()
require.Contains(t, page.MustElement("[aria-roledescription=preview-placeholder]").String(), "svg", "The uploaded folder did not upload the files correctly")
}
page.MustElement("#close-modal").MustClick()
page.MustElement("#navigate-back").MustClick()
// Upload duplicate folder (folder upload doesn't work when headless).
if os.Getenv("STORJ_TEST_SHOW_BROWSER") == "" {
// Create folder.
page.MustElementR("button", "New Folder").MustClick()
page.MustElement("[placeholder=\"Name of the folder\"]").MustInput("testdata (1)")
page.MustElementR("button", "Save Folder").MustClick()
// Navigate into folder and upload file.
page.MustElementR("[aria-roledescription=folder]", "testdata \\(1\\)").MustClick()
page.MustElement("[href=\"/objects/upload/testing/testdata (1)/\"]")
page.MustElementR("p", "Drop Files Here to Upload")
// Attempt to create a folder with spaces.
page.MustElementR("button", "New Folder").MustClick()
page.MustElement("[placeholder=\"Name of the folder\"]").MustInput(" ")
require.Equal(t, "true", page.MustElementR("button", "Save Folder").MustProperty("disabled").Str(), "Folder is not disabled on invalid folder name with spaces")
require.Equal(t, " ", page.MustElement("[placeholder=\"Name of the folder\"]").MustText(), "Folder input does not contain the empty invalid name")
page.MustElementR("button", "Cancel").MustClick()
wait3 := page.MustWaitRequestIdle()
page.MustElement("input[aria-roledescription=file-upload]").MustSetFiles("./testdata/test0bytes.txt")
wait3()
page.MustElementR("span", "testing/testdata \\(1\\)/test0bytes.txt")
page.MustElement("#close-modal").MustClick()
page.MustElementR("[aria-roledescription=file]", "test0bytes.txt").MustClick()
require.Contains(t, page.MustElement("[aria-roledescription=preview-placeholder]").String(), "svg", "The modal did not open upon clicking the test0bytes.txt file")
} else {
wait4 := page.MustWaitRequestIdle()
page.MustElement("input[aria-roledescription=folder-upload]").MustSetFiles("./testdata")
wait4()
page.MustElementR("table > tbody > tr:nth-child(1) > td", "..")
page.MustElementR("[aria-roledescription=folder]", "testdata \\(1\\)").MustClick()
page.MustElementR("[aria-roledescription=file]", "test0bytes.txt").MustClick()
require.Contains(t, page.MustElement("[aria-roledescription=preview-placeholder]").String(), "svg", "The uploaded folder did not upload the files correctly")
}
page.MustElement("#close-modal").MustClick()
page.MustElement("#navigate-back").MustClick()
// Upload a 0 byte file.
page.MustElement("input[aria-roledescription=file-upload]").MustSetFiles("./testdata/test0bytes.txt")
page.MustElementR("span", "testing/test0bytes.txt")
page.MustElement("#close-modal").MustClick()
page.MustElementR("[aria-roledescription=file]", "test0bytes.txt").MustClick()
require.Contains(t, page.MustElement("[aria-roledescription=preview-placeholder]").String(), "svg", "The modal did not open upon clicking the 0 byte file")
page.MustElement("#close-modal").MustClick()
// Upload duplicate 0 byte file.
page.MustElement("input[aria-roledescription=file-upload]").MustSetFiles("./testdata/test0bytes.txt")
page.MustElementR("[aria-roledescription=file]", "test0bytes \\(1\\).txt").MustClick()
require.Contains(t, page.MustElement("[aria-roledescription=preview-placeholder]").String(), "svg", "The modal did not open upon clicking the duplicate file")
page.MustElement("#close-modal").MustClick()
if !testing.Short() {
slowpage := page.Sleeper(uitest.MaxDuration(20 * time.Second))
// Upload a 50 MB file.
testFile := generateEmptyFile(t, ctx, "testFile", 5*memory.MiB)
wait5 := slowpage.MustWaitRequestIdle()
slowpage.MustElement("input[aria-roledescription=file-upload]").MustSetFiles(testFile)
wait5()
slowpage.MustElementR("[aria-roledescription=file]", "testFile").MustClick()
require.Contains(t, slowpage.MustElement("[aria-roledescription=preview-placeholder]").String(), "svg", "The modal did not open upon clicking the 50 MB file")
slowpage.MustElement("#close-modal").MustClick()
// Attempt to upload a large file and cancel the upload after a few segments have been uploaded successfully.
testFile2 := generateEmptyFile(t, ctx, "testFile2", 130*memory.MiB)
slowpage.MustElement("input[aria-roledescription=file-upload]").MustSetFiles(testFile2)
require.Equal(t, " testing/testFile2", slowpage.MustElement("[aria-roledescription=file-uploading]").MustText(), "The testFile2 file has not started uploading")
slowpage.MustElementR("[aria-roledescription=files-uploading-count]", "1 file waiting to be uploaded...")
slowpage.MustElementR("[aria-roledescription=progress-bar]", "1")
slowpage.MustElementR("button", "Cancel").MustClick()
slowpage.MustElementR("table > tbody > tr:nth-child(6) > td > span", "testFile")
slowpage.MustElementR("[aria-roledescription=file]", "testFile").MustClick()
slowpage.MustElement("#close-modal").MustClick()
// Upload a 130MB file.
wait6 := slowpage.MustWaitRequestIdle()
slowpage.MustElement("input[aria-roledescription=file-upload]").MustSetFiles(testFile2)
require.Equal(t, " testing/testFile2", slowpage.MustElement("[aria-roledescription=file-uploading]").MustText(), "The testFile2 file has not started uploading")
slowpage.MustElementR("[aria-roledescription=files-uploading-count]", "1 file waiting to be uploaded...")
wait6()
slowpage.MustElementR("[aria-roledescription=file]", "testFile2").MustClick()
require.Contains(t, slowpage.MustElement("[aria-roledescription=preview-placeholder]").String(), "svg", "The modal did not open upon clicking the 130MB file")
slowpage.MustElement("#close-modal").MustClick()
}
// Navigate out of nested folder and delete everything.
page.MustElement("#navigate-back").MustClick()
page.MustElement("button[aria-roledescription=dropdown]").MustClick()
page.MustElementR("button", "Delete").MustClick()
wait7 := page.MustWaitRequestIdle()
page.MustElementR("button", "Yes").MustClick()
wait7()
})
}

View File

@ -1,40 +0,0 @@
// Copyright (C) 2021 Storj Labs, Inc.
// See LICENSE for copying information.
package satellite
import (
"testing"
"github.com/go-rod/rod"
"github.com/stretchr/testify/require"
"storj.io/common/testcontext"
"storj.io/storj/private/testplanet"
"storj.io/storj/testsuite/ui/uitest"
)
func TestForgotPasswordOnLoginPageUsingUnverifiedAccount(t *testing.T) {
uitest.Run(t, func(t *testing.T, ctx *testcontext.Context, planet *testplanet.Planet, browser *rod.Browser) {
loginPageURL := planet.Satellites[0].ConsoleURL() + "/login"
emailAddress := "unverified@andnonexistent.test"
page := browser.MustPage(loginPageURL)
page.MustSetViewport(1350, 600, 1, false)
// Reset password link is clicked on login page
page.MustElement(".login-area__content-area__reset-msg__link").MustClick()
// Forgot password elements are checked to verify the page
forgotPasswordHeader := page.MustElement(".forgot-area__content-area__container__title-area").MustText()
require.Contains(t, forgotPasswordHeader, "Reset Password")
emailAddressInput := page.MustElement(".headerless-input")
require.Condition(t, emailAddressInput.MustVisible)
// Tries resetting password for an account that does not exist or is not activated
page.MustElement(".headerless-input").MustClick().MustInput(emailAddress)
page.MustElement(".forgot-area__content-area__container__button").MustClick()
passwordResetMessage := page.MustElement(".notification-wrap__text-area__message").MustText()
require.Contains(t, passwordResetMessage, "There is no such email")
})
}

View File

@ -1,56 +0,0 @@
// 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 TestForgotPasswordOnLoginPageUsingVerifiedAccount(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 := "testacc@mail.test"
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 login page using login link
page.MustElement("a.register-success-area__login-link").MustClick()
// Reset password link is clicked on login page
page.MustElement(".login-area__content-area__reset-msg__link").MustClick()
// Forgot password elements are checked to verify the page
forgotPasswordHeader := page.MustElement(".forgot-area__content-area__container__title-area").MustText()
require.Contains(t, forgotPasswordHeader, "Reset Password")
emailAddressInput := page.MustElement(".headerless-input")
require.Condition(t, emailAddressInput.MustVisible)
// Tries resetting password for account that exists and is activated
page.MustElement(".headerless-input").MustClick().MustInput(emailAddress)
page.MustElement(".forgot-area__content-area__container__button").MustClick()
passwordResetMessage := page.MustElement(".notification-wrap__text-area__message").MustText()
require.Contains(t, passwordResetMessage, "Please look for instructions at your email")
})
}

View File

@ -0,0 +1,121 @@
// 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/private/testplanet"
"storj.io/storj/testsuite/ui/uitest"
)
func TestLogin(t *testing.T) {
uitest.Run(t, func(t *testing.T, ctx *testcontext.Context, planet *testplanet.Planet, browser *rod.Browser) {
loginPageURL := planet.Satellites[0].ConsoleURL() + "/login"
user := planet.Uplinks[0].User[planet.Satellites[0].ID()]
page := openPage(browser, loginPageURL)
page.MustElement("[aria-roledescription=email] input").MustInput(user.Email)
page.MustElement("[aria-roledescription=password] input").MustInput(user.Password)
page.Keyboard.MustPress(input.Enter)
waitVueTick(page)
dashboardTitle := page.MustElement("[aria-roledescription=title]").MustText()
require.Contains(t, dashboardTitle, "Dashboard")
})
}
func TestLogin_ForgotPassword_UnverifiedAccount(t *testing.T) {
t.Skip("does not work")
uitest.Run(t, func(t *testing.T, ctx *testcontext.Context, planet *testplanet.Planet, browser *rod.Browser) {
loginPageURL := planet.Satellites[0].ConsoleURL() + "/login"
emailAddress := "unverified@andnonexistent.test"
page := browser.MustPage(loginPageURL)
page.MustSetViewport(1350, 600, 1, false)
// Reset password link is clicked on login page
page.MustElement(".login-area__content-area__reset-msg__link").MustClick()
// Forgot password elements are checked to verify the page
forgotPasswordHeader := page.MustElement(".forgot-area__content-area__container__title-area").MustText()
require.Contains(t, forgotPasswordHeader, "Reset Password")
emailAddressInput := page.MustElement(".headerless-input")
require.Condition(t, emailAddressInput.MustVisible)
// Tries resetting password for an account that does not exist or is not activated
page.MustElement(".headerless-input").MustClick().MustInput(emailAddress)
page.MustElement(".forgot-area__content-area__container__button").MustClick()
passwordResetMessage := page.MustElement(".notification-wrap__text-area__message").MustText()
require.Contains(t, passwordResetMessage, "There is no such email")
})
}
func TestLogin_ForgotPassword_VerifiedAccount(t *testing.T) {
t.Skip("does not work")
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 := "testacc@mail.test"
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=\"user@example.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 login page using login link
page.MustElement("a.register-success-area__login-link").MustClick()
// Reset password link is clicked on login page
page.MustElement(".login-area__content-area__reset-msg__link").MustClick()
// Forgot password elements are checked to verify the page
forgotPasswordHeader := page.MustElement(".forgot-area__content-area__container__title-area").MustText()
require.Contains(t, forgotPasswordHeader, "Reset Password")
emailAddressInput := page.MustElement(".headerless-input")
require.Condition(t, emailAddressInput.MustVisible)
// Tries resetting password for account that exists and is activated
page.MustElement(".headerless-input").MustClick().MustInput(emailAddress)
page.MustElement(".forgot-area__content-area__container__button").MustClick()
passwordResetMessage := page.MustElement(".notification-wrap__text-area__message").MustText()
require.Contains(t, passwordResetMessage, "Please look for instructions at your email")
})
}
func TestLogin_UnverifiedNonexistentAccount(t *testing.T) {
t.Skip("does not work")
uitest.Run(t, func(t *testing.T, ctx *testcontext.Context, planet *testplanet.Planet, browser *rod.Browser) {
loginPageURL := planet.Satellites[0].ConsoleURL() + "/login"
emailAddress := "unverified@andnonexistent.test"
password := "qazwsx123"
page := browser.MustPage(loginPageURL)
page.MustSetViewport(1350, 600, 1, false)
// login with unverified/nonexistent email
page.MustElement("div.login-area__input-wrapper:nth-child(2)").MustClick().MustInput(emailAddress)
page.MustElement("div.login-area__input-wrapper:nth-child(3)").MustClick().MustInput(password)
page.Keyboard.MustPress(input.Enter)
// check for error message for unverified/nonexistent
invalidEmailPasswordMessage := page.MustElement(".notification-wrap__text-area__message").MustText()
require.Contains(t, invalidEmailPasswordMessage, "Your email or password was incorrect, please try again")
})
}

View File

@ -1,36 +0,0 @@
// 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 TestLoginUnverifiedNonexistentAccount(t *testing.T) {
uitest.Run(t, func(t *testing.T, ctx *testcontext.Context, planet *testplanet.Planet, browser *rod.Browser) {
loginPageURL := planet.Satellites[0].ConsoleURL() + "/login"
emailAddress := "unverified@andnonexistent.test"
password := "qazwsx123"
page := browser.MustPage(loginPageURL)
page.MustSetViewport(1350, 600, 1, false)
// login with unverified/nonexistent email
page.MustElement("div.login-area__input-wrapper:nth-child(2)").MustClick().MustInput(emailAddress)
page.MustElement("div.login-area__input-wrapper:nth-child(3)").MustClick().MustInput(password)
page.Keyboard.MustPress(input.Enter)
// check for error message for unverified/nonexistent
invalidEmailPasswordMessage := page.MustElement(".notification-wrap__text-area__message").MustText()
require.Contains(t, invalidEmailPasswordMessage, "Your email or password was incorrect, please try again")
})
}

View File

@ -15,7 +15,67 @@ import (
"storj.io/storj/testsuite/ui/uitest" "storj.io/storj/testsuite/ui/uitest"
) )
func TestOnboardingWizardCLIFlow(t *testing.T) { 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, 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")
})
}
func TestOnboarding_WizardCLIFlow(t *testing.T) {
uitest.Run(t, func(t *testing.T, ctx *testcontext.Context, planet *testplanet.Planet, browser *rod.Browser) { uitest.Run(t, func(t *testing.T, ctx *testcontext.Context, planet *testplanet.Planet, browser *rod.Browser) {
signupPageURL := planet.Satellites[0].ConsoleURL() + "/signup" signupPageURL := planet.Satellites[0].ConsoleURL() + "/signup"
fullName := "John Doe" fullName := "John Doe"
@ -269,3 +329,47 @@ func TestOnboardingWizardCLIFlow(t *testing.T) {
require.Contains(t, dashboardTitle1, "My First Project Dashboard") require.Contains(t, dashboardTitle1, "My First Project Dashboard")
}) })
} }
func TestOnboarding_WelcomeScreenEncryption(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.test"
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!")
// Login as first time User
page.MustElement("[href=\"/login\"]").MustClick()
page.MustElement("[aria-roledescription=email] input").MustInput(emailAddress)
page.MustElement("[aria-roledescription=password] input").MustInput(password)
page.Keyboard.MustPress(input.Enter)
waitVueTick(page)
// Welcome screen encryption test
welcomeTitle := page.MustElement("[aria-roledescription=title]").MustText()
require.Contains(t, welcomeTitle, "Welcome")
serverSideEncTitle := page.MustElement("[aria-roledescription=server-side-encryption-title]").MustText()
require.Contains(t, serverSideEncTitle, "SERVER-SIDE ENCRYPTED")
endToEndEncTitle := page.MustElement("[aria-roledescription=end-to-end-encryption-title]").MustText()
require.Contains(t, endToEndEncTitle, "END-TO-END ENCRYPTED")
serverSideEncLink, err := page.MustElement("[aria-roledescription=server-side-encryption-link]").Attribute("href")
require.NoError(t, err)
require.Equal(t, "https://docs.storj.io/concepts/encryption-key/design-decision-server-side-encryption", *serverSideEncLink)
endToEndEncLink, err := page.MustElement("[aria-roledescription=end-to-end-encryption-link]").Attribute("href")
require.NoError(t, err)
require.Equal(t, "https://docs.storj.io/concepts/encryption-key/design-decision-end-to-end-encryption", *endToEndEncLink)
})
}

View File

@ -1,75 +0,0 @@
// 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.test"
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")
})
}

View File

@ -1,60 +0,0 @@
// 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/private/testplanet"
"storj.io/storj/testsuite/ui/uitest"
)
func TestOnboardingWelcomeScreenEncryption(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.test"
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!")
// Login as first time User
page.MustElement("[href=\"/login\"]").MustClick()
page.MustElement("[aria-roledescription=email] input").MustInput(emailAddress)
page.MustElement("[aria-roledescription=password] input").MustInput(password)
page.Keyboard.MustPress(input.Enter)
waitVueTick(page)
// Welcome screen encryption test
welcomeTitle := page.MustElement("[aria-roledescription=title]").MustText()
require.Contains(t, welcomeTitle, "Welcome")
serverSideEncTitle := page.MustElement("[aria-roledescription=server-side-encryption-title]").MustText()
require.Contains(t, serverSideEncTitle, "SERVER-SIDE ENCRYPTED")
endToEndEncTitle := page.MustElement("[aria-roledescription=end-to-end-encryption-title]").MustText()
require.Contains(t, endToEndEncTitle, "END-TO-END ENCRYPTED")
serverSideEncLink, err := page.MustElement("[aria-roledescription=server-side-encryption-link]").Attribute("href")
require.NoError(t, err)
require.Equal(t, "https://docs.storj.io/concepts/encryption-key/design-decision-server-side-encryption", *serverSideEncLink)
endToEndEncLink, err := page.MustElement("[aria-roledescription=end-to-end-encryption-link]").Attribute("href")
require.NoError(t, err)
require.Equal(t, "https://docs.storj.io/concepts/encryption-key/design-decision-end-to-end-encryption", *endToEndEncLink)
})
}

View File

@ -1,44 +0,0 @@
// 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/private/testplanet"
"storj.io/storj/testsuite/ui/uitest"
)
func TestBusinessUserCanSignUp(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.test"
password := "qazwsx123"
companyName := "company"
positionTitle := "tester"
page := openPage(browser, signupPageURL)
// First time User signup
page.MustElement("[aria-roledescription=professional-label]").MustClick()
page.MustElement("[aria-roledescription=name] input").MustInput(fullName)
page.MustElement("[aria-roledescription=email] input").MustInput(emailAddress)
page.MustElement("[aria-roledescription=company-name] input").MustInput(companyName)
page.MustElement("[aria-roledescription=position] input").MustInput(positionTitle)
page.MustElement("[aria-roledescription=password] input").MustInput(password)
page.MustElement("[aria-roledescription=retype-password] input").MustInput(password)
page.MustElementX("(//*[@class=\"checkmark\"])[2]").MustClick()
page.Keyboard.MustPress(input.Enter)
waitVueTick(page)
confirmAccountEmailMessage := page.MustElement("[aria-roledescription=title]").MustText()
require.Contains(t, confirmAccountEmailMessage, "You're almost there!")
})
}

View File

@ -1,62 +0,0 @@
// 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/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 := openPage(browser, signupPageURL)
// Satellites dropdown
page.MustElement("[aria-roledescription=satellites-dropdown]").MustClick()
usSatLink := page.MustElement("[href=\"https://us1.storj.io/signup\"]").MustText()
require.Contains(t, usSatLink, "US1")
euSatLink := page.MustElement("[href=\"https://eu1.storj.io/signup\"]").MustText()
require.Contains(t, euSatLink, "EU1")
apSatLink := page.MustElement("[href=\"https://ap1.storj.io/signup\"]").MustText()
require.Contains(t, apSatLink, "AP1")
page.MustElement("[aria-roledescription=satellites-dropdown]").MustClick()
waitVueTick(page)
// User signup with invalid email
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)
page.MustElement(".checkmark").MustClick()
page.Keyboard.MustPress(input.Enter)
waitVueTick(page)
invalidEmailMessage := page.MustElement("[aria-roledescription=email] [aria-roledescription=error-text]").MustText()
require.Contains(t, invalidEmailMessage, "Invalid Email")
// User signup with no email or password
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("")
page.Keyboard.MustPress(input.Enter)
waitVueTick(page)
invalidEmailMessage1 := page.MustElement("[aria-roledescription=email] [aria-roledescription=error-text]").MustText()
require.Contains(t, invalidEmailMessage1, "Invalid Email")
invalidPasswordMessage := page.MustElement("[aria-roledescription=password] [aria-roledescription=error-text]").MustText()
require.Contains(t, invalidPasswordMessage, "Invalid Password")
})
}

View File

@ -1,39 +0,0 @@
// 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/private/testplanet"
"storj.io/storj/testsuite/ui/uitest"
)
func TestPersonalUserCanSignUp(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.test"
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!")
})
}

View File

@ -1,50 +0,0 @@
// 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")
})
}

View File

@ -0,0 +1,148 @@
// 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/private/testplanet"
"storj.io/storj/testsuite/ui/uitest"
)
func TestSignup_BusinessUser(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.test"
password := "qazwsx123"
companyName := "company"
positionTitle := "tester"
page := openPage(browser, signupPageURL)
// First time User signup
page.MustElement("[aria-roledescription=professional-label]").MustClick()
page.MustElement("[aria-roledescription=name] input").MustInput(fullName)
page.MustElement("[aria-roledescription=email] input").MustInput(emailAddress)
page.MustElement("[aria-roledescription=company-name] input").MustInput(companyName)
page.MustElement("[aria-roledescription=position] input").MustInput(positionTitle)
page.MustElement("[aria-roledescription=password] input").MustInput(password)
page.MustElement("[aria-roledescription=retype-password] input").MustInput(password)
page.MustElementX("(//*[@class=\"checkmark\"])[2]").MustClick()
page.Keyboard.MustPress(input.Enter)
waitVueTick(page)
confirmAccountEmailMessage := page.MustElement("[aria-roledescription=title]").MustText()
require.Contains(t, confirmAccountEmailMessage, "You're almost there!")
})
}
func TestSignup_Content(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 := openPage(browser, signupPageURL)
// Satellites dropdown
page.MustElement("[aria-roledescription=satellites-dropdown]").MustClick()
usSatLink := page.MustElement("[href=\"https://us1.storj.io/signup\"]").MustText()
require.Contains(t, usSatLink, "US1")
euSatLink := page.MustElement("[href=\"https://eu1.storj.io/signup\"]").MustText()
require.Contains(t, euSatLink, "EU1")
apSatLink := page.MustElement("[href=\"https://ap1.storj.io/signup\"]").MustText()
require.Contains(t, apSatLink, "AP1")
page.MustElement("[aria-roledescription=satellites-dropdown]").MustClick()
waitVueTick(page)
// User signup with invalid email
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)
page.MustElement(".checkmark").MustClick()
page.Keyboard.MustPress(input.Enter)
waitVueTick(page)
invalidEmailMessage := page.MustElement("[aria-roledescription=email] [aria-roledescription=error-text]").MustText()
require.Contains(t, invalidEmailMessage, "Invalid Email")
// User signup with no email or password
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("")
page.Keyboard.MustPress(input.Enter)
waitVueTick(page)
invalidEmailMessage1 := page.MustElement("[aria-roledescription=email] [aria-roledescription=error-text]").MustText()
require.Contains(t, invalidEmailMessage1, "Invalid Email")
invalidPasswordMessage := page.MustElement("[aria-roledescription=password] [aria-roledescription=error-text]").MustText()
require.Contains(t, invalidPasswordMessage, "Invalid Password")
})
}
func TestSignup_PersonalUser(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.test"
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!")
})
}
func TestSignup_TwiceWithSameEmail(t *testing.T) {
t.Skip("does not work")
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=\"user@example.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=\"user@example.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")
})
}

View File

@ -1,33 +0,0 @@
// 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/private/testplanet"
"storj.io/storj/testsuite/ui/uitest"
)
func TestLoginToAccount(t *testing.T) {
uitest.Run(t, func(t *testing.T, ctx *testcontext.Context, planet *testplanet.Planet, browser *rod.Browser) {
loginPageURL := planet.Satellites[0].ConsoleURL() + "/login"
user := planet.Uplinks[0].User[planet.Satellites[0].ID()]
page := openPage(browser, loginPageURL)
page.MustElement("[aria-roledescription=email] input").MustInput(user.Email)
page.MustElement("[aria-roledescription=password] input").MustInput(user.Password)
page.Keyboard.MustPress(input.Enter)
waitVueTick(page)
dashboardTitle := page.MustElement("[aria-roledescription=title]").MustText()
require.Contains(t, dashboardTitle, "Dashboard")
})
}