diff --git a/pages/game/index.html b/pages/game/index.html index 6ae220c..85ae9b0 100644 --- a/pages/game/index.html +++ b/pages/game/index.html @@ -3,7 +3,7 @@ -

Zed's Trash Ass Games

+

Zed's Trash Ass Games

More fun than a barrel full of monkeys with syphilus.

@@ -12,7 +12,7 @@
diff --git a/pages/index.html b/pages/index.html index fd25342..f7dee2d 100644 --- a/pages/index.html +++ b/pages/index.html @@ -3,7 +3,7 @@ - + diff --git a/pages/layouts/main.html b/pages/layouts/main.html index 4e87332..991a3a8 100644 --- a/pages/layouts/main.html +++ b/pages/layouts/main.html @@ -13,12 +13,12 @@
- 🏡 - Live - Streams - Games - Register - Login + 🏡 + Live + Streams + Games + Register + Login
diff --git a/pages/stream/index.html b/pages/stream/index.html index 9ad9cff..22c07cf 100644 --- a/pages/stream/index.html +++ b/pages/stream/index.html @@ -5,7 +5,7 @@ -

Past Streams

+

Past Streams

This is where you can checkout information we dropped in a past stream. Did I post a link and you need to remember it? Did someone in chat mention something? Here's where you find it.

diff --git a/public/base.html b/public/base.html index b71d4e2..2041788 100644 --- a/public/base.html +++ b/public/base.html @@ -13,12 +13,12 @@
- 🏡 - Live - Streams - Games - Register - Login + 🏡 + Live + Streams + Games + Register + Login
diff --git a/public/error/index.html b/public/error/index.html index ca8d014..0e80147 100644 --- a/public/error/index.html +++ b/public/error/index.html @@ -13,12 +13,12 @@
- 🏡 - Live - Streams - Games - Register - Login + 🏡 + Live + Streams + Games + Register + Login
diff --git a/public/game/index.html b/public/game/index.html index 839afcf..4573d23 100644 --- a/public/game/index.html +++ b/public/game/index.html @@ -13,12 +13,12 @@
- 🏡 - Live - Streams - Games - Register - Login + 🏡 + Live + Streams + Games + Register + Login
@@ -28,7 +28,7 @@ -

Zed's Trash Ass Games

+

Zed's Trash Ass Games

More fun than a barrel full of monkeys with syphilus.

@@ -37,7 +37,7 @@
diff --git a/public/index.html b/public/index.html index 24b0369..e3841cd 100644 --- a/public/index.html +++ b/public/index.html @@ -13,12 +13,12 @@
- 🏡 - Live - Streams - Games - Register - Login + 🏡 + Live + Streams + Games + Register + Login
@@ -28,7 +28,7 @@ - + diff --git a/public/live/index.html b/public/live/index.html index bbca552..bf64212 100644 --- a/public/live/index.html +++ b/public/live/index.html @@ -13,12 +13,12 @@
- 🏡 - Live - Streams - Games - Register - Login + 🏡 + Live + Streams + Games + Register + Login
diff --git a/public/login/index.html b/public/login/index.html index 2c4a4c6..c5eb0ca 100644 --- a/public/login/index.html +++ b/public/login/index.html @@ -13,12 +13,12 @@
- 🏡 - Live - Streams - Games - Register - Login + 🏡 + Live + Streams + Games + Register + Login
diff --git a/public/register/index.html b/public/register/index.html index f27c83e..9d8b2c9 100644 --- a/public/register/index.html +++ b/public/register/index.html @@ -13,12 +13,12 @@
- 🏡 - Live - Streams - Games - Register - Login + 🏡 + Live + Streams + Games + Register + Login
diff --git a/public/stream/index.html b/public/stream/index.html index 6196317..8251d6f 100644 --- a/public/stream/index.html +++ b/public/stream/index.html @@ -13,12 +13,12 @@
- 🏡 - Live - Streams - Games - Register - Login + 🏡 + Live + Streams + Games + Register + Login
@@ -30,7 +30,7 @@ -

Past Streams

+

Past Streams

This is where you can checkout information we dropped in a past stream. Did I post a link and you need to remember it? Did someone in chat mention something? Here's where you find it.

