func (u User) GetPermission(userRow *agouti.Selection, permission string) *agouti.Selection { var userPerms = userRow.FindByXPath("following-sibling::*[1]") Eventually(userPerms).Should(BeFound()) var userPerm = userPerms.FindByXPath(fmt.Sprintf("td/div/span/span/*[.=\"%s\"]", permission)) Eventually(userPerm).Should(BeFound()) var userPermRow = userPerm.FirstByXPath("ancestor::span") Eventually(userPermRow).Should(BeFound()) var userPermCheckbox = userPermRow.Find("input") Eventually(userPermCheckbox).Should(BeFound()) return userPermCheckbox }
func (d *Device) ReplaceElementValue(element *agouti.Selection, newValue string) error { elements, err := element.Elements() if err != nil { return err } for _, el := range elements { if err := d.session.ReplaceValue(el.GetID(), newValue); err != nil { return fmt.Errorf("failed to replace element value: %s", err) } } return nil }
var orgUsersLink = page.FindByLink("All organization users") Eventually(orgUsersLink).Should(BeFound()) Expect(orgUsersLink.Click()).To(Succeed()) }) By("seeing a user list for the whole org", func() { var table = page.First("table") Eventually(table).Should(BeFound()) var rows = table.First("tbody tr") Eventually(rows).Should(BeFound()) Expect(rows.Count()).Should(BeNumerically(">=", 1)) }) }) It("should allow an org manager to change a space users pemissions", func() { var userRow *agouti.Selection By("allowing the user to navigate to the space users page", func() { Expect(page.Navigate(fmt.Sprintf("%s/#/org/%s/spaces/%s/users", testEnvVars.Hostname, testOrg, testSpace))).To(Succeed()) }) By("seeing a user list for the whole org", func() { var table = page.First("table") Eventually(table).Should(BeFound()) var row = table.First("tbody tr") Eventually(row).Should(BeFound()) userRow = row Expect(row.Count()).Should(BeNumerically(">=", 1)) })