Beispiel #1
0
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"))
}
Beispiel #2
0
						testBuilds = append(testBuilds, build)
					}
				})

				It("can have paginated results", 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())
					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() {
var _ = Describe("ListJobs", 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())
	})

	It("shows a list of jobs", func() {
		By("root url redirects to jobs page", func() {
			Expect(page.Navigate("http://localhost:3001")).To(Succeed())
			Eventually(page.Find("a#newJob")).Should(BeFound())
		})

		By("creating a new job", func() {
			pageobjects.NewListJobsPage(page).GoToCreateNewJob().CreateJob("Jerb", "echo hello", "busybox", "")
		})

		By("list includes the job on jobs page", func() {
			Expect(page.Navigate("http://localhost:3001/jobs")).To(Succeed())
			Eventually(page.Find(".job:first-of-type")).Should(MatchText(".*Jerb.*"))
		})
	})
})
				_, err = pipelineDBFactory.BuildWithTeamNameAndName(team.Name, "another-pipeline")
				Expect(err).NotTo(HaveOccurred())

			})

			homeLink := ".js-groups li:nth-of-type(2) a"
			defaultPipelineLink := ".js-pipelinesNav-list li:nth-of-type(1) a"
			anotherPipelineLink := ".js-pipelinesNav-list li:nth-of-type(2) a"
			anotherPipelineItem := ".js-pipelinesNav-list li:nth-of-type(2)"

			It("can pause the pipelines", func() {
				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.Find("#pipeline").Text).Should(ContainSubstring("some-job-name"))

				Expect(page.Find(".js-pipelinesNav-toggle").Click()).To(Succeed())

				Expect(page.Find(defaultPipelineLink)).To(HaveText("some-pipeline"))
				Expect(page.Find(anotherPipelineLink)).To(HaveText("another-pipeline"))

				Expect(page.Find(anotherPipelineLink).Click()).To(Succeed())

				Eventually(page).Should(HaveURL(withPath("/pipelines/another-pipeline")))
				Expect(page.Find(homeLink).Click()).To(Succeed())
				Eventually(page).Should(HaveURL(withPath("/pipelines/another-pipeline")))

				Expect(page.Find(".js-pipelinesNav-toggle").Click()).To(Succeed())
				Eventually(page.Find(defaultPipelineLink)).Should(HaveText("some-pipeline"))
				Eventually(page.Find("#pipeline").Text).Should(ContainSubstring("another-job-name"))
Beispiel #5
0
					},
				}, true)
				Ω(err).ShouldNot(HaveOccurred())
			})

			It("can view the 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())
				Expect(page.FindByLink("job-name").Click()).To(Succeed())

				// job detail w/build info -> job detail
				Expect(page).Should(HaveURL(withPath(fmt.Sprintf("jobs/job-name/builds/%d", build.ID))))
				Expect(page.Find("h1")).To(HaveText(fmt.Sprintf("job-name #%d", build.ID)))
				Expect(page.Find("h1 a").Click()).To(Succeed())
				Expect(page).Should(HaveURL(withPath("jobs/job-name")))

				Expect(page.Find(".builds-list li").Count()).Should(Equal(1))
				Expect(page.Find(".builds-list li:first-child a")).To(HaveText(fmt.Sprintf("#%d", build.ID)))

				buildTimes, err := page.Find(".builds-list li:first-child .build-times").Text()
				Ω(err).ShouldNot(HaveOccurred())
				Expect(buildTimes).To(ContainSubstring("started"))
				Expect(buildTimes).To(ContainSubstring("a few seconds ago"))
				Expect(buildTimes).To(ContainSubstring("succeeded"))
				Expect(buildTimes).To(ContainSubstring("a few seconds ago"))
				Expect(buildTimes).To(ContainSubstring("duration"))

				Expect(page.Find(".builds-list li:first-child .inputs")).Should(BeFound())
Beispiel #6
0
		server, testEnvVars = startServer()

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

		// Reset page
		resetPage(page, testEnvVars)

		// Create user
		user = StartUserSessionWith(testEnvVars)
	})

	It("should show the login form if accessing privileged dashboard page without first logining in.", func() {
		By("redirecting the user to the login form", func() {
			Expect(page.Navigate(testEnvVars.Hostname + "/#/")).To(Succeed())
			Expect(page.Find(".test-login")).Should(BeVisible())
		})

	})

	It("should manage user authentication", func() {
		By("directing the user to a landing page", func() {
			Expect(page.Navigate(testEnvVars.Hostname)).To(Succeed())
		})

		By("allowing the user to click the login button and redirected to fill out the login form and submit it", func() {
			user.LoginTo(page)
		})

		By("allowing the user to log out", func() {
			Skip("Not implemented")
Beispiel #7
0
	It("should redirect users to login page if accessing privileged dashboard page without first logining in.", func() {
		By("redirecting the user to the login form", func() {
			Expect(page.Navigate(testEnvVars.Hostname + "/#/dashboard")).To(Succeed())
			Expect(page).To(HaveURL(testEnvVars.Hostname + "/#/"))
		})

	})

	It("should manage user authentication", func() {
		By("directing the user to a landing page", func() {
			Expect(page.Navigate(testEnvVars.Hostname)).To(Succeed())
		})

		By("allowing the user to click the login button and redirected to fill out the login form and submit it", func() {
			delayForRendering()
			Eventually(Expect(page.Find("#login-btn").Click()).To(Succeed()))
			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())
			Expect(page).To(HaveURL(testEnvVars.Hostname + "/#/dashboard"))
		})

		/*
			By("allowing the user to log out", func() {
				Expect(page.Find("#logout").Click()).To(Succeed())
				Expect(page).To(HavePopupText("Are you sure?"))
				Expect(page.ConfirmPopup()).To(Succeed())
				Eventually(page).Should(HaveTitle("Login"))
			})
		*/
Beispiel #8
0
		Expect(err).NotTo(HaveOccurred())
		page.SetImplicitWait(10000)
	})

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

	It("should be able to add an entry", func() {
		By("redirecting the user to the page", func() {
			Expect(page.Navigate("http://localhost:8083/")).To(Succeed())
			Expect(page).To(HaveURL("http://localhost:8083/"))
		})

		By("loading the page completely", func() {
			Eventually(page.Find(".form-control"), "10s").Should(BeFound())
			Eventually(page.Find("#redis-resp"), "10s").ShouldNot(HaveText("Loading..."))
		})

		By("allowing the user to fill out the login form and submit it", func() {
			Expect(page.Find(".form-control").Fill(salutations)).To(Succeed())
			Expect(page.Find(".btn-primary").Click()).To(Succeed())
			Eventually(page.Find("#redis-resp")).Should(HaveText("Sending..."))
		})

		By("allowing the user to see the text", func() {
			Eventually(page.Find(".class-messages:last-of-type"), "10s").Should(HaveText(salutations))
		})

	})
})
	})

	It("should manage user authentication", func() {
		By("redirecting the user to the login form from the webapp page", func() {
			Expect(page.Navigate(AcceptanceSettings("webappUrl"))).To(Succeed())
		})

		By("allowing the user to fill out the login form and submit it", func() {
			Eventually(page.FindByName("email")).Should(BeFound())
			Expect(page.FindByName("email").Fill(AcceptanceSettings("email"))).To(Succeed())
			Expect(page.FindByName("password").Fill(AcceptanceSettings("password"))).To(Succeed())
			Expect(page.FirstByButton("Get Access").Submit()).To(Succeed())
		})

		By("allowing the user to view its data", func() {
			Eventually(page.Find("#user-context")).Should(BeFound())
			Expect(page.Find("#user-context").Click()).To(Succeed())
			Expect(page.Find(".user-submenu")).To(BeVisible())
			Expect(page.Find(".user-submenu .submenu-data p").Text()).To(Equal("Signed in as\nAcceptance Tests"))
		})

		By("allowing the user to logout", func() {
			Eventually(page.Find("#user-context")).Should(BeFound())
			Expect(page.Find("#user-context").Click()).To(Succeed())
			Expect(page.Find(".user-submenu")).To(BeVisible())
			Eventually(page.Find(".user-submenu ul.submenu a[href='/logout']")).Should(BeFound())
			Expect(page.Find(".user-submenu ul.submenu a[href='/logout']").Click()).To(Succeed())
			Eventually(page.FindByName("email")).Should(BeFound())
			Eventually(page.FindByName("password")).Should(BeFound())
			Eventually(page.FirstByButton("Get Access")).Should(BeFound())
		})
		It("runs the job on the host OS", func() {})
	})

	It("creates and runs the new job", func() {
		By("creating the new job using the specified docker image", func() {
			pageobjects.NewListJobsPage(page).Visit().
				GoToCreateNewJob().
				CreateJob("Bob", "cat /etc/lsb-release", "ubuntu:14.04.3", "")
		})

		By("streaming the output from the job", func() {
			expected := `.*DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=14.04
DISTRIB_CODENAME=trusty
DISTRIB_DESCRIPTION="Ubuntu 14.04.3 LTS".*`
			Eventually(page.Find("#jobOutput")).Should(MatchText(expected))
		})

		By("indicating that the job ran successfully", func() {
			Eventually(page.Find("#jobResult")).Should(HaveText("Success"))
		})

		By("indicating that the job is passing on job list page", func() {
			pageobjects.NewListJobsPage(page).Visit()
			Eventually(page.FindByLink("Bob")).Should(HaveAttribute("class", "passing"))
		})
	})

	Context("when 2 builds are scheduled for a job", func() {
		It("preserves build history", func() {
			var showBuildPage *pageobjects.ShowBuildPage
Beispiel #11
0
				}, db.ConfigVersion(1), db.PipelineUnpaused)
				Ω(err).ShouldNot(HaveOccurred())

				pipelineDB, err = pipelineDBFactory.BuildDefault()
				Ω(err).ShouldNot(HaveOccurred())
			})

			It("can view the resource", 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"))

				Authenticate(page, "admin", "password")

				Expect(page.Find(".js-resource .js-pauseUnpause").Click()).To(Succeed())
				Eventually(page.Find(".header i.fa-play")).Should(BeFound())

				page.Refresh()

				Eventually(page.Find(".header i.fa-play")).Should(BeFound())

				resource, err := pipelineDB.GetResource("resource-name")
				Ω(err).ShouldNot(HaveOccurred())

				err = pipelineDB.SetResourceCheckError(resource, errors.New("failed to foo the bar"))
				Ω(err).ShouldNot(HaveOccurred())
				jobService.RunJobReturns(4, nil)
				jobService.FindBuildReturns(build, nil)

				Expect(page.Navigate(fmt.Sprintf("%s/jobs/new", server.URL))).To(Succeed())
				pageobjects.NewNewJobPage(page).CreateJob("Alice", "bork bork", "user/image:tag", "some-repo.git")

				Expect(jobService.SaveCallCount()).To(Equal(1))
			})

			By("redirecting to the build output page", func() {
				Eventually(page).Should(HaveURL(fmt.Sprintf("%s/jobs/some-id/builds/4", server.URL)))
			})

			By("running job", func() {
				Eventually(page.Find("#jobOutput")).Should(HaveText("boom!"))
				Eventually(page.Find("#jobResult")).Should(HaveText("Success"))

				Expect(jobService.RunJobCallCount()).To(Equal(1))
				Expect(jobService.RunJobArgsForCall(0)).To(Equal("some-id"))

				Expect(jobService.FindBuildCallCount()).To(Equal(1))
				jobId, buildNumber := jobService.FindBuildArgsForCall(0)
				Expect(jobId).To(Equal("some-id"))
				Expect(buildNumber).To(Equal(4))
			})
		})

		Context("when saving the job fails", func() {
			BeforeEach(func() {
				jobService.SaveReturns(errors.New("oh dear!"))
Beispiel #13
0
		server, testEnvVars = startServer()

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

	It("should show app structure for an authenticated user", func() {
		// TODO remove skip once requirement is redone.
		Skip("app page changed")
		By("directing the user to a landing page", func() {
			Expect(page.Navigate(testEnvVars.Hostname)).To(Succeed())
		})

		By("allowing the user to click the login button and redirected to fill out the login form and submit it", func() {
			delayForRendering()
			Eventually(Expect(page.Find("#login-btn").Click()).To(Succeed()))
			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()
Beispiel #14
0
		Expect(err).NotTo(HaveOccurred())
		page.SetImplicitWait(10000)
	})

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

	It("should give user feedback", func() {
		By("go to homepage", func() {
			Expect(page.Navigate("http://localhost:9102/")).To(Succeed())
			Expect(page).To(HaveURL("http://localhost:9102/"))
		})

		By("login", func() {
			Eventually(page.Find("#login"), "10s").Should(BeFound())
			Eventually(page.Find("#login"), "10s").Should(HaveText("Login"))

			// Give some time to follow the demo
			time.Sleep(2 * time.Second)

			Expect(page.Find("#login").FindByLink("Login").Click()).To(Succeed())
			Expect(page.Find("#username-modal").Fill("user")).To(Succeed())
			Expect(page.Find("#password-modal").Fill("password")).To(Succeed())
			Expect(page.Find("#password-modal").Fill("password")).To(Succeed())
			time.Sleep(time.Second)
			Expect(page.Find(".fa-sign-in").Click()).To(Succeed())

			Eventually(page).Should(HavePopupText("Logged in as user"))
			Expect(page.ConfirmPopup()).To(Succeed())
	})

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

	It("should communicate via chat", func() {
		By("allowing the user to connect chat", func() {
			Expect(page.Navigate("http://localhost:8080")).To(Succeed())

			firstPostContent := getLastPost(page).Find(".content")
			Expect(firstPostContent).To(MatchText("hello, anonymus_[0-9]{3}"))
		})

		By("allowing the user to send message", func() {
			Expect(page.Find("[ng-model='message']").Fill("hello, biczez")).To(Succeed())
			Expect(page.FindByButton("Send").Submit()).To(Succeed())
			Expect(getLastPost(page).Find(".content")).To(HaveText("hello, biczez"))
		})
	})
})

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)
}
Beispiel #16
0
					It("allows the user to login and logout", func() {
						session = startMainWithArgs(args...)
						Eventually(session).Should(gbytes.Say("garagepi started"))

						By("redirecting the user to the login form from the home page", func() {
							url := fmt.Sprintf("http://localhost:%d/", httpPort)

							Expect(page.Navigate(url)).To(Succeed())
							Expect(page).Should(HaveURL(expectedLoginURL))
						})

						By("allowing the user to fill out the login form and submit it", func() {
							Eventually(page.FindByLabel("Username")).Should(BeFound())
							Expect(page.FindByLabel("Username").Fill(username)).To(Succeed())
							Expect(page.FindByLabel("Password").Fill(password)).To(Succeed())
							Expect(page.Find("#login").Submit()).To(Succeed())
						})

						By("validating the user is redirected to the home page", func() {
							Eventually(page).Should(HaveURL(expectedHomepageURL))
							Eventually(page.Find("#webcam")).Should(BeFound())
						})

						By("allowing the user to log out", func() {
							Expect(page.Find("#logout").Submit()).To(Succeed())

							Eventually(page).Should(HaveURL(expectedLoginURL))
						})
					})
				})
			})
