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


Golang agouti.Page類代碼示例

本文整理匯總了Golang中github.com/sclevine/agouti.Page的典型用法代碼示例。如果您正苦於以下問題:Golang Page類的具體用法?Golang Page怎麽用?Golang Page使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Page類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: LogoutOf

func (u User) LogoutOf(page *agouti.Page) {
	Expect(page.Navigate(u.testEnvVars.Hostname + "/v2/logout")).To(Succeed())
	/*
		Expect(page.Find("#logout-btn").Click()).To(Succeed())
		Eventually(Expect(page).To(HaveURL(u.testEnvVars.LoginURL + "login")))
	*/
}
開發者ID:18F,項目名稱:cg-dashboard,代碼行數:7,代碼來源:user.go

示例2: getLastPost

func getLastPost(page *agouti.Page) *agouti.Selection {
	posts := page.All("#chat .message")
	postsCount, err := posts.Count()
	if err != nil {
		panic(err)
	}

	return posts.At(postsCount - 1)
}
開發者ID:roblaszczak,項目名稱:simple-go-chat,代碼行數:9,代碼來源:use_chat_test.go

示例3: FindFirstVisibleOverlayButtonByText

func FindFirstVisibleOverlayButtonByText(text string, page *agouti.Page) *agouti.Selection {
	allSelections := page.AllByButton(text)
	allSelectionsCount, _ := allSelections.Count()
	for i := 0; i < allSelectionsCount; i++ {
		if visible, _ := allSelections.At(i).Visible(); visible {
			return allSelections.At(i)
		}
	}
	return nil
}
開發者ID:ArthurHlt,項目名稱:cg-deck,代碼行數:10,代碼來源:util.go

示例4: LoginTo

func (u User) LoginTo(page *agouti.Page) {
	Expect(page.Navigate(u.testEnvVars.Hostname + "/#/")).To(Succeed())
	var loginLink = page.First(".test-login")
	Eventually(loginLink).Should(BeFound())
	Expect(loginLink.Click()).To(Succeed())
	Eventually(page).Should(HaveURL(u.testEnvVars.LoginURL + "login"))
	Expect(page.FindByName("username").Fill(u.username)).To(Succeed())
	Expect(page.FindByName("password").Fill(u.password)).To(Succeed())
	Expect(page.FindByButton("Sign in").Click()).To(Succeed())
	Eventually(page.FindByButton("Authorize").Click())
	Eventually(page).Should(HaveURL(u.testEnvVars.Hostname + "/#/dashboard"))
}
開發者ID:18F,項目名稱:cg-dashboard,代碼行數:12,代碼來源:user.go

示例5: Authenticate

func Authenticate(page *agouti.Page, username, password string) {
	header := fmt.Sprintf("%s:%s", username, password)

	page.SetCookie(&http.Cookie{
		Name:  auth.CookieName,
		Value: "Basic " + base64.StdEncoding.EncodeToString([]byte(header)),
	})

	// PhantomJS won't send the cookie on ajax requests if the page is not
	// refreshed
	page.Refresh()
}
開發者ID:pcfdev-forks,項目名稱:atc,代碼行數:12,代碼來源:acceptance_suite_test.go

示例6: LoginTo

func (u User) LoginTo(page *agouti.Page) {
	Expect(page.Navigate(u.testEnvVars.Hostname)).To(Succeed())
	Expect(page.Find("#login-btn").Click()).To(Succeed())
	Expect(page).To(HaveURL(u.testEnvVars.LoginURL + "login"))
	Expect(page.FindByName("username").Fill(u.username)).To(Succeed())
	Expect(page.FindByName("password").Fill(u.password)).To(Succeed())
	Expect(page.FindByButton("Sign in").Click()).To(Succeed())
	Expect(page).To(HaveURL(u.testEnvVars.Hostname + "/#/dashboard"))
}
開發者ID:ArthurHlt,項目名稱:cg-deck,代碼行數:9,代碼來源:user.go

示例7: 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

示例8:

import (
	. "github.com/18F/cg-dashboard/acceptance/util"
	. "github.com/18F/cg-dashboard/acceptance/views"
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
	"github.com/sclevine/agouti"
	. "github.com/sclevine/agouti/matchers"

	"net/http/httptest"
)

