marta 0.36788 → 0.37396

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bb9cae36f41b19234de4624d84b15b121e18e2ab
4
- data.tar.gz: 58e97be1e74776026c8fee29675be311ca296b3d
3
+ metadata.gz: 12ec2a504a8d87171ea120513b7ec80d6db61961
4
+ data.tar.gz: c24afb174f328be3221a39274a1cc9ad22a925b7
5
5
  SHA512:
6
- metadata.gz: cc0b3343e92ca8298626fbb314c59c6c2acb35504b530fcbfcfcf2af895dba08ee3ad55320b3c221f0f208d9e921460b61e1968f63ab11242673d95d05129768
7
- data.tar.gz: 37ca26dde66f8db7652fd7adbde7838abd68403ff3e1eb5a6fd4341f48c1b630780e447101980e6dab82d879b62b54f1ff1ce8048005e6dd63fe9c2793a2f931
6
+ metadata.gz: 3d85be37f4bc4ee4911e51f8e26860951975dbbf28ae9dbc063f35a012523056b5a97fe017de0a48b66faac2049cdab43e95a176f0ffca224b5977fa06e9ceaf
7
+ data.tar.gz: 6c5de76ed3e580f77e132d4c4eea9dd6e943a57092a87d46eec4642807e5e454b1e211bfcc516e8176c6ee266ee399545eee60d34f4dfd6726ba30fd15a28477
data/README.md CHANGED
@@ -301,7 +301,7 @@ g_page.search "I am in love with selenium."
301
301
 
302
302
  **Q: What else?**
303
303
 
304
- *A: Nothing. Marta is under development. Her version is 0.36788. All the necessary features are working already but there are tons of things that should be done. And I am not a professional developer.*
304
+ *A: Nothing. Marta is under development. Her version is 0.37396. All the necessary features are working already but there are tons of things that should be done. And I am not a professional developer.*
305
305
 
306
306
  ## Internal Design
307
307
 
@@ -160,6 +160,23 @@
160
160
  "type": "button",
161
161
  "value": "First button"
162
162
  }
163
+ },
164
+ "the_iframe": {
165
+ "granny": {
166
+ },
167
+ "options": {
168
+ "collection": false,
169
+ "granny": "HTML",
170
+ "pappy": "BODY",
171
+ "self": "IFRAME"
172
+ },
173
+ "pappy": {
174
+ },
175
+ "self": {
176
+ "height": "300",
177
+ "src": "/welcome",
178
+ "width": "300"
179
+ }
163
180
  }
164
181
  }
165
182
  }
@@ -0,0 +1,24 @@
1
+ {
2
+ "vars": {
3
+ "path": "",
4
+ "url": ""
5
+ },
6
+ "meths": {
7
+ "github_link": {
8
+ "granny": {
9
+ },
10
+ "options": {
11
+ "collection": false,
12
+ "granny": "HTML",
13
+ "pappy": "BODY",
14
+ "self": "A"
15
+ },
16
+ "pappy": {
17
+ },
18
+ "self": {
19
+ "href": "https://github.com/sseleznevqa/marta",
20
+ "retrieved_by_marta_text": "GITHUB link"
21
+ }
22
+ }
23
+ }
24
+ }
@@ -4,6 +4,23 @@ describe "We will do some dummy things like" do
4
4
  before(:each) do
5
5
  @page = MyTestPage.open_page
6
6
  end
7
+
8
+ context "Angry iframe test" do
9
+ before(:each) do
10
+ @b = engine
11
+ dance_with browser: @page.the_iframe
12
+ end
13
+
14
+ after(:each) do
15
+ dance_with browser: @b
16
+ end
17
+
18
+ it "Looking into iframe" do
19
+ the_iframe = TheIframe.new
20
+ expect(the_iframe.github_link.text).to eq "GITHUB link"
21
+ end
22
+ end
23
+
7
24
  it "touching every single element at the test page" do
8
25
  expect(@page.numbers[1].text).to eq "Two"
9
26
  @page.form_fill
@@ -11,4 +28,5 @@ describe "We will do some dummy things like" do
11
28
  @page.second_button.click
12
29
  expect(@page.title_exact.present?).to be true
13
30
  end
31
+
14
32
  end
data/lib/marta.rb CHANGED
@@ -1,4 +1,12 @@
1
+ require "watir"
2
+ require 'fileutils'
3
+ require 'json'
4
+ require 'webrick'
5
+ require 'socket'
6
+
7
+
1
8
  require "marta/version"
