-
Notifications
You must be signed in to change notification settings - Fork 2
/
tapestry-factory.rb
executable file
·56 lines (41 loc) · 1.15 KB
/
tapestry-factory.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/usr/bin/env ruby
$: << "./lib"
require "rspec"
include RSpec::Matchers
require "tapestry"
include Tapestry::Factory
puts Tapestry::VERSION
class Home
include Tapestry
url_is "http://localhost:9292"
p :login_form, id: "open", visible: true
text_field :username, id: "username"
text_field :password
button :login, id: "login-button"
div :message, class: 'notice'
#element :login_form, id: "open", visible: true
#element :username, id: "username"
#element :password
#element :login, id: "login-button"
end
class Navigation
include Tapestry
p :page_list, id: 'navlist'
link :planets, id: 'planets'
image :planet_logo, id: 'planet-logo'
end
Tapestry.set_browser :chrome
on_view(Home)
on(Home) do
@context.login_form.click
@context.username.set "admin"
@context.password(id: 'password').set "admin"
@context.login.click
expect(@context.message.text).to eq('You are now logged in as admin.')
end
on(Navigation) do
@context.page_list.wait_until(&:dom_updated?).click
@context.planets.click
expect(@context.planet_logo.exists?).to be true
end
Tapestry.quit_browser