Use Contain assertion in regression test

This commit is contained in:
Andrea Fazzi 2020-02-07 10:56:34 +01:00
parent 2971f2ecaf
commit 73ff311239
4 changed files with 4 additions and 65 deletions

2
go.mod
View file

@ -28,7 +28,7 @@ require (
github.com/microcosm-cc/bluemonday v1.0.2 github.com/microcosm-cc/bluemonday v1.0.2
github.com/monochromegane/terminal v0.0.0-20161222050454-9bc47e2707d9 // indirect github.com/monochromegane/terminal v0.0.0-20161222050454-9bc47e2707d9 // indirect
github.com/pkg/profile v1.4.0 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/robfig/cron v1.2.0
github.com/rs/jplot v0.0.0-20180624024257-9b69b4534805 // indirect github.com/rs/jplot v0.0.0-20180624024257-9b69b4534805 // indirect
github.com/sethvargo/go-password v0.1.3 github.com/sethvargo/go-password v0.1.3

2
go.sum
View file

@ -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-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 h1:qU1a7/zsCi5hydvlheSu2q0lCT0VCfbV27bEIpIuUoU=
github.com/remogatto/prettytest v0.0.0-20191105125618-8fe70ed7a3e1/go.mod h1:jOEnp79oIHy5cvQSHeLcgVJk1GHOOHJHQWps/d1N5Yo= 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 h1:ZjScXvvxeQ63Dbyxy76Fj3AT3Ut0aKsyd2/tl3DTMuQ=
github.com/robfig/cron v1.2.0/go.mod h1:JGuDeoQd7Z6yL4zQhZ3OPEVHB7fL6Ka6skscFHfmt2k= github.com/robfig/cron v1.2.0/go.mod h1:JGuDeoQd7Z6yL4zQhZ3OPEVHB7fL6Ka6skscFHfmt2k=
github.com/rs/jplot v0.0.0-20180624024257-9b69b4534805 h1:Y9XRz+J6fBX74oHZX9KwMzVRnq7AJNxfJSilUpZBrvU= github.com/rs/jplot v0.0.0-20180624024257-9b69b4534805 h1:Y9XRz+J6fBX74oHZX9KwMzVRnq7AJNxfJSilUpZBrvU=

View file

@ -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)
}

View file

@ -74,7 +74,7 @@ func (t *testSuite) TestLogin() {
if err != nil { if err != nil {
panic(err) panic(err)
} }
t.Equal(expected[i], text) t.Contain(expected[i], text)
} }
} }