本文整理汇总了Golang中github.com/sclevine/agouti.Page.First方法的典型用法代码示例。如果您正苦于以下问题:Golang Page.First方法的具体用法?Golang Page.First怎么用?Golang Page.First使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/sclevine/agouti.Page
的用法示例。
在下文中一共展示了Page.First方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: 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"))
}
示例2:
DelayForRendering()
Expect(page.FindByLink(testEnvVars.TestSpaceName)).To(BeFound())
Eventually(Expect(page.FindByLink(testEnvVars.TestSpaceName).Click()).To(Succeed()))
})
By("showing app name and quota information (along with other information)", func() {
DelayForRendering()
DelayForRendering()
Eventually(page.Find("#app-name-heading")).Should(BeFound())
Expect(page.Find("#buildpack-heading")).To(BeFound())
Expect(page.Find("#memory-heading")).To(BeFound())
Expect(page.Find("#instances-heading")).To(BeFound())
Expect(page.Find("#state-heading")).To(BeFound())
Expect(page.Find("#disk-quota-heading")).To(BeFound())
Eventually(page.First(".app-name-data")).Should(BeFound())
Eventually(page.First(".buildpack-data")).Should(BeFound())
Eventually(page.First(".memory-data")).Should(BeFound())
Eventually(page.First(".instances-data")).Should(BeFound())
Eventually(page.First(".state-data")).Should(BeFound())
Eventually(page.First(".disk-quota-data")).Should(BeFound())
})
// MARKETPLACE TESTS
By("allowing the user to click on the org marketplace in the org dropdown menu", func() {
user.OpenOrgMenuOn(page).ClickMarketplaceLink()
})
By("showing the user a table with all the services", func() {
DelayForRendering()
Expect(page.Find("#service-name-heading")).To(BeFound())
示例3:
It("there is pagination", func() {
// homepage -> resource detail
Expect(page.Navigate(homepage())).To(Succeed())
Eventually(page.FindByLink("resource-name")).Should(BeFound())
Expect(page.FindByLink("resource-name").Click()).To(Succeed())
// resource detail -> paused resource detail
Expect(page).Should(HaveURL(withPath("/resources/resource-name")))
Expect(page.Find("h1")).To(HaveText("resource-name"))
Expect(page.All(".pagination").Count()).Should(Equal(2))
Expect(page.Find(".resource-versions")).Should(BeFound())
Expect(page.All(".resource-versions li").Count()).Should(Equal(100))
Expect(page.Find(".pagination .fa-arrow-left")).ShouldNot(BeFound())
Expect(page.First(".pagination .fa-arrow-right").Click()).To(Succeed())
Expect(page.All(".resource-versions li").Count()).Should(Equal(4))
Expect(page.Find(".pagination .fa-arrow-right")).ShouldNot(BeFound())
Expect(page.First(".pagination .fa-arrow-left").Click()).To(Succeed())
Expect(page.All(".resource-versions li").Count()).Should(Equal(100))
})
})
Context("with less than 100 resource versions", func() {
var pipelineDB db.PipelineDB
BeforeEach(func() {
// job build data
_, err := sqlDB.SaveConfig(atc.DefaultPipelineName, atc.Config{
示例4:
Eventually(Expect(page).To(HaveURL(testEnvVars.LoginURL + "/login")))
Expect(page.FindByName("username").Fill(testEnvVars.Username)).To(Succeed())
Expect(page.FindByName("password").Fill(testEnvVars.Password)).To(Succeed())
Expect(page.FindByButton("Sign in").Click()).To(Succeed())
Eventually(Expect(page).To(HaveURL(testEnvVars.Hostname + "/#/dashboard")))
})
By("allowing the user to click a dropdown menu labeled 'Organizations'", func() {
delayForRendering()
Expect(page.Find("#org-dropdown")).To(BeFound())
Expect(page.Find("#org-dropdown").Text()).To(Equal("Organization: Select one "))
Expect(page.Find("#org-dropdown").Click()).To(Succeed())
})
By("allowing the user to click on an organization in the dropdown menu", func() {
delayForRendering()
Eventually(Expect(page.First(".org-name").Click()).To(Succeed()))
})
By("showing the table containing spaces", func() {
delayForRendering()
Expect(page.Find("#spacesTable")).To(BeFound())
Expect(page.FindByXPath("//*[@id='spacesTable']/thead/tr/th[1]").Text()).To(Equal("Name"))
Expect(page.FindByXPath("//*[@id='spacesTable']/thead/tr/th[2]").Text()).To(Equal("Number of Apps"))
Expect(page.FindByXPath("//*[@id='spacesTable']/thead/tr/th[3]").Text()).To(Equal("Total Development Memory"))
Expect(page.FindByXPath("//*[@id='spacesTable']/thead/tr/th[4]").Text()).To(Equal("Total Production Memory"))
})
By("allowing the user to click on a space in the tab views", func() {
delayForRendering()
Eventually(Expect(page.First(".space-info").DoubleClick()).To(Succeed()))
})
示例5:
Expect(page.Find(".fa-sign-in").Click()).To(Succeed())
Eventually(page).Should(HavePopupText("Logged in as user"))
Expect(page.ConfirmPopup()).To(Succeed())
Eventually(page.Find("#howdy"), "10s").Should(HaveText("Logged in as User Name"))
})
By("go to catalogue", func() {
Expect(page.FindByLink("Catalogue").Click()).To(Succeed())
Eventually(page, "10s").Should(HaveURL("http://localhost:9102/category.html"))
})
By("add item in the cart", func() {
time.Sleep(4 * time.Second)
Expect(page.First(".product").Find(".fa-shopping-cart").Click()).To(Succeed())
Eventually(page.Find("#numItemsInCart"), "10s").Should(HaveText("1 item(s) in cart"))
})
By("go to cart", func() {
Expect(page.Find("#numItemsInCart").Click()).To(Succeed())
Eventually(page.Find("#basket"), "10s").Should(MatchText("Shopping cart"))
Eventually(page.FindByXPath("//tbody[@id='cart-list']/tr[1]/td[2]"), "1s").Should(HaveText("Loading..."))
Eventually(page.FindByXPath("//tbody[@id='cart-list']/tr[last()]/td[2]/a"), "10s").Should(HaveText("Holy"))
})
// Give some time to follow the demo
time.Sleep(5 * time.Second)
})
示例6:
})
By("allowing manager to click on a certain space", func() {
Eventually(spaces.ViewSpace(testEnvVars.TestSpaceName))
Eventually(page).Should(HaveURL(fmt.Sprintf(
"%s/#/org/%s/spaces/%s", testEnvVars.Hostname, testOrg, testSpace)))
})
By("allowing manager to click on user management tab", func() {
spaces.ClickUserManagement()
Eventually(page).Should(HaveURL(fmt.Sprintf(
"%s/#/org/%s/spaces/%s/users", testEnvVars.Hostname, testOrg, testSpace)))
})
By("having the active tab set to default space users", func() {
Eventually(page.First(".test-subnav-users")).Should(BeVisible())
Expect(page.First(".test-subnav-users .active").Text()).To(Equal("Current space users"))
})
By("seeing a user list for spaces on the first page by default", func() {
Eventually(page.First("table")).Should(BeFound())
Eventually(page.First("table tbody tr")).Should(BeFound())
})
})
It("should allow a org manager to see a list of users for an org", func() {
By("allowing the user to navigate to the space users page", func() {
Expect(page.Navigate(fmt.Sprintf(testEnvVars.Hostname+
"/#/org/%s/spaces/%s/users",
testOrg, testSpace))).To(Succeed())
})
示例7:
// homepage -> job detail w/build info
Expect(page.Navigate(homepage())).To(Succeed())
// we will need to authenticate later to prove it is working for our page
Authenticate(page, "admin", "password")
Eventually(page.FindByLink("job-name")).Should(BeFound())
Expect(page.FindByLink("job-name").Click()).To(Succeed())
Eventually(page.All("#builds li").Count).Should(Equal(103))
// job detail w/build info -> job detail
Eventually(page.Find("h1 a")).Should(BeFound())
Expect(page.Find("h1 a").Click()).To(Succeed())
Eventually(page).Should(HaveURL(withPath("jobs/job-name")))
Eventually(page.All(".js-build").Count).Should(Equal(100))
Expect(page.First(".pagination .disabled .fa-arrow-left")).Should(BeFound())
Expect(page.First(".pagination .fa-arrow-right").Click()).To(Succeed())
Eventually(page.All(".js-build").Count).Should(Equal(3))
Expect(page.First(".pagination .disabled .fa-arrow-right")).Should(BeFound())
Expect(page.First(".pagination .fa-arrow-left").Click()).To(Succeed())
Eventually(page.All(".js-build").Count).Should(Equal(100))
})
})
It("can view resource information of a job build", func() {
// homepage -> job detail w/build info
Expect(page.Navigate(homepage())).To(Succeed())
// we will need to authenticate later to prove it is working for our page
Authenticate(page, "admin", "password")
Eventually(page.FindByLink("job-name")).Should(BeFound())
示例8: SetupNav
func SetupNav(page *agouti.Page) Nav {
var nav = page.First(baseSelector)
Eventually(nav).Should(BeFound())
return Nav{page, nav}
}