9
+ require "marta/object"
2
10
  require 'marta/public_methods'
3
11
  require 'marta/options_and_paths'
4
12
  require 'marta/read_write'
@@ -13,11 +21,6 @@ require 'marta/simple_element_finder'
13
21
  require 'marta/x_path'
14
22
  require 'marta/page_arithmetic'
15
23
  require 'marta/server'
16
- require "watir"
17
- require 'fileutils'
18
- require 'json'
19
- require 'webrick'
20
- require 'socket'
21
24
 
22
25
 
23
26
  #
@@ -44,18 +47,6 @@ module Marta
44
47
  end
45
48
  end
46
49
 
47
- # That is how Marta connected to the world
48
-
49
- # We will ask user about completely new class
50
- def Object.const_missing(const, *args, &block)
51
- if !SettingMaster.learn_status
52
- raise NameError, "#{const} is not defined."
53
- else
54
- data, data['vars'], data['meths'] = Hash.new, Hash.new, Hash.new
55
- SmartPageCreator.json_2_class(ReaderWriter.file_write(const.to_s, data))
56
- end
57
- end
58
-
59
50
  # Marta is returning an engine (it should be a browser instance)
60
51
  # Watir::Browser.new(:chrome) by default
61
52
  def engine
@@ -69,6 +60,7 @@ module Marta
69
60
  base_url: nil, cold_timeout: nil, port: nil, clear: nil)
70
61
  SettingMaster.clear if clear
71
62
  SettingMaster.set_port port
63
+ # We are always turning the server on in order to show Welcome!
72
64
  SettingMaster.set_server # server should be before browser
73
65
  SettingMaster.set_engine browser # browser should be before learn!
74
66
  SettingMaster.set_learn learn
@@ -2,6 +2,7 @@
2
2
  <title>Example page</title>
3
3
  <body>
4
4
  <h1 id='Title'>Test page</h1>
5
+ <iframe src="/welcome" width=300 height=300></iframe>
5
6
  <form>
6
7
  <input type='text' class='some' placeholder='utka'>
7
8
  <select custom='custom'>
@@ -125,7 +125,13 @@ module Marta
125
125
  while result != true
126
126
  # When Marta can't get a result she is reinjecting her stuff
127
127
  result = MartaServer.wait_user_dialog_response
128
- actual_injection if !result
128
+ # We need double check for iframes here. It should be 100% changed.
129
+ if !result
130
+ result = engine.execute_script("return document.marta_confirm_mark")
131
+ end
132
+ if (!result and !engine.element(id: 'marta_s_everything').exists?)
133
+ actual_injection
134
+ end
129
135
  end
130
136
  run_script("return document.marta_result")
131
137
  end