Beispiel #17
0
		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"))
	})

	It("Find the expected title on the login page", func() {
		page.Navigate(testHTTPServer.URL + "/login")
		expectedTitle := testCASServer.Config["companyName"] + " - Login"
		Expect(page.Find("#page-title")).To(HaveText(expectedTitle))
	})

	It("Find the expected title on the register page", func() {
		page.Navigate(testHTTPServer.URL + "/register")
		expectedTitle := testCASServer.Config["companyName"] + " - Register"
		Expect(page.Find("#page-title")).To(HaveText(expectedTitle))
		Expect(page.Find("#email")).To(BeFound())
		Expect(page.Find("#password")).To(BeFound())
	})

	It("Successfully register a new user", func() {
		StepRegisterUser(INTEGRATION_TEST_DATA["newUserEmail"], INTEGRATION_TEST_DATA["newUserPassword"], page)
	})

	It("Login with a user created by the users.json fixture", func() {
Beispiel #18
0
		// Log user in
		user.LoginTo(page)
	})

	It("should show app structure for an authenticated user", func() {
		By("allowing the user to click a dropdown menu labeled 'Organizations'", func() {
			user.OpenDropdownOfOrgsOn(page)
		})

		By("allowing the user to click on an organization in the dropdown menu", func() {
			user.SelectOrgFromDropdown(page, testEnvVars.TestOrgName)
		})

		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()
			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()
	Describe("Phone list view", func() {
		BeforeEach(func() {
			var err error
			page, err = agoutiDriver.NewPage()
			Expect(err).NotTo(HaveOccurred())
			Expect(page.Navigate("http://localhost:8080/#/phones")).To(Succeed())
		})

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

		It("should filter the phone list as a user types into the search box", func() {

			phonesInList := page.Find("ul.phones").All("li")
			query := page.FindByName("query")

			Eventually(phonesInList).Should(HaveCount(20))
			Expect(query.Fill("nexus")).To(Succeed())
			Eventually(phonesInList).Should(HaveCount(1))
			Expect(query.Fill("motorola")).To(Succeed()) // Note: Fill clears automatically
			Eventually(phonesInList).Should(HaveCount(8))
		})

		It("should be possible to control phone order via the drop down select box", func() {

			phoneNameColumn := page.Find("ul.phones").AllByName("phone-name")
			query := page.FindByName("query")
			selected := page.Find("select")
Beispiel #20
0
				for i := 0; i < 104; i++ {
					resourceVersions = append(resourceVersions, atc.Version{"version": strconv.Itoa(i)})
				}

				pipelineDB.SaveResourceVersions(resourceConfig, resourceVersions)
			})

			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))

			})
		})
