scoutui 2.0.0 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +10 -0
  3. data/.rspec +2 -0
  4. data/.travis.yml +4 -0
  5. data/CODE_OF_CONDUCT.md +13 -0
  6. data/Gemfile +4 -0
  7. data/LICENSE.txt +21 -0
  8. data/README.md +154 -0
  9. data/Rakefile +6 -0
  10. data/bin/console +14 -0
  11. data/bin/scoutui_driver.rb +22 -0
  12. data/bin/setup +7 -0
  13. data/examples/ex1/commands.holidays.yml +45 -0
  14. data/examples/ex1/commands.yml +25 -0
  15. data/examples/ex1/test-example.sh +38 -0
  16. data/examples/ex1/test.config.json +16 -0
  17. data/examples/ex2/commands.yml +35 -0
  18. data/examples/ex2/page_model.json +28 -0
  19. data/examples/ex2/test-example.sh +39 -0
  20. data/examples/ex2/test.config.json +25 -0
  21. data/lib/scoutui.rb +8 -0
  22. data/lib/scoutui/appmodel/q_model.rb +82 -0
  23. data/lib/scoutui/base/assertions.rb +62 -0
  24. data/lib/scoutui/base/q_accounts.rb +52 -0
  25. data/lib/scoutui/base/q_applitools.rb +127 -0
  26. data/lib/scoutui/base/q_browser.rb +185 -0
  27. data/lib/scoutui/base/q_form.rb +261 -0
  28. data/lib/scoutui/base/test_scout.rb +120 -0
  29. data/lib/scoutui/base/test_settings.rb +109 -0
  30. data/lib/scoutui/base/user_vars.rb +108 -0
  31. data/lib/scoutui/base/visual_test_framework.rb +574 -0
  32. data/lib/scoutui/commands/click_object.rb +45 -0
  33. data/lib/scoutui/commands/command.rb +56 -0
  34. data/lib/scoutui/commands/commands.rb +133 -0
  35. data/lib/scoutui/commands/exists_alert.rb +54 -0
  36. data/lib/scoutui/commands/fill_form.rb +56 -0
  37. data/lib/scoutui/commands/jsalert/action_jsalert.rb +58 -0
  38. data/lib/scoutui/commands/mouse_over.rb +31 -0
  39. data/lib/scoutui/commands/pause.rb +26 -0
  40. data/lib/scoutui/commands/select_object.rb +54 -0
  41. data/lib/scoutui/commands/strategy.rb +202 -0
  42. data/lib/scoutui/commands/submit_form.rb +44 -0
  43. data/lib/scoutui/commands/type.rb +44 -0
  44. data/lib/scoutui/commands/update_url.rb +45 -0
  45. data/lib/scoutui/commands/utils.rb +128 -0
  46. data/lib/scoutui/commands/verify_element.rb +198 -0
  47. data/lib/scoutui/commands/verify_form.rb +26 -0
  48. data/lib/scoutui/eyes/eye_factory.rb +76 -0
  49. data/lib/scoutui/eyes/eye_scout.rb +239 -0
  50. data/lib/scoutui/logger/log_mgr.rb +105 -0
  51. data/lib/scoutui/navigator.rb +24 -0
  52. data/lib/scoutui/utils/utils.rb +352 -0
  53. data/lib/scoutui/version.rb +3 -0
  54. data/scoutui.gemspec +35 -0
  55. metadata +54 -2
  56. data/pkg/scoutui-2.0.0.gem +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3d9e2fde17563fe12087fe92fa34af5062ea17dd
4
- data.tar.gz: 4bdfcf36e43d291564a99daab5b09528debd3ffe
3
+ metadata.gz: fe92fe04ff0e9daf07a6521ad4ba598f5e32bd5c
4
+ data.tar.gz: 104265382adad105254e0b5e9e357fc53b60e27f
5
5
  SHA512:
