當前位置: 首頁>>代碼示例>>Golang>>正文


Golang agouti.WebDriver類代碼示例

本文整理匯總了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)
		})
	})
}
開發者ID:FanszHub,項目名稱:test-site,代碼行數:38,代碼來源:Server_test.go

示例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())
})
開發者ID:craigfurman,項目名稱:Woodhouse-CI,代碼行數:32,代碼來源:integration_suite_test.go


注:本文中的github.com/sclevine/agouti.WebDriver類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。