-
Notifications
You must be signed in to change notification settings - Fork 0
/
blog-test.rb
36 lines (27 loc) · 1.18 KB
/
blog-test.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
require "selenium-webdriver"
require "rspec"
#TEST: Sign up for blog
describe "Blog application" do
describe "Signup to the blog application" do
it "confirm that a user can successfully signup" do
timestamp = Time.now.to_i
driver = Selenium::WebDriver.for :firefox
#Go to signup form
driver.navigate.to "https://selenium-blog.herokuapp.com/signup"
#Fill out and submit form
username_field = driver.find_element(id: "user_username")
username_field.send_keys("user #{timestamp}")
email_field = driver.find_element(id: "user_email")
email_field.send_keys("user#{timestamp}@test.com")
password_field = driver.find_element(id: "user_password")
password_field.send_keys("password")
submit_button = driver.find_element(id: "submit")
submit_button.click
#Confirm user is signed up sucessfully
banner = driver.find_element(id: "flash_success")
banner_text = banner.text
expect(banner_text).to eq("Welcome to the alpha blog user #{timestamp}")
driver.quit
end
end
end