@@ -39,7 +39,7 @@ function marta_real_send(answer, the_port) {
39
39
  async function refreshData()
40
40
  { console.log("Marta is checking is she on the page");
41
41
 
42
- if ((typeof document.getElementById("marta_s_everything") == undefined) || (document.getElementById("marta_s_everything") == null)){
42
+ if (((typeof document.getElementById("marta_s_everything") == undefined) || (document.getElementById("marta_s_everything") == null)) && (window == top)){
43
43
  console.log("Marta is lost. Asking ruby Marta to do something with the port = " + port);
44
44
  document.xmlHttp = new XMLHttpRequest();
45
45
  var martaUrl = "http://localhost:" + port + "/dialog/not_answer";
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "Marta app",
3
- "version": "0.36788",
3
+ "version": "0.37396",
4
4
  "description": "Messaging from browser to main app",
5
5
  "permissions": ["activeTab", "http://127.0.0.1*/*", "storage"],
6
6
  "background": {
@@ -0,0 +1,12 @@
1
+
2
+ module Marta
3
+ # Constant missing is hijacked!
4
+ def Object.const_missing(const)
5
+ if !SettingMaster.learn_status
6
+ raise NameError, "uninitialized constant #{const}"
7
+ else
8
+ data, data['vars'], data['meths'] = Hash.new, Hash.new, Hash.new
9
+ SmartPageCreator.json_2_class(ReaderWriter.file_write(const.to_s, data))
10
+ end
11
+ end
12
+ end
@@ -147,7 +147,13 @@ module Marta
147
147
  # Marta uses simple rules to set the laearn mode
148
148
  def self.set_learn(value)
149
149
  @@learn = parameter_set(@@learn, value, learn_option)
150
- warn "If browser was not started by Marta. Learn will not work properly"
150
+ if learn_status
151
+ warn "Be carefull. If browser was not started by Marta."\
152
+ " Learn mode will not work properly"
153
+ else
154
+ # We are switching server off if we do not really need it
155
+ SettingMaster.server.server_kill
156
+ end
151
157
  end
152
158
 
153
159
  # Marta uses simple rules to set the tolerancy value
@@ -171,7 +177,7 @@ module Marta
171
177
 
172
178
  # Marta uses simple rule to set the cold timeout
173
179
  def self.set_cold_timeout(value)
174
- parameter_check_and_set(@@cold_timeout, value, 10, Fixnum)
180
+ parameter_check_and_set(@@cold_timeout, value, 10, Integer)
175
181
  end
176
182
 
177
183
  # Marta sets port. If it is not defined and there are number of threads
@@ -183,14 +189,14 @@ module Marta
183
189
  i += 1
184
190
  end
185
191
  end
186
- parameter_check_and_set(@@port, value, 6260 + @@port.size + i, Fixnum)
192
+ parameter_check_and_set(@@port, value, 6260 + @@port.size + i, Integer)
187
193
  end
188
194
 
189
195
  # We are storaging server instance as a setting
190
196
  def self.set_server
191
197
  if SettingMaster.server.nil?
192
198
  @@server[thread_id] = Server::MartaServer.new(SettingMaster.port)
193
- elsif SettingMaster.server.current_port != SettingMaster.port
199
+ elsif !Server::MartaServer.port_check(SettingMaster.port)
194
200
  @@server[thread_id] = Server::MartaServer.new(SettingMaster.port)
195
201
  end
196
202
  end
data/lib/marta/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Marta
2
- VERSION = "0.36788"
2
+ VERSION = "0.37396"
3
3
  NAME = "marta"
4
4
  end
data/marta.gemspec CHANGED
@@ -23,6 +23,7 @@ Gem::Specification.new do |spec|
23
23
  spec.add_development_dependency "rake"
24
24
  spec.add_development_dependency "rspec"
25
25
  spec.add_development_dependency "simplecov"
26
+ spec.add_development_dependency "pry"
26
27
  spec.add_dependency "watir", '>= 6.7.2'
27
28
  spec.add_dependency "json"
28
29
  spec.add_dependency "webrick"
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.36788'
4
+ version: '0.37396'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sergei Seleznev
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-06-26 00:00:00.000000000 Z
11
+ date: 2018-07-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: pry
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: watir
71
85
  requirement: !ruby/object:Gem::Requirement
@@ -127,6 +141,7 @@ files:
127
141
  - bin/setup
128
142
  - example_project/p_object/test_page.rb
129
143
  - example_project/spec/p_object/pageobjects/MartaTestPage.json
144
+ - example_project/spec/p_object/pageobjects/TheIframe.json
130
145
  - example_project/spec/spec_helper.rb
131
146
  - example_project/spec/test_page_spec.rb
132
147
  - example_project/tests_with_learning.sh
@@ -153,8 +168,7 @@ files:
153
168
  - lib/marta/marta_app/background.js
154
169
  - lib/marta/marta_app/content.js
155
170
  - lib/marta/marta_app/manifest.json
156
- - lib/marta/marta_app/marta_app.crx
157
- - lib/marta/marta_app/marta_app.pem
171
+ - lib/marta/object.rb
158
172
  - lib/marta/options_and_paths.rb
159
173
  - lib/marta/page_arithmetic.rb
160
174
  - lib/marta/public_methods.rb
@@ -185,7 +199,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
185
199
  version: '0'
186
200
  requirements: []
187
201
  rubyforge_project:
188
- rubygems_version: 2.5.1
202
+ rubygems_version: 2.6.14
189
203
  signing_key:
190
204
  specification_version: 4
191
205
  summary: That will be an another one watir-webdriver wrap
Binary file
@@ -1,28 +0,0 @@
1
- -----BEGIN PRIVATE KEY-----
2
- MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDxrXsFaSILL75W
3
- 2axSD/fW9nxcvP/jxBgcmbG58oguJ5QVAI45ay0wOBa3z860BDRmYY2ICi8hjIXi
4
- wmlUG3KY8p13pV9oMkWAbi69Z4s+osELP7XYir4BVxjYeU7KTqhsWIh3Cg3DBpMl
5
- j98wzgSPxKW/NaUrInaZjYhW2ZYg9wrjNyc6LRm9Tkl6sPPGRFSSn8c9FxBwq8CT
6
- 2e/x4QsicjkUWbKawIPvb3C4zmyc9QsZlWt3T9yd7ra17FGHB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