diff --git a/tests/base_test.go b/tests/base_test.go index efecb4f..02ba307 100644 --- a/tests/base_test.go +++ b/tests/base_test.go @@ -2,7 +2,7 @@ package tests import ( "testing" - "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" browser "github.com/chromedp/chromedp" "zedshaw.games/webapp/data" sq "github.com/Masterminds/squirrel" @@ -14,12 +14,12 @@ func deleteTestUser(username string) { } func TestLogin(t *testing.T) { - assert := assert.New(t) + require := require.New(t) deleteTestUser("testerzed") ctx, cancel := Setup(5); defer cancel() - Run(assert, ctx, + Run(require, ctx, browser.Navigate(`http://127.0.0.1:5002/register/`), browser.WaitVisible(`body > footer`), browser.WaitVisible(`[data-testid="register-index-page"]`), @@ -30,7 +30,7 @@ func TestLogin(t *testing.T) { browser.WaitVisible(`body > footer`), browser.WaitVisible(`[data-testid="login-index-page"]`)) - Run(assert, ctx, + Run(require, ctx, browser.Navigate(`http://127.0.0.1:5002/login/`), browser.WaitVisible(`body > footer`), browser.WaitVisible(`[data-testid="login-index-page"]`), @@ -44,29 +44,41 @@ func TestLogin(t *testing.T) { deleteTestUser("testerzed") } -func TestStreamPage(t *testing.T) { - assert := assert.New(t) + +func TestStreamsPage(t *testing.T) { + require := require.New(t) ctx, cancel := Setup(2); defer cancel(); - var title string + GoTo(require, ctx, "/", `#streams`) + ClickOn(require, ctx, `#streams`) + WaitFor(require, ctx, `[data-testid="stream-index-page"]`) + ExpectText(require, ctx, `#page-title`, "Past Streams") +} - err := browser.Run(ctx, - browser.Navigate(`http://127.0.0.1:5002`), - browser.WaitVisible(`body > footer`), - browser.WaitVisible(`#streams`),) - assert.NoError(err) +func TestLivePage(t *testing.T) { + require := require.New(t) - ClickOn(assert, ctx, `#streams`) + ctx, cancel := Setup(2); + defer cancel(); - err = browser.Run(ctx, browser.WaitVisible(`#streams-title`)) - assert.NoError(err) + GoTo(require, ctx, "/", `#live`) + ClickOn(require, ctx, `#live`) + WaitFor(require, ctx, `[data-testid="live-index-page"]`) +} + +func TestGamePage(t *testing.T) { + require := require.New(t) - err = browser.Run(ctx, browser.Text(`#streams-title`, &title)) - assert.NoError(err) + ctx, cancel := Setup(2); + defer cancel(); - assert.Equal(title, "Past Streams") + GoTo(require, ctx, "/", `#game`) + ClickOn(require, ctx, `#game`) + WaitFor(require, ctx, `[data-testid="game-index-page"]`) + ExpectText(require, ctx, `#page-title`, "Zed's Trash Ass Games") + ClickOn(require, ctx, `[data-testid="game-link"]`) } func TestMain(m *testing.M) { diff --git a/tests/tools.go b/tests/tools.go index 3a954a5..5abda7d 100644 --- a/tests/tools.go +++ b/tests/tools.go @@ -5,7 +5,7 @@ import ( "log" "time" "runtime" - "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" browser "github.com/chromedp/chromedp" ) @@ -22,16 +22,39 @@ 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) +func ClickOn(require *require.Assertions, ctx context.Context, id string) { + err := browser.Run(ctx, browser.WaitVisible(id),) + require.NoError(err) - resp, err := browser.RunResponse(ctx, browser.Click(id, browser.ByID)) - assert.Equal(resp.Status, int64(200)) - assert.NoError(err) + resp, err := browser.RunResponse(ctx, + browser.WaitVisible(id), + browser.Click(id)) + + require.NoError(err) + require.Equal(resp.Status, int64(200)) +} + +func GoTo(require *require.Assertions, ctx context.Context, path string, expect string) { + err := browser.Run(ctx, + browser.Navigate(`http://127.0.0.1:5002`), + browser.WaitVisible(`body > footer`), + browser.WaitVisible(expect)) + require.NoError(err) +} + +func WaitFor(require *require.Assertions, ctx context.Context, expect string) { + err := browser.Run(ctx, browser.WaitVisible(expect)) + require.NoError(err) +} + +func ExpectText(require *require.Assertions, ctx context.Context, target string, expect string) { + var extracted string + err := browser.Run(ctx, browser.Text(target, &extracted)) + require.NoError(err) + require.Equal(expect, extracted) } -func Run(assert *assert.Assertions, ctx context.Context, actions ...browser.Action) { +func Run(require *require.Assertions, ctx context.Context, actions ...browser.Action) { err := browser.Run(ctx, actions...) - assert.NoError(err) + require.NoError(err) }