ada_matcher 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -23,5 +23,6 @@ Gem::Specification.new do |s|
23
23
  s.add_development_dependency "rspec"
24
24
  s.add_development_dependency "watir-webdriver", ">0"
25
25
  s.add_development_dependency "headless"
26
+ s.add_development_dependency "page-object"
26
27
  # s.add_runtime_dependency "rspec"
27
28
  end
@@ -113,7 +113,7 @@ module AdaMatcher
113
113
  # hierarchical sequencing.
114
114
  def htag_hierarchy(page)
115
115
  e = Array.new
116
- page_tags = page.elements.to_a.collect {|e| e.tag_name}
116
+ page_tags = page.elements.to_a.collect {|elem| elem.tag_name}
117
117
 
118
118
  last_htag_num = 0
119
119
  for i in 0..(page_tags.size - 1)
@@ -1,3 +1,3 @@
1
1
  module AdaMatcher
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
@@ -0,0 +1,75 @@
1
+ require 'rubygems'
2
+ require 'ada_matcher'
3
+ require 'page-object'
4
+ require 'watir-webdriver'
5
+ require 'headless'
6
+
7
+ PROJECT_BASE_PATH = File.expand_path File.dirname(__FILE__)
8
+
9
+ class GoodPage
10
+ include PageObject
11
+ end
12
+
13
+ class BadPage
14
+ include PageObject
15
+ end
16
+
17
+
18
+ describe "PageObjectAdaMatcher" do
19
+ before(:all) do
20
+ @headless = Headless.new
21
+ @headless.start
22
+ @browser = Watir::Browser.new
23
+ end
24
+
25
+ after(:all) do
26
+ @browser.close
27
+ @headless.destroy
28
+ end
29
+
30
+ before(:each) do
31
+ end
32
+
33
+ after(:each) do
34
+ end
35
+
36
+ it "should pass ADA compliant page using page-object" do
37
+ @browser.goto "file://#{PROJECT_BASE_PATH}/../resources/good_page.html"
38
+ good_page = GoodPage.new(@browser)
39
+ good_page.should meet_ada_requirements
40
+
41
+ # can also say:
42
+ # good_page.should meet_ada_requirements(:all)
43
+ end
44
+
45
+ it "should fail with bad image tags using page-object" do
46
+ @browser.goto "file://#{PROJECT_BASE_PATH}/../resources/bad_page.html"
47
+ bad_page = BadPage.new(@browser)
48
+ bad_page.should_not meet_ada_requirements(:image_alt)
49
+ end
50
+
51
+ it "should fail with bad link tags using page-object" do
52
+ @browser.goto "file://#{PROJECT_BASE_PATH}/../resources/bad_page.html"
53
+ bad_page = BadPage.new(@browser)
54
+ bad_page.should_not meet_ada_requirements(:link_title)
55
+ end
56
+
57
+ it "should fail with new window links without warnings using page-object" do
58
+ @browser.goto "file://#{PROJECT_BASE_PATH}/../resources/bad_page.html"
59
+ bad_page = BadPage.new(@browser)
60
+ bad_page.should_not meet_ada_requirements(:link_window_warning)
61
+ end
62
+
63
+ it "should fail if H(1-6) tags appear out of sequence using page-object" do
64
+ @browser.goto "file://#{PROJECT_BASE_PATH}/../resources/bad_page.html"
65
+ bad_page = BadPage.new(@browser)
66
+ bad_page.should_not meet_ada_requirements(:htag_hierarchy)
67
+ end
68
+
69
+ it "should fail if a Form field exists without a corresponding Label using page-object" do
70
+ @browser.goto "file://#{PROJECT_BASE_PATH}/../resources/bad_page.html"
71
+ bad_page = BadPage.new(@browser)
72
+ bad_page.should_not meet_ada_requirements(:label_for)
73
+ end
74
+
75
+ end
@@ -8,6 +8,7 @@ describe "AdaMatcher" do
8
8
  @project_base_path = File.expand_path File.dirname(__FILE__) << "../"
9
9
  @headless = Headless.new
10
10
  @headless.start
11
+ # @browser = Watir::Browser.new
11
12
  @browser = Watir::Browser.new
12
13
  end
13
14
 
@@ -44,7 +45,7 @@ describe "AdaMatcher" do
44
45
  @browser.should_not meet_ada_requirements(:link_window_warning)
45
46
  end
46
47
 
47
- it "should fail if H2-H4 tags exist without lower-index H tags" do
48
+ it "should fail if H(1-6) tags appear out of sequence" do
48
49
  @browser.goto "file://#{@project_base_path}/../resources/bad_page.html"
49
50
  @browser.should_not meet_ada_requirements(:htag_hierarchy)
50
51
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 3
9
- version: 0.1.3
8
+ - 4
9
+ version: 0.1.4
10
10
  platform: ruby
11
11
  authors:
12
12
  - Aaron Brown
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2012-02-29 00:00:00 -05:00
17
+ date: 2012-05-19 00:00:00 -04:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -56,6 +56,19 @@ dependencies:
56
56
  version: "0"
57
57
  type: :development
58
58
  version_requirements: *id003
59
+ - !ruby/object:Gem::Dependency
60
+ name: page-object
61
+ prerelease: false
62
+ requirement: &id004 !ruby/object:Gem::Requirement
63
+ none: false
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ segments:
68
+ - 0
69
+ version: "0"
70
+ type: :development
71
+ version_requirements: *id004
59
72
  description: Adds custom rspec matchers that test watir Page objects for ADA compliance
60
73
  email:
61
74
  - aaron@thebrownproject.com
@@ -75,6 +88,7 @@ files:
75
88
  - lib/ada_matcher/version.rb
76
89
  - resources/bad_page.html
77
90
  - resources/good_page.html
91
+ - spec/ada_matcher_pageobject_spec.rb
78
92
  - spec/ada_matcher_spec.rb
79
93
  has_rdoc: true
80
94
  homepage: https://github.com/frenchroasted/ada_matcher