1fd14e291f
Enable leakless for killing processes. Maybe it'll prevent issues with the jenkins stage stalling. Unify some of the code. Set the browser tests non-parallel again, it might be causing some of the issues. Change-Id: Idb123bff3640e8adab5db0917ee774f0cf7e2568
58 lines
1.4 KiB
Go
58 lines
1.4 KiB
Go
// Copyright (C) 2021 Storj Labs, Inc.
|
|
// See LICENSE for copying information.
|
|
|
|
package uitest
|
|
|
|
import (
|
|
"os"
|
|
"testing"
|
|
|
|
"github.com/go-rod/rod"
|
|
"github.com/spacemonkeygo/monkit/v3"
|
|
"go.uber.org/zap"
|
|
|
|
"storj.io/common/testcontext"
|
|
"storj.io/storj/private/testplanet"
|
|
"storj.io/storj/satellite"
|
|
)
|
|
|
|
var mon = monkit.Package()
|
|
|
|
// Test defines common services for uitests.
|
|
type Test func(t *testing.T, ctx *testcontext.Context, planet *testplanet.Planet, browser *rod.Browser)
|
|
|
|
type zapWriter struct {
|
|
*zap.Logger
|
|
}
|
|
|
|
func (log zapWriter) Write(data []byte) (int, error) {
|
|
log.Logger.Info(string(data))
|
|
return len(data), nil
|
|
}
|
|
|
|
func configureSatellite(log *zap.Logger, index int, config *satellite.Config) {
|
|
if dir := os.Getenv("STORJ_TEST_SATELLITE_WEB"); dir != "" {
|
|
config.Console.StaticDir = dir
|
|
}
|
|
config.Console.NewOnboarding = true
|
|
config.Console.NewNavigation = true
|
|
config.Console.NewBrowser = true
|
|
config.Console.NewObjectsFlow = true
|
|
config.Console.CouponCodeBillingUIEnabled = true
|
|
}
|
|
|
|
// Run starts a new UI test.
|
|
func Run(t *testing.T, test Test) {
|
|
testplanet.Run(t, testplanet.Config{
|
|
SatelliteCount: 1, StorageNodeCount: 4, UplinkCount: 1,
|
|
Reconfigure: testplanet.Reconfigure{
|
|
Satellite: configureSatellite,
|
|
},
|
|
NonParallel: true,
|
|
}, func(t *testing.T, ctx *testcontext.Context, planet *testplanet.Planet) {
|
|
Browser(t, ctx, planet, func(browser *rod.Browser) {
|
|
test(t, ctx, planet, browser)
|
|
})
|
|
})
|
|
}
|