var _ = Describe("UserLogin", func() {
	var (
		page        *agouti.Page
		server      *httptest.Server
		testEnvVars AcceptanceTestEnvVars
		user        User
	)

	testEnvVars = AcceptanceTestEnvVars{}
	testEnvVars.LoadTestEnvVars()

	BeforeEach(func() {
		// Start a test server
		server, testEnvVars = startServer()

		// Create a fresh page to navigate.
		page = createPage()

		// Reset page
		resetPage(page, testEnvVars)
開發者ID:18F,項目名稱:cg-dashboard,代碼行數:31,代碼來源:user_login_test.go

示例9:

		sqlDB = db.NewSQL(dbLogger, dbConn, bus)
		pipelineDBFactory = db.NewPipelineDBFactory(dbLogger, dbConn, bus, sqlDB)
		atcProcess, atcPort = startATC(atcBin, 1, true, BASIC_AUTH)
		_, err := dbConn.Query(`DELETE FROM teams WHERE name = 'main'`)
		Expect(err).NotTo(HaveOccurred())
	})

	AfterEach(func() {
		ginkgomon.Interrupt(atcProcess)

		Expect(dbConn.Close()).To(Succeed())
		Expect(dbListener.Close()).To(Succeed())
	})

	Describe("pausing a job", func() {
		var page *agouti.Page

		BeforeEach(func() {
			var err error
			page, err = agoutiDriver.NewPage()
			Expect(err).NotTo(HaveOccurred())
		})

		AfterEach(func() {
			Expect(page.Destroy()).To(Succeed())
		})

		homepage := func() string {
			return fmt.Sprintf("http://127.0.0.1:%d/pipelines/%s", atcPort, atc.DefaultPipelineName)
		}
開發者ID:pcfdev-forks,項目名稱:atc,代碼行數:30,代碼來源:job_pausing_test.go

示例10: Screenshot

func Screenshot(page *agouti.Page) {
	page.Screenshot("/tmp/screenshot.png")
}
開發者ID:pcfdev-forks,項目名稱:atc,代碼行數:3,代碼來源:acceptance_suite_test.go

示例11: LogoutOf

func (u User) LogoutOf(page *agouti.Page) {
	Expect(page.Find("#logout-btn").Click()).To(Succeed())
	Eventually(Expect(page).To(HaveURL(u.testEnvVars.LoginURL + "login")))
}
開發者ID:ArthurHlt,項目名稱:cg-deck,代碼行數:4,代碼來源:user.go

示例12: OpenDropdownOfOrgsOn

func (u User) OpenDropdownOfOrgsOn(page *agouti.Page) {
	Eventually(page.Find("#orgs-dropdown-btn")).Should(BeVisible())
	Expect(page.Find("#orgs-dropdown-btn").Click()).To(Succeed())
}
開發者ID:ArthurHlt,項目名稱:cg-deck,代碼行數:4,代碼來源:user.go

示例13: OpenOrgMenuOn

func (u User) OpenOrgMenuOn(page *agouti.Page) OrgMenu {
	Eventually(page.Find("#org-dropdown-btn")).Should(BeVisible())
	Expect(page.Find("#org-dropdown-btn").Click()).To(Succeed())
	return OrgMenu{page}
}
開發者ID:ArthurHlt,項目名稱:cg-deck,代碼行數:5,代碼來源:user.go

示例14: resetPage

func resetPage(page *agouti.Page, testEnvVars AcceptanceTestEnvVars) {
	page.Navigate(testEnvVars.Hostname + "/v2/logout")
	page.Navigate(testEnvVars.Hostname)
}
開發者ID:18F,項目名稱:cg-dashboard,代碼行數:4,代碼來源:cf_console_suite_test.go

示例15:

	. "github.com/onsi/gomega"
	"github.com/sclevine/agouti"
	. "github.com/sclevine/agouti/matchers"
)

var INTEGRATION_TEST_DATA map[string]string = map[string]string{
	"newUserEmail":         "[email protected]",
	"newUserPassword":      "testpassword",
	"fixtureUserEmail":     "[email protected]",
	"fixtureUserPassword":  "test",
	"fixtureAdminEmail":    "[email protected]",
	"fixtureAdminPassword": "test",
}

var _ = Describe("CasGo", func() {
	var page *agouti.Page

	BeforeEach(func() {
		page, err := agoutiDriver.NewPage()
		Expect(err).NotTo(HaveOccurred())
		page.Navigate(testHTTPServer.URL)
		page.Size(640, 480)
	})

	AfterEach(func() {
		page.Destroy()
	})

	It("Finding the expected title on the index page", func() {
		Expect(page).To(HaveTitle("CasGo"))
	})
開發者ID:jostyee,項目名稱:casgo,代碼行數:31,代碼來源:integration_test.go


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