|
|
@ -16,7 +16,7 @@ func Run(assert *assert.Assertions, ctx context.Context, actions ...browser.Acti |
|
|
|
|
|
|
|
|
|
|
|
func Setup(timeout time.Duration) (context.Context, context.CancelFunc) { |
|
|
|
func Setup(timeout time.Duration) (context.Context, context.CancelFunc) { |
|
|
|
opts := append(browser.DefaultExecAllocatorOptions[:], |
|
|
|
opts := append(browser.DefaultExecAllocatorOptions[:], |
|
|
|
browser.Flag("headless", true),) |
|
|
|
browser.Flag("headless", false),) |
|
|
|
|
|
|
|
|
|
|
|
ctx, cancel := browser.NewExecAllocator(context.Background(), opts...) |
|
|
|
ctx, cancel := browser.NewExecAllocator(context.Background(), opts...) |
|
|
|
|
|
|
|
|
|
|
@ -27,7 +27,15 @@ func Setup(timeout time.Duration) (context.Context, context.CancelFunc) { |
|
|
|
return ctx, cancel |
|
|
|
return ctx, cancel |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
func ClickOn(assert *assert.Assertions, ctx context.Context, id string) { |
|
|
|
|
|
|
|
err := browser.Run(ctx, browser.WaitVisible(`#streams`),) |
|
|
|
|
|
|
|
assert.NoError(err) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
resp, err := browser.RunResponse(ctx, browser.Click(id, browser.ByID)) |
|
|
|
|
|
|
|
assert.Equal(resp.Status, int64(200)) |
|
|
|
|
|
|
|
assert.NoError(err) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func TestLogin(t *testing.T) { |
|
|
|
func TestLogin(t *testing.T) { |
|
|
|
assert := assert.New(t) |
|
|
|
assert := assert.New(t) |
|
|
|
|
|
|
|
|
|
|
@ -43,7 +51,6 @@ func TestLogin(t *testing.T) { |
|
|
|
browser.WaitVisible(`body > footer`), |
|
|
|
browser.WaitVisible(`body > footer`), |
|
|
|
browser.WaitVisible(`[data-testid="home-page"]`)) |
|
|
|
browser.WaitVisible(`[data-testid="home-page"]`)) |
|
|
|
} |
|
|
|
} |
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func TestStreamPage(t *testing.T) { |
|
|
|
func TestStreamPage(t *testing.T) { |
|
|
|
assert := assert.New(t) |
|
|
|
assert := assert.New(t) |
|
|
@ -51,7 +58,7 @@ func TestStreamPage(t *testing.T) { |
|
|
|
ctx, cancel := Setup(2); |
|
|
|
ctx, cancel := Setup(2); |
|
|
|
defer cancel(); |
|
|
|
defer cancel(); |
|
|
|
|
|
|
|
|
|
|
|
var example string |
|
|
|
var title string |
|
|
|
|
|
|
|
|
|
|
|
err := browser.Run(ctx, |
|
|
|
err := browser.Run(ctx, |
|
|
|
browser.Navigate(`http://127.0.0.1:5002`), |
|
|
|
browser.Navigate(`http://127.0.0.1:5002`), |
|
|
@ -60,15 +67,13 @@ func TestStreamPage(t *testing.T) { |
|
|
|
) |
|
|
|
) |
|
|
|
assert.NoError(err) |
|
|
|
assert.NoError(err) |
|
|
|
|
|
|
|
|
|
|
|
resp, err := browser.RunResponse(ctx, browser.Click(`#streams`, browser.ByID)) |
|
|
|
ClickOn(assert, ctx, `#streams`)
|
|
|
|
assert.Equal(resp.Status, int64(200)) |
|
|
|
|
|
|
|
assert.NoError(err) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
err = browser.Run(ctx, browser.WaitVisible(`#streams-title`)) |
|
|
|
err = browser.Run(ctx, browser.WaitVisible(`#streams-title`)) |
|
|
|
assert.NoError(err) |
|
|
|
assert.NoError(err) |
|
|
|
|
|
|
|
|
|
|
|
err = browser.Run(ctx, browser.Text(`#streams-title`, &example)) |
|
|
|
err = browser.Run(ctx, browser.Text(`#streams-title`, &title)) |
|
|
|
assert.NoError(err) |
|
|
|
assert.NoError(err) |
|
|
|
|
|
|
|
|
|
|
|
assert.Equal(example, "Past Streams") |
|
|
|
assert.Equal(title, "Past Streams") |
|
|
|
} |
|
|
|
} |
|
|
|