Beispiel #21
0
					},
					Payload: "hello this is a payload",
				})
			})

			It("can abort the build", func() {
				// homepage -> job detail w/build info
				Expect(page.Navigate(homepage())).To(Succeed())
				Authenticate(page, "admin", "password")

				title, err := page.Title()
				Ω(err).ShouldNot(HaveOccurred())
				Ω(title).Should(Equal(fmt.Sprintf("%s - Concourse", atc.DefaultPipelineName)))

				Eventually(page.FindByLink("job-name")).Should(BeFound())
				Expect(page.FindByLink("job-name").Click()).To(Succeed())

				// job detail w/build info -> abort build
				Expect(page).Should(HaveURL(withPath(fmt.Sprintf("jobs/job-name/builds/%d", build.ID))))
				Expect(page.Find("h1")).To(HaveText(fmt.Sprintf("job-name #%d", build.ID)))

				Expect(page.Find(".js-abortBuild").Click()).To(Succeed())
				Expect(page).Should(HaveURL(withPath(fmt.Sprintf("jobs/job-name/builds/%d", build.ID))))

				Eventually(page.Find("#page-header.aborted")).Should(BeFound())
				Eventually(page.Find(".js-abortBuild")).ShouldNot(BeFound())
			})
		})
	})
})
Beispiel #22
0
func (u User) LogoutOf(page *agouti.Page) {
	Expect(page.Find("#logout-btn").Click()).To(Succeed())
	Eventually(Expect(page).To(HaveURL(u.testEnvVars.LoginURL + "login")))
}
Beispiel #23
0
				})

				Expect(sqlDB.FinishBuild(build.ID, db.StatusSucceeded)).To(Succeed())
			})

			It("can view the resource", 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())
				Expect(page.FindByLink("job-name").Click()).To(Succeed())

				// job detail w/build info -> job detail
				Eventually(page).Should(HaveURL(withPath(fmt.Sprintf("jobs/job-name/builds/%d", build.ID))))
				Eventually(page.Find("h1")).Should(HaveText(fmt.Sprintf("job-name #%d", build.ID)))
				Expect(page.Find("h1 a").Click()).To(Succeed())
				Eventually(page).Should(HaveURL(withPath("jobs/job-name")))

				// job-detail pausing
				Eventually(page.Find("#job-state.btn-pause")).Should(BeFound())
				Expect(page.Find("#job-state.btn-pause").Click()).To(Succeed())
				Eventually(page.Find("#job-state.btn-pause.enabled")).Should(BeFound())
				Eventually(page.Find("#job-state.btn-pause.disabled")).ShouldNot(BeFound())

				page.Refresh()

				Eventually(page.Find("#job-state.btn-pause.enabled")).Should(BeFound())
				Eventually(page.Find("#job-state.btn-pause.disabled")).ShouldNot(BeFound())

				Expect(page.Navigate(homepage())).To(Succeed())
