dom_glancy 0.1.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +1 -3
- data/CHANGELOG.md +5 -0
- data/Gemfile +1 -2
- data/README.md +69 -2
- data/app/assets/javascripts/application.js +7 -1
- data/app/assets/stylesheets/dom_glancy.css +19 -3
- data/app/controllers/dom_glancy_controller.rb +15 -15
- data/app/views/dom_glancy/index.html.erb +15 -10
- data/app/views/dom_glancy/path_config.html.erb +3 -3
- data/app/views/dom_glancy/show.html.erb +4 -4
- data/app/views/layouts/dom_glancy.html.erb +7 -7
- data/dom_glancy.gemspec +2 -2
- data/lib/dom_glancy/analysis.rb +108 -108
- data/lib/dom_glancy/configuration.rb +22 -0
- data/lib/dom_glancy/dom_glancy.rb +110 -96
- data/lib/dom_glancy/engine.rb +4 -0
- data/lib/dom_glancy/locations.rb +10 -43
- data/lib/dom_glancy/svg.rb +45 -43
- data/lib/dom_glancy/version.rb +1 -1
- data/lib/dom_glancy.rb +5 -1
- data/test/selenium/mapping_test.rb +14 -14
- data/test/selenium/viewer_test.rb +4 -9
- data/test/selenium_test_helper.rb +86 -85
- data/test/test_app/Gemfile +0 -2
- data/test/test_app/Rakefile +3 -0
- data/test/test_app/app/views/layouts/local.html.erb +2 -3
- data/test/test_app/config/application.rb +29 -0
- data/test/test_app/config/boot.rb +6 -0
- data/test/test_app/config/environment.rb +2 -0
- data/test/test_app/config/initializers/dom_glancy_initializer.rb +8 -4
- data/test/test_app/config.ru +2 -29
- data/test/test_app/script/rails +6 -0
- data/test/test_helper.rb +5 -7
- data/test/test_helpers/location_helpers.rb +23 -21
- data/test/test_objects/test_objects.rb +40 -42
- data/test/unit/analysis_test.rb +9 -10
- data/test/unit/{kracker_test.rb → dom_glancy_test.rb} +20 -21
- data/test/unit/element_test.rb +8 -8
- data/test/unit/location_test.rb +8 -7
- metadata +25 -13
- data/lib/dom_glancy/rails/engine.rb +0 -7
- data/test/test_app/config/database.yml +0 -13
- data/test/test_app/test_app.rb +0 -30
- data/test/test_helpers/kracker_class_for_stubbing.rb +0 -3
@@ -1,121 +1,135 @@
|
|
1
1
|
module DomGlancy
|
2
|
-
|
2
|
+
class DomGlancy
|
3
|
+
def page_map_same?(test_root)
|
4
|
+
purge_old_files_before_test(test_root)
|
3
5
|
|
4
|
-
|
5
|
-
|
6
|
+
result, msg = map_current_file(test_root)
|
7
|
+
return [result, msg] unless result
|
6
8
|
|
7
|
-
|
8
|
-
|
9
|
+
result, msg = master_file_exists?(test_root)
|
10
|
+
return [result, msg] unless result
|
9
11
|
|
10
|
-
|
11
|
-
|
12
|
+
result, msg, current_data = read_map_file(DomGlancy.current_filename(test_root))
|
13
|
+
return [result, msg] unless result
|
12
14
|
|
13
|
-
|
14
|
-
|
15
|
+
result, msg, master_data = read_map_file(DomGlancy.master_filename(test_root))
|
16
|
+
return [result, msg] unless result
|
15
17
|
|
16
|
-
|
17
|
-
return [result, msg] unless result
|
18
|
+
analysis_data = analyze(master_data, current_data, test_root)
|
18
19
|
|
19
|
-
|
20
|
+
msg = make_analysis_failure_report(analysis_data)
|
21
|
+
result = analysis_data[:same]
|
20
22
|
|
21
|
-
|
22
|
-
result = analysis_data[:same]
|
23
|
+
File.delete DomGlancy.current_filename(test_root) if result
|
23
24
|
|
24
|
-
|
25
|
+
[result, msg]
|
26
|
+
end
|
25
27
|
|
26
|
-
[result, msg]
|
27
|
-
end
|
28
28
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
29
|
+
def read_map_file(filename)
|
30
|
+
results = [true, '', nil]
|
31
|
+
begin
|
32
|
+
results[2] = YAML::load( File.open( filename ) )
|
33
|
+
rescue Exception => e
|
34
|
+
results = [false, "Error reading data from file: #{filename}", nil]
|
35
|
+
end
|
36
|
+
|
37
|
+
results
|
35
38
|
end
|
36
39
|
|
37
|
-
|
38
|
-
|
40
|
+
def map_current_file(test_root)
|
41
|
+
filename = DomGlancy.current_filename(test_root)
|
39
42
|
|
40
|
-
|
41
|
-
|
43
|
+
result = [true, '']
|
44
|
+
begin
|
45
|
+
data = perform_mapping_operation.to_yaml
|
46
|
+
File.open(filename, 'w') { |file| file.write(data) }
|
47
|
+
rescue Exception => e
|
48
|
+
result = [false, "map current file error: #{e.message}"]
|
49
|
+
end
|
42
50
|
|
43
|
-
|
44
|
-
begin
|
45
|
-
data = perform_mapping_operation.to_yaml
|
46
|
-
File.open(filename, 'w') { |file| file.write(data) }
|
47
|
-
rescue Exception => e
|
48
|
-
result = [false, "map current file error: #{e.message}"]
|
51
|
+
result
|
49
52
|
end
|
50
53
|
|
51
|
-
|
52
|
-
|
54
|
+
def resize_browser_for_scrollbar
|
55
|
+
original_dimensions = Capybara.current_session.driver.browser.manage.window.size
|
56
|
+
width = Capybara.current_session.evaluate_script('window.innerWidth - document.documentElement.clientWidth').to_i
|
53
57
|
|
54
|
-
|
55
|
-
|
56
|
-
js = <<-JS
|
57
|
-
var dom_glancy = {
|
58
|
-
|
59
|
-
treeUp: function() {
|
60
|
-
var treeWalker = document.createTreeWalker(
|
61
|
-
document.body,
|
62
|
-
NodeFilter.SHOW_ELEMENT,
|
63
|
-
{ acceptNode: function(node) { return NodeFilter.FILTER_ACCEPT; } },
|
64
|
-
false
|
65
|
-
);
|
66
|
-
|
67
|
-
var nodeList = [];
|
68
|
-
|
69
|
-
while(treeWalker.nextNode()){
|
70
|
-
var cn = treeWalker.currentNode;
|
71
|
-
var node_details = {
|
72
|
-
"height" : cn.clientHeight,
|
73
|
-
"width" : cn.clientWidth,
|
74
|
-
"id" : cn.id,
|
75
|
-
"tag" : cn.tagName,
|
76
|
-
"class" : cn.className,
|
77
|
-
//"html" : cn.innerHTML,
|
78
|
-
"top" : cn.offsetTop,
|
79
|
-
"left" : cn.offsetLeft,
|
80
|
-
"visible" : dom_glancy.isVisible(cn)
|
81
|
-
}
|
82
|
-
nodeList.push(node_details);
|
83
|
-
}
|
84
|
-
|
85
|
-
return(nodeList);
|
86
|
-
},
|
87
|
-
|
88
|
-
isVisible: function(elem) {
|
89
|
-
return elem.offsetWidth > 0 || elem.offsetHeight > 0;
|
90
|
-
}
|
91
|
-
};
|
92
|
-
return dom_glancy.treeUp();
|
93
|
-
JS
|
94
|
-
|
95
|
-
page.driver.browser.execute_script(js)
|
96
|
-
end
|
58
|
+
Capybara.current_session.driver.browser.manage.window.resize_to(original_dimensions.width + width, original_dimensions.height) if width > 0
|
97
59
|
|
98
|
-
|
99
|
-
filename = DomGlancy.master_filename(test_root)
|
100
|
-
result = File.exist?(filename)
|
101
|
-
msg = result ? '' : make_missing_master_failure_report(test_root)
|
102
|
-
[result, msg]
|
103
|
-
end
|
60
|
+
result = yield
|
104
61
|
|
105
|
-
|
106
|
-
msg = ["\n------- DOM Comparison Failure ------"]
|
107
|
-
msg << "Master file does not exist. To make a new master from"
|
108
|
-
msg << "the current page, use this command:"
|
109
|
-
msg << "\t#{blessing_copy_string(test_root)}"
|
110
|
-
msg<< "-------------------------------------"
|
62
|
+
Capybara.current_session.driver.browser.manage.window.resize_to(original_dimensions.width, original_dimensions.height) if width > 0
|
111
63
|
|
112
|
-
|
113
|
-
|
64
|
+
result
|
65
|
+
end
|
114
66
|
|
115
|
-
|
116
|
-
|
67
|
+
def perform_mapping_operation
|
68
|
+
page_map_js = <<-JS
|
69
|
+
var dom_glancy = {
|
70
|
+
|
71
|
+
treeUp: function() {
|
72
|
+
var treeWalker = document.createTreeWalker(
|
73
|
+
document.body,
|
74
|
+
NodeFilter.SHOW_ELEMENT,
|
75
|
+
{ acceptNode: function(node) { return NodeFilter.FILTER_ACCEPT; } },
|
76
|
+
false
|
77
|
+
);
|
78
|
+
|
79
|
+
var nodeList = [];
|
80
|
+
|
81
|
+
while(treeWalker.nextNode()){
|
82
|
+
var cn = treeWalker.currentNode;
|
83
|
+
var node_details = {
|
84
|
+
"height" : cn.clientHeight,
|
85
|
+
"width" : cn.clientWidth,
|
86
|
+
"id" : cn.id,
|
87
|
+
"tag" : cn.tagName,
|
88
|
+
"class" : cn.className,
|
89
|
+
"top" : cn.offsetTop,
|
90
|
+
"left" : cn.offsetLeft,
|
91
|
+
"visible" : dom_glancy.isVisible(cn)
|
92
|
+
}
|
93
|
+
nodeList.push(node_details);
|
94
|
+
}
|
95
|
+
|
96
|
+
return(nodeList);
|
97
|
+
},
|
98
|
+
|
99
|
+
isVisible: function(elem) {
|
100
|
+
return elem.offsetWidth > 0 || elem.offsetHeight > 0;
|
101
|
+
}
|
102
|
+
};
|
103
|
+
return dom_glancy.treeUp();
|
104
|
+
JS
|
105
|
+
|
106
|
+
resize_browser_for_scrollbar do
|
107
|
+
Capybara.current_session.driver.browser.execute_script(page_map_js)
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
def master_file_exists?(test_root)
|
112
|
+
filename = DomGlancy.master_filename(test_root)
|
113
|
+
result = File.exist?(filename)
|
114
|
+
msg = result ? '' : make_missing_master_failure_report(test_root)
|
115
|
+
[result, msg]
|
116
|
+
end
|
117
|
+
|
118
|
+
def make_missing_master_failure_report(test_root)
|
119
|
+
msg = ["\n------- DOM Comparison Failure ------"]
|
120
|
+
msg << "Master file does not exist. To make a new master from"
|
121
|
+
msg << "the current page, use this command:"
|
122
|
+
msg << "\t#{blessing_copy_string(test_root)}"
|
123
|
+
msg<< "-------------------------------------"
|
117
124
|
|
118
|
-
|
119
|
-
|
125
|
+
msg.join("\n")
|
126
|
+
end
|
127
|
+
|
128
|
+
def purge_old_files_before_test(test_root)
|
129
|
+
File.delete DomGlancy.current_filename(test_root) if File.exist?(DomGlancy.current_filename(test_root))
|
130
|
+
|
131
|
+
filename_pattern = File.join(::DomGlancy.configuration.diff_file_location, "#{test_root}__*__diff.yaml")
|
132
|
+
Dir[filename_pattern].each { |file| file.delete(file) if File.exist?(file) }
|
133
|
+
end
|
120
134
|
end
|
121
135
|
end
|
data/lib/dom_glancy/locations.rb
CHANGED
@@ -1,49 +1,16 @@
|
|
1
1
|
module DomGlancy
|
2
|
+
class DomGlancy
|
2
3
|
|
3
|
-
|
4
|
-
|
5
|
-
|
4
|
+
def self.master_filename(test_root)
|
5
|
+
File.join(::DomGlancy.configuration.master_file_location, "#{test_root}_master.yaml")
|
6
|
+
end
|
6
7
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
def self.master_file_location
|
12
|
-
@master_file_location
|
13
|
-
end
|
14
|
-
|
15
|
-
def self.diff_file_location=(location)
|
16
|
-
@diff_file_location = location
|
17
|
-
end
|
18
|
-
|
19
|
-
def self.diff_file_location
|
20
|
-
@diff_file_location
|
21
|
-
end
|
22
|
-
|
23
|
-
def self.current_file_location=(location)
|
24
|
-
@current_file_location = location
|
25
|
-
end
|
8
|
+
def self.current_filename(test_root)
|
9
|
+
File.join(::DomGlancy.configuration.current_file_location, "#{test_root}.yaml")
|
10
|
+
end
|
26
11
|
|
27
|
-
|
28
|
-
|
12
|
+
def self.diff_filename(test_root)
|
13
|
+
File.join(::DomGlancy.configuration.diff_file_location, "#{test_root}_diff.html")
|
14
|
+
end
|
29
15
|
end
|
30
|
-
|
31
|
-
def self.create_comparison_directories
|
32
|
-
::FileUtils.mkdir_p(@master_file_location)
|
33
|
-
::FileUtils.mkdir_p(@diff_file_location)
|
34
|
-
::FileUtils.mkdir_p(@current_file_location)
|
35
|
-
end
|
36
|
-
|
37
|
-
def self.master_filename(test_root)
|
38
|
-
File.join(self.master_file_location, "#{test_root}_master.yaml")
|
39
|
-
end
|
40
|
-
|
41
|
-
def self.current_filename(test_root)
|
42
|
-
File.join(self.current_file_location, "#{test_root}.yaml")
|
43
|
-
end
|
44
|
-
|
45
|
-
def self.diff_filename(test_root)
|
46
|
-
File.join(self.diff_file_location, "#{test_root}_diff.html")
|
47
|
-
end
|
48
|
-
|
49
16
|
end
|
data/lib/dom_glancy/svg.rb
CHANGED
@@ -1,71 +1,73 @@
|
|
1
1
|
module DomGlancy
|
2
|
+
class DomGlancy
|
3
|
+
def generate_svg(rectangles)
|
4
|
+
width, height = get_window_size_from_rectangles(rectangles)
|
5
|
+
s = svg_start(width, height)
|
2
6
|
|
3
|
-
|
4
|
-
|
5
|
-
|
7
|
+
rectangles.each do |rectangle|
|
8
|
+
rectangle_string = " <rect id='#{rectangle[:js_id]}' x = '#{rectangle['left']}' y = '#{rectangle['top']}' width = '#{rectangle['width']}' height = '#{rectangle['height']}' fill = '#{rectangle[:fill]}' stroke = '#{rectangle[:stroke]}' stroke-width = '#{rectangle[:stroke_width]}' fill-opacity = '#{rectangle[:opacity]}' />\n"
|
9
|
+
s += rectangle_string
|
10
|
+
end
|
6
11
|
|
7
|
-
|
8
|
-
|
9
|
-
s += rectangle_string
|
12
|
+
s += svg_end
|
13
|
+
s += "\n"
|
10
14
|
end
|
11
15
|
|
12
|
-
|
13
|
-
|
14
|
-
|
16
|
+
def get_window_size_from_rectangles(rectangles)
|
17
|
+
width = 0
|
18
|
+
height = 0
|
15
19
|
|
16
|
-
|
17
|
-
|
18
|
-
|
20
|
+
rectangles.each do |rectangle|
|
21
|
+
rectangle_right = rectangle['left'].to_i + rectangle['width'].to_i
|
22
|
+
rectangle_bottom = rectangle['top'].to_i + rectangle['height'].to_i
|
23
|
+
width = rectangle_right if rectangle_right > width
|
24
|
+
height = rectangle_bottom if rectangle_bottom > height
|
25
|
+
end
|
19
26
|
|
20
|
-
|
21
|
-
rectangle_right = rectangle['left'].to_i + rectangle['width'].to_i
|
22
|
-
rectangle_bottom = rectangle['top'].to_i + rectangle['height'].to_i
|
23
|
-
width = rectangle_right if rectangle_right > width
|
24
|
-
height = rectangle_bottom if rectangle_bottom > height
|
27
|
+
[width, height]
|
25
28
|
end
|
26
29
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
s << " <!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'>"
|
33
|
-
s << " <svg version = '1.1' width='#{width}px' height='#{height}px' border='2px' style='background-color:#FFFFFF;border:1px solid black;'>"
|
34
|
-
s << ''
|
30
|
+
def svg_start(width, height)
|
31
|
+
s = ["<?xml version='1.0' standalone='no'?>"]
|
32
|
+
s << " <!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'>"
|
33
|
+
s << " <svg version = '1.1' width='#{width}px' height='#{height}px' border='2px' style='background-color:#FFFFFF;border:1px solid black;'>"
|
34
|
+
s << ''
|
35
35
|
|
36
|
-
|
37
|
-
|
36
|
+
s.join("\n")
|
37
|
+
end
|
38
38
|
|
39
|
-
|
40
|
-
|
41
|
-
|
39
|
+
def svg_end
|
40
|
+
s = [' </svg>']
|
41
|
+
s << ''
|
42
42
|
|
43
|
-
|
44
|
-
|
43
|
+
s.join("\n")
|
44
|
+
end
|
45
45
|
|
46
|
-
|
47
|
-
|
46
|
+
def format__not_in_master
|
47
|
+
{
|
48
48
|
:stroke => 'blue',
|
49
49
|
:fill => 'white',
|
50
50
|
:stroke_width => '1',
|
51
51
|
:opacity => '0.5'
|
52
|
-
|
53
|
-
|
52
|
+
}
|
53
|
+
end
|
54
54
|
|
55
|
-
|
56
|
-
|
55
|
+
def format__not_in_current
|
56
|
+
{
|
57
57
|
:stroke => 'red',
|
58
58
|
:fill => 'white',
|
59
59
|
:stroke_width => '1',
|
60
60
|
:opacity => '0.5'
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
61
|
+
}
|
62
|
+
end
|
63
|
+
|
64
|
+
def format__same_but_different
|
65
|
+
{
|
65
66
|
:stroke => 'orange',
|
66
67
|
:fill => 'white',
|
67
68
|
:stroke_width => '1',
|
68
69
|
:opacity => '0.5'
|
69
|
-
|
70
|
+
}
|
71
|
+
end
|
70
72
|
end
|
71
73
|
end
|
data/lib/dom_glancy/version.rb
CHANGED
data/lib/dom_glancy.rb
CHANGED
@@ -1,7 +1,11 @@
|
|
1
|
-
require '
|
1
|
+
require 'kramdown'
|
2
|
+
require 'capybara'
|
3
|
+
|
4
|
+
require 'dom_glancy/engine' if defined?(Rails)
|
2
5
|
require 'dom_glancy/dom_glancy'
|
3
6
|
require 'dom_glancy/version'
|
4
7
|
require 'dom_glancy/element'
|
5
8
|
require 'dom_glancy/analysis'
|
6
9
|
require 'dom_glancy/locations'
|
7
10
|
require 'dom_glancy/svg'
|
11
|
+
require 'dom_glancy/configuration'
|
@@ -1,13 +1,13 @@
|
|
1
1
|
require 'selenium_test_helper'
|
2
2
|
|
3
|
-
class MappingTest <
|
3
|
+
class MappingTest < SeleniumTestCase
|
4
4
|
|
5
5
|
def test_full_mapping__same
|
6
6
|
visit_index
|
7
7
|
|
8
8
|
map_current_page_and_save_as_master('dom_glancy_index')
|
9
9
|
|
10
|
-
same, msg = page_map_same?('dom_glancy_index')
|
10
|
+
same, msg = @dom_glancy.page_map_same?('dom_glancy_index')
|
11
11
|
|
12
12
|
assert same, msg
|
13
13
|
assert_artifacts_on_same('dom_glancy_index')
|
@@ -15,7 +15,7 @@ class MappingTest < DomGlancy::SeleniumTestCase
|
|
15
15
|
|
16
16
|
def test_mapping__no_master
|
17
17
|
visit_index
|
18
|
-
same, msg = page_map_same?('poop')
|
18
|
+
same, msg = @dom_glancy.page_map_same?('poop')
|
19
19
|
refute same, msg
|
20
20
|
assert_match 'Master file does not exist', msg, 'the missing master error message'
|
21
21
|
end
|
@@ -27,14 +27,14 @@ class MappingTest < DomGlancy::SeleniumTestCase
|
|
27
27
|
|
28
28
|
add_centered_element('Back In Black')
|
29
29
|
|
30
|
-
same, msg = page_map_same?('dom_glancy_index')
|
30
|
+
same, msg = @dom_glancy.page_map_same?('dom_glancy_index')
|
31
31
|
|
32
32
|
refute same, msg
|
33
33
|
|
34
34
|
index_page = visit_index
|
35
35
|
|
36
36
|
assert_equal 1, index_page.files.count, 'number of difference files'
|
37
|
-
assert_match '
|
37
|
+
assert_match 'dom_glancy_index', index_page.files.first.text, 'file name displayed'
|
38
38
|
|
39
39
|
index_page.files.first.find('a').click
|
40
40
|
show_page = PageObjects::DomGlancy::ShowPage.new
|
@@ -56,21 +56,21 @@ class MappingTest < DomGlancy::SeleniumTestCase
|
|
56
56
|
|
57
57
|
remove_about_element
|
58
58
|
|
59
|
-
same, msg = page_map_same?('dom_glancy_index')
|
59
|
+
same, msg = @dom_glancy.page_map_same?('dom_glancy_index')
|
60
60
|
|
61
61
|
refute same, msg
|
62
62
|
|
63
63
|
index_page = visit_index
|
64
64
|
|
65
65
|
assert_equal 1, index_page.files.count, 'number of difference files'
|
66
|
-
assert_match '
|
66
|
+
assert_match 'dom_glancy_index', index_page.files.first.text, 'file name displayed'
|
67
67
|
|
68
68
|
index_page.files.first.find('a').click
|
69
69
|
show_page = PageObjects::DomGlancy::ShowPage.new
|
70
70
|
|
71
|
-
assert_equal 0,
|
72
|
-
assert_equal 7,
|
73
|
-
assert_equal
|
71
|
+
assert_equal 0, show_page.not_master.count, 'elements listed as not in master'
|
72
|
+
assert_equal 7, show_page.not_current.count, 'elements listed as not in current'
|
73
|
+
assert_equal 11, show_page.changed.count, 'elements listed as changed'
|
74
74
|
|
75
75
|
assert_artifacts_on_difference('dom_glancy_index')
|
76
76
|
|
@@ -83,7 +83,7 @@ class MappingTest < DomGlancy::SeleniumTestCase
|
|
83
83
|
|
84
84
|
map_current_page_and_save_as_master('test_page')
|
85
85
|
|
86
|
-
same, msg = page_map_same?('test_page')
|
86
|
+
same, msg = @dom_glancy.page_map_same?('test_page')
|
87
87
|
|
88
88
|
assert same, msg
|
89
89
|
|
@@ -101,7 +101,7 @@ class MappingTest < DomGlancy::SeleniumTestCase
|
|
101
101
|
|
102
102
|
resize_browser(w, h)
|
103
103
|
|
104
|
-
same, msg = page_map_same?('test_page')
|
104
|
+
same, msg = @dom_glancy.page_map_same?('test_page')
|
105
105
|
|
106
106
|
refute same, msg
|
107
107
|
|
@@ -111,8 +111,8 @@ class MappingTest < DomGlancy::SeleniumTestCase
|
|
111
111
|
private
|
112
112
|
|
113
113
|
def map_current_page_and_save_as_master(test_root)
|
114
|
-
map_data = perform_mapping_operation
|
115
|
-
File.open(DomGlancy.master_filename(test_root), 'w') { |file| file.write(map_data.to_yaml) }
|
114
|
+
map_data = @dom_glancy.perform_mapping_operation
|
115
|
+
File.open(DomGlancy::DomGlancy.master_filename(test_root), 'w') { |file| file.write(map_data.to_yaml) }
|
116
116
|
end
|
117
117
|
|
118
118
|
end
|
@@ -1,26 +1,21 @@
|
|
1
1
|
require 'selenium_test_helper'
|
2
2
|
|
3
|
-
class ViewerTest <
|
3
|
+
class ViewerTest < SeleniumTestCase
|
4
4
|
|
5
5
|
def test_navigation
|
6
6
|
index_page = visit_index
|
7
7
|
config_page = index_page.navigation.config!
|
8
8
|
|
9
|
-
assert_equal DomGlancy.master_file_location.to_s, config_page.master, 'master file location'
|
10
|
-
assert_equal DomGlancy.current_file_location.to_s, config_page.current, 'current file location'
|
11
|
-
assert_equal DomGlancy.diff_file_location.to_s, config_page.diffs, 'difference file location'
|
9
|
+
assert_equal DomGlancy.configuration.master_file_location.to_s, config_page.master, 'master file location'
|
10
|
+
assert_equal DomGlancy.configuration.current_file_location.to_s, config_page.current, 'current file location'
|
11
|
+
assert_equal DomGlancy.configuration.diff_file_location.to_s, config_page.diffs, 'difference file location'
|
12
12
|
|
13
13
|
new_page = config_page.navigation.new_page!
|
14
14
|
assert page.has_content?('do not have a corresponding master file in the expected file location'), 'new masters page content.'
|
15
15
|
|
16
|
-
# Don't have TeamCity integration right now.
|
17
|
-
# artifacts_page = new_page.navigation.artifacts!
|
18
|
-
# assert page.has_content?('TeamCity Artifacts'), 'artifacts page needs some content.'
|
19
|
-
|
20
16
|
about_page = new_page.navigation.about!
|
21
17
|
assert page.has_content?('Add this line to your'), 'about page line from README.md'
|
22
18
|
|
23
19
|
index_page = about_page.navigation.home!
|
24
20
|
end
|
25
|
-
|
26
21
|
end
|