Cleanup how clicking on a link works for the tests.

main
Zed A. Shaw 3 days ago
parent fecfc8ee84
commit 74edb069d2
  1. 23
      tests/base_test.go

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

Loading…
Cancel
Save