testnow 0.0.2 → 0.0.3

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: 785b44ff05aea32253420c7f339f2ef6c2074cb3
4
- data.tar.gz: a9e90bb2d7e66c0737b56aa763cfe8a8932339c7
3
+ metadata.gz: 1b843837c244c7dd1d30616b4fa1c7e0cf042b97
4
+ data.tar.gz: 2709a0f8f17c553e0ac342f4bbcbbaa36f2b8819
5
5
  SHA512:
6
- metadata.gz: b382c1f216cc7ba8df7db8ff4c22225c091b00435609d398f982d53f91585137d83293fbf41e305973cb9e7e2f009dd71d35f3d3c5cdfea27aaeaeb7ad7180f0
7
- data.tar.gz: dcdb0bce2406ae80856053fc9cebcfadae16e6de027165379f948e64b8d6526f561a58172a9bc559f16ef731ee795c47975e10aa40e1f29acc3794c4c271d4f6
6
+ metadata.gz: 6c5ca0fbd0be3a2689d6b03b7b8def97f86014640527b36a68189eaed8976b8bc1053422f24d051bd305d3853e07814ad4f046ad985cea8f73ed44c80eb8ea18
7
+ data.tar.gz: 90ad5aa502825bd0df986637edbe6703b9d633db2ac4babba8db6c1d8a961534f07f180b2e71782505b9d424775635ef2767658a14035b104a074bdd5e445525
data/LICENCE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2015-2016 Kaushal Rupani
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,4 @@
1
+ # testnow
2
+
3
+ ###THIS IS A GEM FOR TESTNOW BY OPEX SOFTWARE
4
+ ###IT IS STILL IN THE MAKING
Binary file
Binary file
data/lib/testnow.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  require 'selenium-webdriver'
2
2
  require 'testnow/chrome'
3
3
  require 'testnow/opera'
4
+ require 'testnow/firefox'
4
5
 
5
6
  module TestNow
6
7
 
@@ -18,7 +19,7 @@ module TestNow
18
19
  when "ie"
19
20
  launch_driver_ie
20
21
  else
21
- launch_driver_firefox
22
+ TestNow.launch_driver_firefox
22
23
  end
23
24
  end
24
25
 
@@ -0,0 +1,41 @@
1
+ module TestNow
2
+
3
+ #Firefox browser
4
+ def launch_driver_firefox
5
+ ENV['IS_UPA'] = "false" if ENV['IS_UPA'].nil?
6
+ if ENV['IS_UPA']=="true"
7
+ ENV['HAR_DIR'] = get_tmp_dir if ENV['HAR_DIR'].nil?
8
+ profile = Selenium::WebDriver::Firefox::Profile.new
9
+ profile.add_extension("./data/firebug-2.0.13.xpi")
10
+ profile.add_extension("./data/netExport-0.8.xpi")
11
+ profile['extensions.firebug.currentVersion'] = "2.0.13"
12
+ profile['extensions.firebug.allPagesActivation'] = "on"
13
+ profile['extensions.firebug.defaultPanelName'] = "net"
14
+ profile['extensions.firebug.net.enableSites'] = "true"
15
+ profile['extensions.firebug.netexport.alwaysEnableAutoExport'] = "true"
16
+ profile['extensions.firebug.netexport.showPreview'] = "false"
17
+ profile['extensions.firebug.netexport.defaultLogDir'] = ENV['HAR_DIR'].to_s
18
+ profile['extensions.firebug.netexport.defaultFileName'] = "upaReport.har"
19
+ profile['extensions.firebug.netexport.jsonpCallback'] = "jsonCallback"
20
+ @driver = Selenium::WebDriver.for :firefox, :profile => profile
21
+ else
22
+ @driver = Selenium::WebDriver.for :firefox
23
+ end
24
+ @driver.manage.timeouts.implicit_wait = 30
25
+ @driver.manage.timeouts.page_load = 120
26
+ @driver.manage.window.maximize
27
+ @driver
28
+ end
29
+
30
+ def get_tmp_dir
31
+ case RUBY_PLATFORM
32
+ when /mswin|msys|mingw|cygwin|bccwin|wince|emc/
33
+ return `echo %TEMP%`
34
+ when /darwin|mac os/
35
+ return "/tmp/"
36
+ else
37
+ return "/tmp/"
38
+ end
39
+ end
40
+
41
+ end
data/lib/testnow/opera.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  module TestNow
2
2
 