Beispiel #24
0
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}
}
Beispiel #25
0
func itShouldBehaveLikeAPage(name string, newPage pageFunc) {
	Describe("integration test for "+name, func() {
		var (
			page      *agouti.Page
			server    *httptest.Server
			submitted bool
		)

		BeforeEach(func() {
			server = httptest.NewServer(http.HandlerFunc(func(response http.ResponseWriter, request *http.Request) {
				if request.Method == "POST" {
					submitted = true
				}
				html, _ := ioutil.ReadFile("test_page.html")
				response.Write(html)
			}))

			var err error
			page, err = newPage()
			Expect(err).NotTo(HaveOccurred())

			Expect(page.Size(640, 480)).To(Succeed())
			Expect(page.Navigate(server.URL)).To(Succeed())
		})

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

		Describe("Selection interactions", func() {
			It("should support asserting on element identity", func() {
				By("asserting on an element's existence", func() {
					Expect(page.Find("header")).To(BeFound())
					Expect(page.Find("header")).To(HaveCount(1))
					Expect(page.Find("not-a-header")).NotTo(BeFound())
				})

				By("comparing two selections for equality", func() {
					Expect(page.Find("#some_element")).To(EqualElement(page.FindByXPath("//div[@class='some-element']")))
				})
			})

			It("should support selecting elements", func() {
				By("finding an element by selection index", func() {
					Expect(page.All("option").At(0)).To(HaveText("first option"))
					Expect(page.All("select").At(1).First("option")).To(HaveText("third option"))
				})

				By("finding an element by chained selectors", func() {
					Expect(page.Find("header").Find("h1")).To(HaveText("Title"))
					Expect(page.Find("header").FindByXPath("//h1")).To(HaveText("Title"))
				})

				By("finding an element by link text", func() {
					Expect(page.FindByLink("Click Me").Attribute("href")).To(HaveSuffix("#new_page"))
				})

				By("finding an element by label text", func() {
					Expect(page.FindByLabel("Some Label")).To(HaveAttribute("value", "some labeled value"))
					Expect(page.FindByLabel("Some Container Label")).To(HaveAttribute("value", "some embedded value"))
				})

				By("finding an element by button text", func() {
					Expect(page.FindByButton("Some Button")).To(HaveAttribute("name", "some button name"))
					Expect(page.FindByButton("Some Input Button")).To(HaveAttribute("type", "button"))
					Expect(page.FindByButton("Some Submit Button")).To(HaveAttribute("type", "submit"))
				})

				By("finding an element by class", func() {
					Expect(page.FindByClass("some-element")).To(HaveAttribute("id", "some_element"))
				})

				By("finding an element by ID", func() {
					Expect(page.FindByID("some_element")).To(HaveAttribute("class", "some-element"))
				})

				By("finding multiple elements", func() {
					Expect(page.All("select").All("option")).To(BeVisible())
					Expect(page.All("h1,h2")).NotTo(BeVisible())
				})
			})

			It("should support retrieving element properties", func() {
				By("asserting on element text", func() {
					Expect(page.Find("header")).To(HaveText("Title"))
					Expect(page.Find("header")).NotTo(HaveText("Not-Title"))
					Expect(page.Find("header")).To(MatchText("T.+e"))
					Expect(page.Find("header")).NotTo(MatchText("X.+e"))
				})

				By("asserting on whether elements are active", func() {
					Expect(page.Find("#labeled_field")).NotTo(BeActive())
					Expect(page.Find("#labeled_field").Click()).To(Succeed())
					Expect(page.Find("#labeled_field")).To(BeActive())
				})

				By("asserting on element attributes", func() {
					Expect(page.Find("#some_checkbox")).To(HaveAttribute("type", "checkbox"))
				})

				By("asserting on element CSS", func() {
					Expect(page.Find("#some_element")).To(HaveCSS("color", "rgba(0, 0, 255, 1)"))
					Expect(page.Find("#some_element")).To(HaveCSS("color", "rgb(0, 0, 255)"))
					Expect(page.Find("#some_element")).To(HaveCSS("color", "blue"))
				})

				By("asserting on whether elements are selected", func() {
					Expect(page.Find("#some_checkbox")).NotTo(BeSelected())
					Expect(page.Find("#some_selected_checkbox")).To(BeSelected())
				})

				By("asserting on element visibility", func() {
					Expect(page.Find("header h1")).To(BeVisible())
					Expect(page.Find("header h2")).NotTo(BeVisible())
				})

				By("asserting on whether elements are enabled", func() {
					Expect(page.Find("#some_checkbox")).To(BeEnabled())
					Expect(page.Find("#some_disabled_checkbox")).NotTo(BeEnabled())
				})
			})

			It("should support element actions", func() {
				By("clicking on an element", func() {
					checkbox := page.Find("#some_checkbox")
					Expect(checkbox.Click()).To(Succeed())
					Expect(checkbox).To(BeSelected())
					Expect(checkbox.Click()).To(Succeed())
					Expect(checkbox).NotTo(BeSelected())
				})

				By("double-clicking on an element", func() {
					selection := page.Find("#double_click")
					Expect(selection.DoubleClick()).To(Succeed())
					Expect(selection).To(HaveText("double-click success"))
				})

				By("filling out an element", func() {
					Expect(page.Find("#some_input").Fill("some other value")).To(Succeed())
					Expect(page.Find("#some_input")).To(HaveAttribute("value", "some other value"))
				})

				// NOTE: PhantomJS regression causes crash on file upload
				if name != "PhantomJS" {
					By("uploading a file", func() {
						Expect(page.Find("#file_picker").UploadFile("test_page.html")).To(Succeed())
						var result string
						Expect(page.RunScript("return document.getElementById('file_picker').value;", nil, &result)).To(Succeed())
						Expect(result).To(HaveSuffix("test_page.html"))
					})
				}

				By("checking and unchecking a checkbox", func() {
					checkbox := page.Find("#some_checkbox")
					Expect(checkbox.Uncheck()).To(Succeed())
					Expect(checkbox).NotTo(BeSelected())
					Expect(checkbox.Check()).To(Succeed())
					Expect(checkbox).To(BeSelected())
					Expect(checkbox.Uncheck()).To(Succeed())
					Expect(checkbox).NotTo(BeSelected())
				})

				By("selecting an option by text", func() {
					selection := page.Find("#some_select")
					Expect(selection.All("option").At(1)).NotTo(BeSelected())
					Expect(selection.Select("second option")).To(Succeed())
					Expect(selection.All("option").At(1)).To(BeSelected())
				})

				By("submitting a form", func() {
					Expect(page.Find("#some_form").Submit()).To(Succeed())
					Eventually(func() bool { return submitted }).Should(BeTrue())
				})
			})
		})

		Describe("Page interactions", func() {
			It("should support retrieving page properties", func() {
				Expect(page).To(HaveTitle("Page Title"))
				Expect(page).To(HaveURL(server.URL + "/"))
				Expect(page.HTML()).To(ContainSubstring("<h1>Title</h1>"))
			})

			It("should support JavaScript", func() {
				By("waiting for page JavaScript to take effect", func() {
					Expect(page.Find("#some_element")).NotTo(HaveText("some text"))
					Eventually(page.Find("#some_element"), "4s").Should(HaveText("some text"))
					Consistently(page.Find("#some_element")).Should(HaveText("some text"))
				})

				// NOTE: disabled due to recent Firefox regression with passing args
				if name != "Firefox" {
					By("executing provided JavaScript", func() {
						arguments := map[string]interface{}{"elementID": "some_element"}
						var result string
						Expect(page.RunScript("return document.getElementById(elementID).innerHTML;", arguments, &result)).To(Succeed())
						Expect(result).To(Equal("some text"))
					})
				}
			})

			It("should support taking screenshots", func() {
				Expect(page.Screenshot(".test.screenshot.png")).To(Succeed())
				defer os.Remove(".test.screenshot.png")
				file, _ := os.Open(".test.screenshot.png")
				_, err := png.Decode(file)
				Expect(err).NotTo(HaveOccurred())
			})

			It("should support links and navigation", func() {
				By("clicking on a link", func() {
					Expect(page.FindByLink("Click Me").Click()).To(Succeed())
					Expect(page.URL()).To(ContainSubstring("#new_page"))
				})

				By("navigating through browser history", func() {
					Expect(page.Back()).To(Succeed())
					Expect(page.URL()).NotTo(ContainSubstring("#new_page"))
					Expect(page.Forward()).To(Succeed())
					Expect(page.URL()).To(ContainSubstring("#new_page"))
				})

				By("refreshing the page", func() {
					checkbox := page.Find("#some_checkbox")
					Expect(checkbox.Check()).To(Succeed())
					Expect(page.Refresh()).To(Succeed())
					Expect(checkbox).NotTo(BeSelected())
				})
			})

			// NOTE: browsers besides PhantomJS do not support JavaScript logs
			if name == "PhantomJS" {
				It("should support retrieving logs", func() {
					Eventually(page).Should(HaveLoggedInfo("some log"))
					Expect(page).NotTo(HaveLoggedError())
					Eventually(page, "4s").Should(HaveLoggedError("ReferenceError: Can't find variable: doesNotExist\n  (anonymous function)"))
				})
			}

			It("should support switching frames", func() {
				By("switching to an iframe", func() {
					Expect(page.Find("#frame").SwitchToFrame()).To(Succeed())
					Expect(page.Find("body")).To(MatchText("Example Domain"))
				})

				// NOTE: PhantomJS does not support Page.SwitchToParentFrame
				if name != "PhantomJS" {
					By("switching back to the default frame by referring to the parent frame", func() {
						Expect(page.SwitchToParentFrame()).To(Succeed())
						Expect(page.Find("body")).NotTo(MatchText("Example Domain"))
					})

					Expect(page.Find("#frame").SwitchToFrame()).To(Succeed())
				}

				By("switching back to the default frame by referring to the root frame", func() {
					Expect(page.SwitchToRootFrame()).To(Succeed())
					Expect(page.Find("body")).NotTo(MatchText("Example Domain"))
				})
			})

			It("should support switching windows", func() {
				Expect(page.Find("#new_window").Click()).To(Succeed())
				Expect(page).To(HaveWindowCount(2))

				By("switching windows", func() {
					Expect(page.SwitchToWindow("new window")).To(Succeed())
					Expect(page.Find("header")).NotTo(BeFound())
					Expect(page.NextWindow()).To(Succeed())
					Expect(page.Find("header")).To(BeFound())
				})

				By("closing windows", func() {
					Expect(page.CloseWindow()).To(Succeed())
					Expect(page).To(HaveWindowCount(1))
				})
			})

			// NOTE: PhantomJS does not support popup boxes
			if name != "PhantomJS" {
				It("should support popup boxes", func() {
					By("interacting with alert popups", func() {
						Expect(page.Find("#popup_alert").Click()).To(Succeed())
						Expect(page).To(HavePopupText("some alert"))
						Expect(page.ConfirmPopup()).To(Succeed())
					})

					By("interacting with confirm boxes", func() {
						var confirmed bool

						Expect(page.Find("#popup_confirm").Click()).To(Succeed())

						Expect(page.ConfirmPopup()).To(Succeed())
						Expect(page.RunScript("return confirmed;", nil, &confirmed)).To(Succeed())
						Expect(confirmed).To(BeTrue())

						Expect(page.Find("#popup_confirm").Click()).To(Succeed())

						Expect(page.CancelPopup()).To(Succeed())
						Expect(page.RunScript("return confirmed;", nil, &confirmed)).To(Succeed())
						Expect(confirmed).To(BeFalse())
					})

					By("interacting with prompt boxes", func() {
						var promptText string

						Expect(page.Find("#popup_prompt").Click()).To(Succeed())

						Expect(page.EnterPopupText("banana")).To(Succeed())
						Expect(page.ConfirmPopup()).To(Succeed())
						Expect(page.RunScript("return promptText;", nil, &promptText)).To(Succeed())
						Expect(promptText).To(Equal("banana"))
					})
				})
			}

			It("should support manipulating and retrieving cookies", func() {
				Expect(page.SetCookie(&http.Cookie{Name: "webdriver-test-cookie", Value: "webdriver value"})).To(Succeed())
				cookies, err := page.GetCookies()
				Expect(err).NotTo(HaveOccurred())
				cookieNames := []string{cookies[0].Name, cookies[1].Name}
				Expect(cookieNames).To(ConsistOf("webdriver-test-cookie", "browser-test-cookie"))
				Expect(page.DeleteCookie("browser-test-cookie")).To(Succeed())
				Expect(page.GetCookies()).To(HaveLen(1))
				Expect(page.ClearCookies()).To(Succeed())
				Expect(page.GetCookies()).To(HaveLen(0))
			})
		})
	})
}
Beispiel #26
0
func (u User) OpenDropdownOfOrgsOn(page *agouti.Page) {
	Eventually(page.Find("#orgs-dropdown-btn")).Should(BeVisible())
	Expect(page.Find("#orgs-dropdown-btn").Click()).To(Succeed())
}
Beispiel #27
0
func testSelection(browserName string, newPage pageFunc) {
	Describe("selection test for "+browserName, func() {
		var (
			page      *agouti.Page
			server    *httptest.Server
			submitted bool
		)

		BeforeEach(func() {
			server = httptest.NewServer(http.HandlerFunc(func(response http.ResponseWriter, request *http.Request) {
				if request.Method == "POST" {
					submitted = true
				}
				html, _ := ioutil.ReadFile("test_page.html")
				response.Write(html)
			}))

			var err error
			page, err = newPage()
			Expect(err).NotTo(HaveOccurred())

			Expect(page.Size(640, 480)).To(Succeed())
			Expect(page.Navigate(server.URL)).To(Succeed())
		})

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

		It("should support asserting on element identity", func() {
			By("asserting on an element's existence", func() {
				Expect(page.Find("header")).To(BeFound())
				Expect(page.Find("header")).To(HaveCount(1))
				Expect(page.Find("not-a-header")).NotTo(BeFound())
			})

			By("comparing two selections for equality", func() {
				Expect(page.Find("#some_element")).To(EqualElement(page.FindByXPath("//div[@class='some-element']")))
				Expect(page.Find("#some_element")).NotTo(EqualElement(page.Find("header")))
			})
		})

		It("should support moving the mouse pointer over a selected element", func() {
			Expect(page.Find("#some_checkbox").MouseToElement()).To(Succeed())
			Expect(page.Click(agouti.SingleClick, agouti.LeftButton)).To(Succeed())
			Expect(page.Find("#some_checkbox")).To(BeSelected())
		})

		It("should support selecting elements", func() {
			By("finding an element by selection index", func() {
				Expect(page.All("option").At(0)).To(HaveText("first option"))
				Expect(page.All("select").At(1).First("option")).To(HaveText("third option"))
			})

			By("finding an element by chained selectors", func() {
				Expect(page.Find("header").Find("h1")).To(HaveText("Title"))
				Expect(page.Find("header").FindByXPath("//h1")).To(HaveText("Title"))
			})

			By("finding an element by link text", func() {
				Expect(page.FindByLink("Click Me").Attribute("href")).To(HaveSuffix("#new_page"))
			})

			By("finding an element by label text", func() {
				Expect(page.FindByLabel("Some Label")).To(HaveAttribute("value", "some labeled value"))
				Expect(page.FindByLabel("Some Container Label")).To(HaveAttribute("value", "some embedded value"))
			})

			By("finding an element by button text", func() {
				Expect(page.FindByButton("Some Button")).To(HaveAttribute("name", "some button name"))
				Expect(page.FindByButton("Some Input Button")).To(HaveAttribute("type", "button"))
				Expect(page.FindByButton("Some Submit Button")).To(HaveAttribute("type", "submit"))
			})

			By("finding an element by name attibute", func() {
				Expect(page.FindByName("some button name")).To(HaveAttribute("name", "some button name"))
			})

			By("finding multiple elements", func() {
				Expect(page.All("select").All("option")).To(BeVisible())
				Expect(page.All("h1,h2")).NotTo(BeVisible())
			})
		})

		It("should support retrieving element properties", func() {
			By("asserting on element text", func() {
				Expect(page.Find("header")).To(HaveText("Title"))
				Expect(page.Find("header")).NotTo(HaveText("Not-Title"))
				Expect(page.Find("header")).To(MatchText("T.+e"))
				Expect(page.Find("header")).NotTo(MatchText("X.+e"))
			})

			By("asserting on whether elements are active", func() {
				Expect(page.Find("#labeled_field")).NotTo(BeActive())
				Expect(page.Find("#labeled_field").Click()).To(Succeed())
				Expect(page.Find("#labeled_field")).To(BeActive())
			})

			By("asserting on element attributes", func() {
				Expect(page.Find("#some_checkbox")).To(HaveAttribute("type", "checkbox"))
			})

			By("asserting on element CSS", func() {
				Expect(page.Find("#some_element")).To(HaveCSS("color", "rgba(0, 0, 255, 1)"))
				Expect(page.Find("#some_element")).To(HaveCSS("color", "rgb(0, 0, 255)"))
				Expect(page.Find("#some_element")).To(HaveCSS("color", "blue"))
			})

			By("asserting on whether elements are selected", func() {
				Expect(page.Find("#some_checkbox")).NotTo(BeSelected())
				Expect(page.Find("#some_selected_checkbox")).To(BeSelected())
			})

			By("asserting on element visibility", func() {
				Expect(page.Find("header h1")).To(BeVisible())
				Expect(page.Find("header h2")).NotTo(BeVisible())
			})

			By("asserting on whether elements are enabled", func() {
				Expect(page.Find("#some_checkbox")).To(BeEnabled())
				Expect(page.Find("#some_disabled_checkbox")).NotTo(BeEnabled())
			})
		})

		It("should support element actions", func() {
			By("clicking on an element", func() {
				checkbox := page.Find("#some_checkbox")
				Expect(checkbox.Click()).To(Succeed())
				Expect(checkbox).To(BeSelected())
				Expect(checkbox.Click()).To(Succeed())
				Expect(checkbox).NotTo(BeSelected())
			})

			By("double-clicking on an element", func() {
				selection := page.Find("#double_click")
				Expect(selection.DoubleClick()).To(Succeed())
				Expect(selection).To(HaveText("double-click success"))
			})

			By("filling out an element", func() {
				Expect(page.Find("#some_input").Fill("some other value")).To(Succeed())
				Expect(page.Find("#some_input")).To(HaveAttribute("value", "some other value"))
			})

			// NOTE: PhantomJS regression causes crash on file upload
			if browserName != "PhantomJS" {
				By("uploading a file", func() {
					Expect(page.Find("#file_picker").UploadFile("test_page.html")).To(Succeed())
					var result string
					Expect(page.RunScript("return document.getElementById('file_picker').value;", nil, &result)).To(Succeed())
					Expect(result).To(HaveSuffix("test_page.html"))
				})
			}

			By("checking and unchecking a checkbox", func() {
				checkbox := page.Find("#some_checkbox")
				Expect(checkbox.Uncheck()).To(Succeed())
				Expect(checkbox).NotTo(BeSelected())
				Expect(checkbox.Check()).To(Succeed())
				Expect(checkbox).To(BeSelected())
				Expect(checkbox.Uncheck()).To(Succeed())
				Expect(checkbox).NotTo(BeSelected())
			})

			By("selecting an option by text", func() {
				selection := page.Find("#some_select")
				Expect(selection.All("option").At(1)).NotTo(BeSelected())
				Expect(selection.Select("second option")).To(Succeed())
				Expect(selection.All("option").At(1)).To(BeSelected())
			})

			By("submitting a form", func() {
				Expect(page.Find("#some_form").Submit()).To(Succeed())
				Eventually(func() bool { return submitted }).Should(BeTrue())
			})
		})
	})
}
Beispiel #28
0
func (u User) SelectOrgFromDropdown(page *agouti.Page, orgName string) {
	Eventually(page.Find("#orgs-dropdown-menu")).Should(BeVisible())
	Expect(page.FindByLink(orgName)).To(BeFound())
	Expect(page.FindByLink(orgName).Click()).To(Succeed())
}
Beispiel #29
0
				sqlDB.SaveBuildEvent(oneOffBuild.ID, event.Log{
					Origin: event.Origin{
						Name:     "origin-name",
						Type:     event.OriginTypeTask,
						Source:   event.OriginSourceStdout,
						Location: location,
					},
					Payload: "hello this is a payload",
				})
			})

			It("can view builds", func() {
				// homepage -> build list
				Expect(page.Navigate(homepage() + "/pipelines/main")).To(Succeed())
				Eventually(page.Find(allBuildsListIcon)).Should(BeFound())

				Authenticate(page, "admin", "password")

				Expect(page.Find(allBuildsListIconLink).Click()).To(Succeed())

				// build list -> one off build detail
				Eventually(page).Should(HaveURL(withPath("/builds")))
				Expect(page.Find("h1")).To(HaveText("builds"))
				Expect(page.Find(firstBuildNumber).Text()).To(ContainSubstring(fmt.Sprintf("%d", oneOffBuild.ID)))
				Expect(page.Find(firstBuildLink).Click()).To(Succeed())

				// one off build detail
				Eventually(page.Find("h1")).Should(HaveText(fmt.Sprintf("build #%d", oneOffBuild.ID)))
				Eventually(page.Find("#build-logs").Text).Should(ContainSubstring("hello this is a payload"))
Beispiel #30
0
	})

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

	It("should receive email", func() {

		By("accessing homepage", func() {
			Expect(page.Navigate("http://localhost/")).To(Succeed())
			Expect(page).To(HaveURL("http://localhost/"))
		})

		By("emulating sending email from remote mail server", func() {

			emailSelection := page.Find("#email")
			email, _ := emailSelection.Text()

			conn, err := net.Dial("tcp", "localhost:25")
			if err != nil {
				log.Fatal(err)
			}

			fmt.Fprintf(conn, "MAIL FROM: user@local\r\n")
			fmt.Fprintf(conn, "RCPT TO: "+email+"\r\n")
			fmt.Fprintf(conn, "DATA\r\n")
			fmt.Fprintf(conn, "Subject: test subject\r\n")
			fmt.Fprintf(conn, "From: user@local\r\n")
			fmt.Fprintf(conn, "Mail body line 1\r\n")
			fmt.Fprintf(conn, ".\r\n")