6
- metadata.gz: 8fe016fcdb86bdbbd0e9017b9dbf4813b3a3bbb099815da656f7b336c8f3a29056b67cc9537fbd2c1b571b17eb83b23e13e3ac72709bf1a26e688da1fcea08f5
7
- data.tar.gz: e2941891d3e702659b569bc37ca4afbe5804ccda571a1494c55c36ece98fb15cdd18e04545d7e4a57c45ce5d5211b3b13144fff9ff921a83c493fdf1052ddd61
6
+ metadata.gz: 93e4bd0ada8f1a6d10ac5016ddf1b296c2df39aa721a2a3cabfc3a7088f9cd193800b971ff70a5f5fcdbc4b8b82ef4026a53c94191919cb0c6dbfbb885bf0e01
7
+ data.tar.gz: f5c2df5075a7db4c9ae19b9bc898af64fa0b5e0d61d374a0270574fa0e58066a48a5b564ca4ba84593c1708ec3f65a4c03d72bcb2858134f2a85d5ba6449d317
data/.gitignore ADDED
@@ -0,0 +1,10 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /spec/reports/
8
+ /test/gateway
9
+ /tmp/
10
+ /test/travel
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.travis.yml ADDED
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.0.0
4
+ before_install: gem install bundler -v 1.10.6
@@ -0,0 +1,13 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
4
+
5
+ We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
6
+
7
+ Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
8
+
9
+ Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
10
+
11
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
12
+
13
+ This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in scoutui.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 H20Dragon - Application Model Based Automation Framework
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,154 @@
1
+ # ScoutUI
2
+
3
+ The ScoutUI gem provides a simple, yet powerful visual test framework to help you and your team with an automated visual test strategy.
4
+
5
+ This project is still in beta, but working - the version '1.0.0' will be the first "stable" release.
6
+
7
+ ## What does ScoutUI provide?
8
+
9
+ 1. Command driven test strategy using YAML and/or JSON format
10
+ 2. Integration with Applitools Eyes (this is optional - only if you have an Eyes account)
11
+ 3. Leverage Selenium/WebDriver without having to hassle with it (e.g. APIs) to conduct browser testing
12
+ a. UI Regression with Eyes
13
+ b. Functional Testing
14
+
15
+
16
+ ## Helpful Links
17
+ YouTube
18
+
19
+ ## Installation
20
+
21
+ ### Prerequisites
22
+ 1. Ruby 1.9.3 or higher
23
+ 2. Following Gems
24
+ a. selenium-webdriver
25
+ b. eyes_selenium
26
+ c. yaml
27
+ d. json
28
+ e. testmgr
29
+
30
+ Add this line to your application's Gemfile:
31
+
32
+ ```ruby
33
+ gem 'scoutui'
34
+ ```
35
+
36
+ And then execute:
37
+
38
+ $ bundle
39
+
40
+ Or install it yourself as:
41
+
42
+ $ gem install scoutui
43
+
44
+ To run unit tests:
45
+
46
+ $ bundle exec rake spec
47
+
48
+ To run a specific unit test:
49
+
50
+ $ rspec spec/json_spec.rb
51
+
52
+ ## Running the examples
53
+
54
+ Following these steps to get started.
55
+
56
+ 1. Goto the ./examples/ex1 folder
57
+ 2. Set the environment variable APPLITOOLS_API_KEY with your key
58
+
59
+ export APPLITOOLS_API_KEY=[__YOUR_APPLITOOLS_KEY__]
60
+ 3. Set the environment variable SCOUTUI_BIN to the ScoutUi driver
61
+
62
+ export SCOUTUI_BIN=[ScoutUI Path]\bin\scoutui_driver.rb
63
+
64
+ 4. Run the script 'test-simple.sh'
65
+ 5. Goto your Applitools account and look for the test named "Graceland"
66
+
67
+ ## Development
68
+
69
+
70
+ ## Creating Tests
71
+
72
+ ### Command files
73
+ Command files are currently supported only in YAML format, however JSON will be supported very shortly (by 10/28/2015).
74
+
75
+ Each stanza of a Command YAML file starts with the key *page*
76
+
77
+ page:
78
+
79
+ and can have the following *properties*
80
+
81
+ name: <String>
82
+ used to name the snapshot stored in Applitools.
83
+ The string, representing the logical name of this window/validation point will appear in the test result report.
84
+
85
+ url: <Full URL>
86
+
87
+ specifies the URL to load right before the snapshot
88
+
89
+ url: <Partial URL>
90
+
91
+
92
+ specifies the partial URL that should be concatenated to the provided host, before the snapshot
93
+
94
+
95
+ skip: <true | false>
96
+ specifies whether or not to skip this stanza (if skip is omitted, it's default value is true)
97
+
98
+
99
+
100
+
101
+ #### Example 1. Navigate to a URL then take snapshots after user actions (e.g. mouse events).
102
+
103
+ page:
104
+ name: Home
105
+ url: http://www.elvis.com
106
+ ---
107
+ page:
108
+ name: Mouseover Music
109
+ action: mouseover(//ul[@class="nav-primary"]//a[text()="Music"])
110
+ snapit: true
111
+ ---
112
+ page:
113
+ name: Studio Albums
114
+ action: click(//*[@id='music']//a[text()="Studio Albums"])
115
+ snapit: true
116
+ expected:
117
+ wait: //footer[@id="footer"]//a[@class="credits"]
118
+
119
+
120
+ ## A word about using Applitools Eyes
121
+
122
+ 1. CSS Transitions
123
+
124
+ This method is to make the floating bar not captured when scrolling the screen in force-to-fullscreen mode.
125
+ use_css_transition
126
+ 2. Viewport
127
+
128
+ You can obtain the viewport by resizing the browser, to a desired width/height, then obtain the following values using Javascript console.
129
+
130
+ window.innerWidth
131
+ window.innerHeight
132
+
133
+
134
+ ## To run from the command line
135
+
136
+ ruby test_script.rb --config <your test settings JSON file> --eyes
137
+
138
+
139
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
140
+
141
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
142
+
143
+ ## Contributing
144
+
145
+ Bug reports and pull requests are welcome on GitHub at https://github.com/h20dragon/scoutui.
146
+
147
+ ## License
148
+
149
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
150
+
151
+ ## To do
152
+
153
+ Advanced Test Reporting
154
+
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "scoutui"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
@@ -0,0 +1,22 @@
1
+ #!/usr/bin/ruby
2
+ require_relative '../lib/scoutui'
3
+
4
+ require 'logger'
5
+
6
+ ##
7
+ # --file <Yaml>
8
+ # --host <String>
9
+ # --lang <String>
10
+ # --title <Applitools Title>
11
+ # --browser <chrome|firefox|ie>
12
+
13
+
14
+ nav = Scoutui::Navigator.new(Scoutui::Utils::TestUtils.instance.parseCommandLine())
15
+
16
+
17
+ runner = Scoutui::Base::TestScout.new(nav)
18
+
19
+ runner.start()
20
+ runner.report()
21
+
22
+
data/bin/setup ADDED
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,45 @@
1
+ page:
2
+ name: Home
3
+ url: http://www.elvis.com
4
+ expected:
5
+ wait: frame()
6
+ ---
7
+ page:
8
+ action: click(//a[@class='ui-dialog-titlebar-close ui-corner-all' and @role='button']/i[@class='icon-cms-thinx')
9
+ snapit: false
10
+ ---
11
+ page:
12
+ name: Mouseover Music
13
+ action: mouseover(//a[@class='ParentNav' and @title='Holidays'])
14
+ snapit: true
15
+ ---
16
+ page:
17
+ name: Studio Albums
18
+ action: click(//a[@title='Holiday Decorations'])
19
+ snapit: true
20
+ expected:
21
+ wait: //*[@id='PagingViewAll']
22
+ ---
23
+ page:
24
+ name: Hot Items
25
+ action: mouseover(//*[@id='NavList']//a[@title='Hot Items'])
26
+ snapit: true
27
+ expected:
28
+ wait: //div[@class='SubmenuContainer']/a[@title='New Arrivals']
29
+ ---
30
+ page:
31
+ name: New Arrivals
32
+ action: click(//div[@class='SubmenuContainer']/a[@title='New Arrivals'])
33
+ snapit: true
34
+ expected:
35
+ wait: //*[@id='PagingViewAll']
36
+ ---
37
+ page:
38
+ skip: true
39
+ action: type(//input[@id="password"], ${password})
40
+ ---
41
+ page:
42
+ skip: true
43
+ action: click(//input[@id="btnSubmit"])
44
+ expected:
45
+ avatar: //img[@id="cnqr-profile-avatar"]
@@ -0,0 +1,25 @@
1
+ page:
2
+ name: Home
3
+ url: http://www.elvis.com
4
+ ---
5
+ page:
6
+ name: Mouseover Music
7
+ action: mouseover(//ul[@class="nav-primary"]//a[text()="Music"])
8
+ snapit: true
9
+ ---
10
+ page:
11
+ name: Studio Albums
12
+ action: click(//*[@id='music']//a[text()="Studio Albums"])
13
+ snapit: true
14
+ expected:
15
+ xyz: //footer[@id="footer"]//a[@class="credits"]
16
+ ---
17
+ page:
18
+ skip: true
19
+ action: type(//input[@id="password"], ${password})
20
+ ---
21
+ page:
22
+ skip: true
23
+ action: click(//input[@id="btnSubmit"])
24
+ expected:
25
+ avatar: //img[@id="cnqr-profile-avatar"]
@@ -0,0 +1,38 @@
1
+ #/bin/bash
2
+ ##
3
+ # Description
4
+ # This test script overrides the provided title and appname (if provided in the test config. file)
5
+ #
6
+ # Set the APPLITOOLS_API_KEY environment variable with your key.
7
+ #
8
+ # export APPLITOOLS_API_KEY="__YOUR_KEY_HERE__"
9
+ ##
10
+
11
+ # Specify browser under test (chrome, firefox, ie, safari)
12
+ BUT=chrome
13
+
14
+ # Specify the title and appName needed by Applitools
15
+ # Specify the title and appName needed by Applitools
16
+ ## NOTE: If the test configuration file specifies the title and app, it is superseded by the
17
+ ## command line options.
18
+ TITLE=Graceland
19
+ APP=Elvis
20
+
21
+ # Specify the test configuration file
22
+ TEST_CFG="./test.config.json"
23
+
24
+ ##
25
+ # content
26
+ # strict
27
+ # exact
28
+ # layyout
29
+ ##
30
+ MATCH_TYPE="layout"
31
+ EYES="--eyes"
32
+ #EYES=
33
+
34
+ # The following command line parameters will override provided title and appName (if provided in test config file)
35
+ $SCOUTUI_BIN --config $TEST_CFG --browser $BUT $EYES --app $APP --title $TITLE --match $MATCH_TYPE --debug
36
+
37
+ # The following
38
+ # $SCOUTUI_BIN --config $TEST_CFG --eyes --match $MATCH_TYPE --browser $BUT
@@ -0,0 +1,16 @@
1
+ {
2
+ "Project": "Example",
3
+ "Version": "1.00",
4
+ "Description": "Example1 - http://www.Elvis.com",
5
+
6
+ "browser": "chrome",
7
+
8
+ "eyes": {
9
+ "title": "Example1",
10
+ "viewport": "1700x718",
11
+ "app": "09-26"
12
+ },
13
+
14
+ "host": "http://www.elvis-presley.com",
15
+ "dut": "./commands.holidays.yml"
16
+ }
@@ -0,0 +1,35 @@
1
+ page:
2
+ name: Home
3
+ description: Navigate to a specified URL and wait until the expected elements are present
4
+ url: http://www.carmax.com
5
+ expected:
6
+ wait: page(home).get(cars4sale)
7
+ wait2: page(home).get(whyCarMax)
8
+ ---
9
+ page:
10
+ name: Mouseover View Tickets
11
+ action: mouseover(page(home).get(whyCarMax))
12
+ snapit: true
13
+ ---
14
+ page:
15
+ name: Click - specified by Alias
16
+ action: click(${WhyCarMax})
17
+ snapit: true
18
+ ---
19
+ page:
20
+ skip: true
21
+ action: pause
22
+ ---
23
+ page:
24
+ skip: false
25
+ name: Click on Input
26
+ action: click(page(main_nav).get(search_input))
27
+ snapit: true
28
+ ---
29
+ page:
30
+ action: type(page(main_nav).get(search_input), ${Search_Me})
31
+ ---
32
+ page:
33
+ action: click(page(main_nav).get(search_btn))
34
+ expected:
35
+ wait: //input[@id='zip']