3
+
3
4
  #Opera browser
4
5
  def launch_driver_opera
5
6
  client = Selenium::WebDriver::Remote::Http::Default.new
@@ -24,6 +25,5 @@ module TestNow
24
25
  else
25
26
  return "/usr/bin/opera"
26
27
  end
27
-
28
28
  end
29
29
  end
@@ -0,0 +1,5 @@
1
+ require 'rspec'
2
+ require 'testnow'
3
+ require 'testnow/firefox'
4
+ require 'rspec/matchers'
5
+ include TestNow
@@ -0,0 +1,48 @@
1
+ require 'spec_helper'
2
+
3
+
4
+ describe "Test TestNow" do
5
+ it "should start chrome" do
6
+ ENV['BROWSER']='chrome'
7
+ driver = TestNow.init
8
+ expect(driver).to be_an_instance_of Selenium::WebDriver::Driver
9
+ expect(driver.inspect.to_s.downcase).to include("chrome")
10
+ driver.quit
11
+ end
12
+
13
+ it "should start opera" do
14
+ ENV['BROWSER']='opera'
15
+ driver = TestNow.init
16
+ expect(driver).to be_an_instance_of Selenium::WebDriver::Driver
17
+ expect(driver.inspect.to_s.downcase).to include("chrome")
18
+ driver.quit
19
+ end
20
+
21
+ it "should start firefox when BROWSER is set" do
22
+ ENV['BROWSER']='firefox'
23
+ driver = TestNow.init
24
+ expect(driver).to be_an_instance_of Selenium::WebDriver::Driver
25
+ expect(driver.inspect.to_s.downcase).to include("firefox")
26
+ driver.quit
27
+ end
28
+
29
+ it "should start firefox as default when BROWSER is not set" do
30
+ driver = TestNow.init
31
+ expect(driver).to be_an_instance_of Selenium::WebDriver::Driver
32
+ expect(driver.inspect.to_s.downcase).to include("firefox")
33
+ driver.quit
34
+ end
35
+
36
+ it "should start firefox with UPA config when HAR_DIR is set" do
37
+ ENV['HAR_DIR']="/Users/KaushalRupani/Downloads/"
38
+ ENV['IS_UPA']="true"
39
+ `rm -f $HAR_DIR*.har`
40
+ driver = TestNow.init
41
+ expect(driver).to be_an_instance_of Selenium::WebDriver::Driver
42
+ expect(driver.inspect.to_s.downcase).to include("firefox")
43
+ sleep(5)
44
+ driver.get("http://google.com")
45
+ expect(`ls $HAR_DIR*.har`).to_not be_nil
46
+ driver.quit
47
+ end
48
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: testnow
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kaushal Rupani
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-25 00:00:00.000000000 Z
11
+ date: 2016-04-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: selenium-webdriver
@@ -24,15 +24,22 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
- description: A simple gem for TestNow
27
+ description: A gem to configure your Ruby Selenium suite for TestNow
28
28
  email: kushrupani@live.com
29
29
  executables: []
30
30
  extensions: []
31
31
  extra_rdoc_files: []
32
32
  files:
33
+ - LICENCE
34
+ - README.md
35
+ - data/firebug-2.0.13.xpi
36
+ - data/netExport-0.8.xpi
33
37
  - lib/testnow.rb
34
38
  - lib/testnow/chrome.rb
39
+ - lib/testnow/firefox.rb
35
40
  - lib/testnow/opera.rb
41
+ - spec/spec_helper.rb
42
+ - spec/testnow/testnow_spec.rb
36
43
  homepage: https://github.com/krupani/testnow
37
44
  licenses:
38
45
  - MIT