marta 0.28017 → 0.28675
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +14 -1
- data/lib/marta/data/custom-xpath.html +2 -0
- data/lib/marta/data/custom-xpath.js +5 -0
- data/lib/marta/data/element-confirm.html +2 -0
- data/lib/marta/data/element-confirm.js +6 -1
- data/lib/marta/data/element.html +2 -0
- data/lib/marta/data/element.js +5 -0
- data/lib/marta/data/page.html +2 -2
- data/lib/marta/data/page.js +5 -0
- data/lib/marta/data/style.css +5 -2
- data/lib/marta/dialogs.rb +7 -10
- data/lib/marta/json_2_class.rb +5 -14
- data/lib/marta/options_and_paths.rb +2 -2
- data/lib/marta/public_methods.rb +31 -0
- data/lib/marta/version.rb +1 -1
- data/marta.gemspec +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e2794c78d3cf457b70f2c182df894b205e006ce0
|
4
|
+
data.tar.gz: 79ba7ed2850da9a2fe982d0d9a29efdb24b4d2e9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 06d88ae0acaa491e65d737bee32ac5313b25972378168cc1e603f61f1b367b0dc514cf820d9d875f74f3d4335fb4bcc46781cb27bead760c675f1d14731072cb
|
7
|
+
data.tar.gz: a1a85fdd3f13c95c437893bc103d764a52235ed0b10867d697cde2ac6b72c4e6b6d89e9e830aa15fc291f610c6c541d1cf61a5b0c5de010d4ba5f5c6cd86f613
|
data/README.md
CHANGED
@@ -95,6 +95,19 @@ dance_with learn: true or false
|
|
95
95
|
your_page.method_edit('newelementname')
|
96
96
|
```
|
97
97
|
|
98
|
+
**Q: And what if I want to create page and define element without learn mode? For example in the middle of a debug session.**
|
99
|
+
|
100
|
+
*A Code in learn mode =*
|
101
|
+
```ruby
|
102
|
+
test_page = TestPage.new # Will show page creation dialog
|
103
|
+
test_page.magic_button # Will show magic_button locating dialog
|
104
|
+
```
|
105
|
+
*is totally identical to code without learn mode =*
|
106
|
+
```ruby
|
107
|
+
test_page = SmartPage.new("TestPage")
|
108
|
+
test_page.method_edit("magic_button")
|
109
|
+
```
|
110
|
+
|
98
111
|
**Q: Sometimes Marta is looking for lost element for too long. What can I do about it?**
|
99
112
|
|
100
113
|
*A: You can set tolerancy parameter. Larger = longer*
|
@@ -193,7 +206,7 @@ g_page.search "I am in love with selenium."
|
|
193
206
|
|
194
207
|
**Q: What else?**
|
195
208
|
|
196
|
-
*A: Nothing. Marta is under development. Her version is 0.
|
209
|
+
*A: Nothing. Marta is under development. Her version is 0.28675 only. And I am not a professional developer. But I am training her on new tricks.*
|
197
210
|
|
198
211
|
## Internal Design
|
199
212
|
|
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
<div id=marta_s_text martaclass=marta_smthing>
|
4
4
|
<h2 id=marta_main_title martaclass=marta_smthing></h2>
|
5
|
+
<p martaclass=marta_smthing>If you cannot see all the elements try to move menu down using a button below</p>
|
6
|
+
<input type=button martaclass=marta_smthing id=marta_down onclick=marta_down(); value=DOWN />
|
5
7
|
<p martaclass=marta_smthing>You are about to write your own xpath.</p>
|
6
8
|
<p martaclass=marta_smthing>Use it when element is: invisible, not present, should be found by exact xpath, marta fails to find it.</p>
|
7
9
|
<p martaclass=marta_smthing>Marta will highlight the elements targeted by your xpath. Sometimes it will even show hidden elements.</p>
|
@@ -1,6 +1,8 @@
|
|
1
1
|
<div id=marta_s_everything martaclass=marta_smthing>
|
2
2
|
<div id=marta_s_text martaclass=marta_smthing>
|
3
3
|
<h2 id=marta_main_title martaclass=marta_smthing></h2>
|
4
|
+
<p martaclass=marta_smthing>If you cannot see all the elements try to move menu down using a button below</p>
|
5
|
+
<input type=button martaclass=marta_smthing id=marta_down onclick=marta_down(); value=DOWN />
|
4
6
|
<p martaclass=marta_smthing>You are about to confirm element selection</p>
|
5
7
|
<p martaclass=marta_smthing>Marta highlights elements right now</p>
|
6
8
|
<p martaclass=marta_smthing>If something wrong was found - maybe it is time to talk to the developer?</p>
|
@@ -5,7 +5,7 @@ function marta_confirm(){
|
|
5
5
|
var toClear = document.querySelector("[martaclass=marta_smthing]");
|
6
6
|
toClear.parentNode.removeChild(toClear);
|
7
7
|
marta_confirm_mark = true;
|
8
|
-
marta_result = "
|
8
|
+
marta_result = "4";
|
9
9
|
};
|
10
10
|
|
11
11
|
function marta_click_work(e){};
|
@@ -28,3 +28,8 @@ function marta_add_data() {
|
|
28
28
|
marta_confirm_mark = false;
|
29
29
|
document.getElementById("marta_main_title").innerHTML = old_marta_Data + " elements found for " + marta_what;
|
30
30
|
};
|
31
|
+
|
32
|
+
function marta_down() {
|
33
|
+
var toDown = document.querySelector("[martaclass=marta_div]");
|
34
|
+
toDown.setAttribute("martastyle", "down");
|
35
|
+
}
|
data/lib/marta/data/element.html
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
<div id=marta_s_everything martaclass=marta_smthing>
|
2
2
|
<div id=marta_s_text martaclass=marta_smthing>
|
3
3
|
<h2 id=marta_main_title martaclass=marta_smthing></h2>
|
4
|
+
<p martaclass=marta_smthing>If you cannot see all the elements try to move menu down using a button below</p>
|
5
|
+
<input type=button martaclass=marta_smthing id=marta_down onclick=marta_down(); value=DOWN />
|
4
6
|
<p martaclass=marta_smthing>You are about to define some element</p>
|
5
7
|
<p martaclass=marta_smthing>CLICK to select element. Do not worry nothing will work</p>
|
6
8
|
<p martaclass=marta_smthing>After the click select the attributes of an element and parents</p>
|
data/lib/marta/data/element.js
CHANGED
data/lib/marta/data/page.html
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
<div id=marta_s_everything martaclass=marta_smthing>
|
2
|
-
|
3
2
|
<div id=marta_s_text>
|
4
3
|
<h2 id=marta_main_title></h2>
|
4
|
+
<p>If you cannot see all the elements try to move menu down using a button below</p>
|
5
|
+
<input type=button martaclass=marta_smthing id=marta_down onclick=marta_down(); value=DOWN />
|
5
6
|
<p>You are about to add some vars to the page_object</p>
|
6
7
|
<p>Please use only valid names for ruby vars (no <b>CROCO</b>, <b>special symbols</b>, just <b>some_var</b> or <b>anotherVar</b>)</p>
|
7
8
|
<p>You can use variable in the other one adding: <b>#{@your_var}</b> just like in ruby</p>
|
@@ -13,7 +14,6 @@
|
|
13
14
|
<div id=marta_s_content>
|
14
15
|
<input type=button martaclass=marta_smthing id=marta_more_fields onclick=marta_add_field(); value=Add More />
|
15
16
|
<input type=button martaclass=marta_smthing id=marta_confirm onclick=marta_confirm(); value=Confirm />
|
16
|
-
|
17
17
|
<div id=vars_fileds>
|
18
18
|
<div class=label>Custom vars:</div>
|
19
19
|
<div class=content>
|
data/lib/marta/data/page.js
CHANGED
@@ -36,3 +36,8 @@ function marta_delete_line(line) {
|
|
36
36
|
title.parentNode.removeChild(title);
|
37
37
|
staff.parentNode.removeChild(staff);
|
38
38
|
};
|
39
|
+
|
40
|
+
function marta_down() {
|
41
|
+
var toDown = document.querySelector("[martaclass=marta_div]");
|
42
|
+
toDown.setAttribute("martastyle", "down");
|
43
|
+
}
|
data/lib/marta/data/style.css
CHANGED
@@ -156,11 +156,10 @@ div#marta_s_everything *, div#marta_s_everything {
|
|
156
156
|
div#marta_s_everything h2 {
|
157
157
|
text-align: center;
|
158
158
|
font-size: 20px;}
|
159
|
-
div
|
159
|
+
div[martaclass=marta_div] {
|
160
160
|
position : relative;
|
161
161
|
z-index : 150000;
|
162
162
|
padding: 0;
|
163
|
-
margin: 0;
|
164
163
|
margin: 0px 0px 0px 0px;
|
165
164
|
border: 4px solid rgb(115,115,100);
|
166
165
|
font-size: 14px;
|
@@ -168,6 +167,10 @@ div#marta_s_everything {
|
|
168
167
|
background-color: rgb(230,230,200);
|
169
168
|
color: black;
|
170
169
|
}
|
170
|
+
|
171
|
+
div[martastyle=down] {
|
172
|
+
margin: 100% 0px 0px 0px;
|
173
|
+
}
|
171
174
|
div#marta_s_everything p {text-align: left;
|
172
175
|
margin-left: 20px;}
|
173
176
|
div#marta_s_everything p b {color: red;}
|
data/lib/marta/dialogs.rb
CHANGED
@@ -56,12 +56,13 @@ module Marta
|
|
56
56
|
mass_highlight_turn @mass
|
57
57
|
end
|
58
58
|
@result = ask_for_elements
|
59
|
+
mass_highlight_turn(@mass, false)
|
59
60
|
if @result.class == Hash
|
60
61
|
@attrs = @result
|
62
|
+
elsif @result != '1'
|
63
|
+
xpath_way
|
61
64
|
end
|
62
|
-
mass_highlight_turn(@mass, false)
|
63
65
|
end
|
64
|
-
|
65
66
|
if @result == '1'
|
66
67
|
standart_meth_merge
|
67
68
|
else
|
@@ -85,7 +86,7 @@ module Marta
|
|
85
86
|
# Creating data to save when user suggests a custom xpath
|
86
87
|
def xpath_meth_merge
|
87
88
|
temp = temp_hash
|
88
|
-
temp['meths'][@method_name]['options'] = @
|
89
|
+
temp['meths'][@method_name]['options'] = @attrs['options']
|
89
90
|
@data['meths'].merge!(temp['meths'])
|
90
91
|
@data
|
91
92
|
end
|
@@ -118,10 +119,8 @@ module Marta
|
|
118
119
|
# JS returning '1' when it's done. That is not good
|
119
120
|
# and should be rewrited as soon as possible
|
120
121
|
def finished?
|
121
|
-
if @result == '1'
|
122
|
+
if @result == '1' or @result == '4'
|
122
123
|
true
|
123
|
-
elsif @result == '3'
|
124
|
-
xpath_way
|
125
124
|
else
|
126
125
|
false
|
127
126
|
end
|
@@ -130,15 +129,13 @@ module Marta
|
|
130
129
|
# When user selects xpath way. Marta is doing some work before finish
|
131
130
|
def xpath_way
|
132
131
|
@result = ask_xpath
|
133
|
-
if @result
|
134
|
-
|
135
|
-
else
|
132
|
+
if @result != '2'
|
133
|
+
@attrs = Hash.new
|
136
134
|
@attrs['options'] = @result
|
137
135
|
@mass = get_elements_by_attrs
|
138
136
|
mass_highlight_turn @mass
|
139
137
|
@result = ask_confirmation
|
140
138
|
mass_highlight_turn(@mass, false)
|
141
|
-
finished?
|
142
139
|
end
|
143
140
|
end
|
144
141
|
|
data/lib/marta/json_2_class.rb
CHANGED
@@ -36,24 +36,15 @@ module Marta
|
|
36
36
|
include OptionsAndPaths, ReadWrite
|
37
37
|
|
38
38
|
#
|
39
|
-
# Main class creation method.
|
40
|
-
# a proper initialization.
|
39
|
+
# Main class creation method.
|
41
40
|
#
|
42
|
-
#
|
43
|
-
# useles while not constructed like that. It will be fixed.
|
41
|
+
# SmartPage can be initialized with user data as well
|
44
42
|
def self.create(class_name, data, edit)
|
45
43
|
c = Class.new(SmartPage) do
|
44
|
+
alias_method :old_init, :initialize
|
46
45
|
define_method :initialize do |my_data=data, my_class_name=class_name,
|
47
46
|
will_edit=edit|
|
48
|
-
|
49
|
-
@class_name = class_name
|
50
|
-
@edit_mark = will_edit
|
51
|
-
build_content my_data
|
52
|
-
if will_edit
|
53
|
-
page_edit my_class_name, my_data
|
54
|
-
end
|
55
|
-
# We need optimization here very much!
|
56
|
-
build_content my_data
|
47
|
+
old_init(class_name, my_data, will_edit)
|
57
48
|
end
|
58
49
|
end
|
59
50
|
# We are vanishing previous version of class
|
@@ -122,7 +113,7 @@ module Marta
|
|
122
113
|
end
|
123
114
|
|
124
115
|
def build_var(name, content)
|
125
|
-
if !self.methods.include?(name.to_sym) and (@data['meths'][name]
|
116
|
+
if !self.methods.include?(name.to_sym) and (@data['meths'][name].nil?)
|
126
117
|
self.singleton_class.send(:attr_accessor, name.to_sym)
|
127
118
|
instance_variable_set("@#{name}", process_string(content))
|
128
119
|
else
|
@@ -107,9 +107,9 @@ module Marta
|
|
107
107
|
|
108
108
|
# Defining the place for files to inject to browser
|
109
109
|
def gem_libdir
|
110
|
-
t = ["#{
|
110
|
+
t = ["#{Dir.pwd}/lib/#{Marta::NAME}",
|
111
111
|
"#{Gem.dir}/gems/#{Marta::NAME}-#{Marta::VERSION}/lib/#{Marta::NAME}"]
|
112
|
-
|
112
|
+
File.readable?(t[0])? t[0] : t[1]
|
113
113
|
end
|
114
114
|
|
115
115
|
# Marta knows does she learn or not.
|
data/lib/marta/public_methods.rb
CHANGED
@@ -6,6 +6,37 @@ module Marta
|
|
6
6
|
|
7
7
|
include OptionsAndPaths
|
8
8
|
|
9
|
+
|
10
|
+
#
|
11
|
+
# User can create pageobject class using SmartPage.new
|
12
|
+
#
|
13
|
+
# SmartPage can be created withoud all the data. But in that case
|
14
|
+
# it will be pretty useless until values are provided
|
15
|
+
#
|
16
|
+
# The first argument is a class name. It is a constant like string like
|
17
|
+
# "MyClass". All data provided will be stored in MyClass.json
|
18
|
+
# Once created that way you can call it like MyClass.new.
|
19
|
+
# That argument is totally necessary one
|
20
|
+
#
|
21
|
+
# The second argument is a marta's special data hash. By default =
|
22
|
+
# {"vars"=>{},"meths"=>{}}. You can take an existing json as well.
|
23
|
+
# Notice that rocket like syntax is a must here. It will be changed later
|
24
|
+
#
|
25
|
+
# Third parameter is about to show or not default page creation dialog.
|
26
|
+
# So it can be true or false
|
27
|
+
def initialize(my_class_name, my_data = ({"vars" => {},"meths" => {}}),
|
28
|
+
will_edit = true)
|
29
|
+
@data ||= my_data
|
30
|
+
@class_name ||= my_class_name
|
31
|
+
@edit_mark ||= will_edit
|
32
|
+
build_content my_data
|
33
|
+
if will_edit
|
34
|
+
page_edit my_class_name, my_data
|
35
|
+
end
|
36
|
+
# We need optimization here very much!
|
37
|
+
build_content my_data
|
38
|
+
end
|
39
|
+
|
9
40
|
# User can define a method for example in a middle of a debug session
|
10
41
|
def method_edit(name)
|
11
42
|
method_name = correct_name(name)
|
data/lib/marta/version.rb
CHANGED
data/marta.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.email = ["s_seleznev_qa@hotmail.com"]
|
11
11
|
|
12
12
|
spec.summary = "That will be an another one watir-webdriver wrap"
|
13
|
-
spec.description = "Element location tool for your watir autotests"
|
13
|
+
spec.description = "Element location tool for your watir autotests."
|
14
14
|
spec.homepage = "https://github.com/sseleznevqa/marta"
|
15
15
|
spec.license = "MIT"
|
16
16
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: marta
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.28675'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sergei Seleznev
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-07-
|
11
|
+
date: 2017-07-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -94,7 +94,7 @@ dependencies:
|
|
94
94
|
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
|
-
description: Element location tool for your watir autotests
|
97
|
+
description: Element location tool for your watir autotests.
|
98
98
|
email:
|
99
99
|
- s_seleznev_qa@hotmail.com
|
100
100
|
executables: []
|