From 73ff311239c63292773d7c66b60b03e99ea20c60 Mon Sep 17 00:00:00 2001 From: Andrea Fazzi Date: Fri, 7 Feb 2020 10:56:34 +0100 Subject: [PATCH] Use Contain assertion in regression test --- go.mod | 2 +- go.sum | 2 + regression_test/#regression_test.go# | 63 ---------------------------- regression_test/regression_test.go | 2 +- 4 files changed, 4 insertions(+), 65 deletions(-) delete mode 100644 regression_test/#regression_test.go# diff --git a/go.mod b/go.mod index fcc4c8ad..1208ef07 100644 --- a/go.mod +++ b/go.mod @@ -28,7 +28,7 @@ require ( github.com/microcosm-cc/bluemonday v1.0.2 github.com/monochromegane/terminal v0.0.0-20161222050454-9bc47e2707d9 // indirect github.com/pkg/profile v1.4.0 - github.com/remogatto/prettytest v0.0.0-20191105125618-8fe70ed7a3e1 + github.com/remogatto/prettytest v0.0.0-20200207095010-214e293ba0f8 github.com/robfig/cron v1.2.0 github.com/rs/jplot v0.0.0-20180624024257-9b69b4534805 // indirect github.com/sethvargo/go-password v0.1.3 diff --git a/go.sum b/go.sum index 9b919bab..5f67da4e 100644 --- a/go.sum +++ b/go.sum @@ -152,6 +152,8 @@ github.com/remogatto/prettytest v0.0.0-20161014102941-8b5d7bfe964e h1:uQy6ob81XH github.com/remogatto/prettytest v0.0.0-20161014102941-8b5d7bfe964e/go.mod h1:jOEnp79oIHy5cvQSHeLcgVJk1GHOOHJHQWps/d1N5Yo= github.com/remogatto/prettytest v0.0.0-20191105125618-8fe70ed7a3e1 h1:qU1a7/zsCi5hydvlheSu2q0lCT0VCfbV27bEIpIuUoU= github.com/remogatto/prettytest v0.0.0-20191105125618-8fe70ed7a3e1/go.mod h1:jOEnp79oIHy5cvQSHeLcgVJk1GHOOHJHQWps/d1N5Yo= +github.com/remogatto/prettytest v0.0.0-20200207095010-214e293ba0f8 h1:Mo4DlEOEP3z+WecD8ssUEdHaCJTCbzcOvd4vT+weRlY= +github.com/remogatto/prettytest v0.0.0-20200207095010-214e293ba0f8/go.mod h1:jOEnp79oIHy5cvQSHeLcgVJk1GHOOHJHQWps/d1N5Yo= github.com/robfig/cron v1.2.0 h1:ZjScXvvxeQ63Dbyxy76Fj3AT3Ut0aKsyd2/tl3DTMuQ= github.com/robfig/cron v1.2.0/go.mod h1:JGuDeoQd7Z6yL4zQhZ3OPEVHB7fL6Ka6skscFHfmt2k= github.com/rs/jplot v0.0.0-20180624024257-9b69b4534805 h1:Y9XRz+J6fBX74oHZX9KwMzVRnq7AJNxfJSilUpZBrvU= diff --git a/regression_test/#regression_test.go# b/regression_test/#regression_test.go# deleted file mode 100644 index 7f0c2667..00000000 --- a/regression_test/#regression_test.go# +++ /dev/null @@ -1,63 +0,0 @@ -package regression_test - -import ( - "fmt" - "testing" - - "github.com/remogatto/prettytest" - "github.com/tebeka/selenium" -) - -var ( - wd selenium.WebDriver -) - -// Start of setup - -type testSuite struct { - prettytest.Suite -} - -func TestRunner(t *testing.T) { - prettytest.Run( - t, - new(testSuite), - ) -} - -func (t *testSuite) BeforeAll() { - var err error - - // Connect to the WebDriver instance running locally. - caps := selenium.Capabilities{ - "browserName": "firefox", - } - wd, err = selenium.NewRemote(caps, fmt.Sprintf("http://localhost:%d/wd/hub", 4444)) - if err != nil { - panic(err) - } - - // Navigate to the simple playground interface. - if err = wd.Get("http://oef_regression_test:3000"); err != nil { - panic(err) - } - -} - -func (t *testSuite) AfterAll() { - wd.Quit() -} - -func (t *testSuite) TestLogin() { - paragraph, err := wd.FindElement(selenium.ByCSSSelector, "h1.karmen-title") - if err != nil { - panic(err) - } - - text, err := paragraph.Text() - if err != nil { - panic(err) - } - - t.Equal("Olimpiadi", text) -} diff --git a/regression_test/regression_test.go b/regression_test/regression_test.go index ed559b0b..c8cf81e7 100644 --- a/regression_test/regression_test.go +++ b/regression_test/regression_test.go @@ -74,7 +74,7 @@ func (t *testSuite) TestLogin() { if err != nil { panic(err) } - t.Equal(expected[i], text) + t.Contain(expected[i], text) } }