Beispiel #1
0
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
}
		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))
		})

		By("Setting the permissions for a user", func() {
			var userPerms = userRow.FindByXPath("following-sibling::*[1]")
			var checked = userPerms.All("input:checked[type='checkbox']")
			Eventually(checked).Should(BeFound())
			var checkedStartNum, _ = checked.Count()

			var _ = user.DeactivatePermission(userRow, "Billing Manager")
			checked = userPerms.All("input:checked[type='checkbox']")
			Eventually(checked).Should(HaveCount(checkedStartNum - 1))
			var _ = user.ActivatePermission(userRow, "Billing Manager")
			checked = userPerms.All("input:checked[type='checkbox']")
			Eventually(checked).Should(HaveCount(checkedStartNum))
		})
	})

	AfterEach(func() {
		// Logout user