本文整理匯總了Golang中github.com/sclevine/agouti.WebDriver類的典型用法代碼示例。如果您正苦於以下問題:Golang WebDriver類的具體用法?Golang WebDriver怎麽用?Golang WebDriver使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了WebDriver類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: TestSpec
func TestSpec(t *testing.T) {
Convey("UserRegister", t, func() {
var agoutiDriver *agouti.WebDriver
var page *agouti.Page
session, _ := mgo.Dial("localhost")
session.DB("TESTGoNuts").DropDatabase()
agoutiDriver = agouti.PhantomJS()
So(agoutiDriver.Start(), ShouldBeNil)
log.Println("Starting")
go StartMyApp(3232, "TESTGoNuts")
var err error
page, err = agoutiDriver.NewPage(agouti.Browser("chrome"))
So(err, ShouldBeNil)
Convey("User Registration page", func() {
Convey("when the user registration is reached", func() {
Convey("should see the page", func() {
So(page.Navigate("http://localhost:3232"), ShouldBeNil)
url, _ := page.URL()
So(url, ShouldEqual, "http://localhost:3232/")
})
})
})
Reset(func() {
So(page.Destroy(), ShouldBeNil)
So(agoutiDriver.Stop(), ShouldBeNil)
})
})
}
示例2: TestIntegration
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gexec"
"github.com/sclevine/agouti"
"testing"
)
func TestIntegration(t *testing.T) {
RegisterFailHandler(Fail)
SetDefaultEventuallyTimeout(time.Second * 5)
RunSpecs(t, "Integration Suite")
}
var (
executablePath string
runningExecutable *gexec.Session
buildsDir string
agoutiDriver *agouti.WebDriver
)
var _ = BeforeSuite(func() {
var err error
executablePath, err = gexec.Build("github.com/craigfurman/woodhouse-ci")
Expect(err).NotTo(HaveOccurred())
if os.Getenv("HEADLESS") == "true" {
agoutiDriver = agouti.PhantomJS()
} else {
agoutiDriver = agouti.ChromeDriver()
}
Expect(agoutiDriver.Start()).To(Succeed())
})