Use Contain assertion in regression test
This commit is contained in:
parent
2971f2ecaf
commit
73ff311239
4 changed files with 4 additions and 65 deletions
2
go.mod
2
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
|
||||
|
|
2
go.sum
2
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=
|
||||
|
|
|
@ -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)
|
||||
}
|
|
@ -74,7 +74,7 @@ func (t *testSuite) TestLogin() {
|
|||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
t.Equal(expected[i], text)
|
||||
t.Contain(expected[i], text)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue