Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
67034d1
bump version of capybara
mcrmfc Nov 3, 2015
b4f55e2
adding more elaborate wait helpers
mcrmfc Nov 3, 2015
509f964
ensure we use same ruby as forge
mcrmfc Nov 3, 2015
4dc4515
bump major version as introducting backwasrd incompatible api changes
mcrmfc Nov 3, 2015
5b830cf
adding appium support
mcrmfc Nov 4, 2015
b3eca80
Adding poltergeist support
mcrmfc Nov 17, 2015
1ef0709
allow wait to recieve message
mcrmfc Dec 2, 2015
5f4b4c5
add some useful rake tasks
mcrmfc Jan 4, 2016
8a019da
added task for feature documentation
SwatiTabib Jan 11, 2016
da02eb2
changing task desc
SwatiTabib Jan 11, 2016
be2c547
move common code from projects into frameworks gem
mcrmfc Jan 14, 2016
4e9ad02
bug fix
mcrmfc Jan 14, 2016
dd352cf
add task to merge cucumber json reports
mcrmfc Jan 15, 2016
30be334
update name of rerun reports
mcrmfc Jan 15, 2016
5bac6a2
handle case where no rerun json file
mcrmfc Jan 15, 2016
3109d5e
bug fix to json merge
mcrmfc Jan 16, 2016
8653fbb
always register headless drivers even if they are not default
mcrmfc Jan 18, 2016
2ec0767
don't do the cookies and survey hacks if we are running headless
mcrmfc Jan 18, 2016
c537adb
tweak json merge
mcrmfc Jan 19, 2016
e9e11e3
need to take account of scenario outlines
mcrmfc Jan 19, 2016
6101922
add a task to generate a simple red/green report for parallel runs
mcrmfc Jan 20, 2016
74825a9
fix typo
mcrmfc Jan 20, 2016
78d9337
don't concern ourselves with hidden elements
mcrmfc Jan 20, 2016
36a183c
don't autoload monkey patches
mcrmfc Feb 1, 2016
1154f11
updates to allow user specified bundler exec and also support client
mcrmfc Feb 5, 2016
d924fca
add ability to configure features directory when running parallel tests
mcrmfc Mar 1, 2016
e196f86
Added code for closing Music Banner
ankitjain0105 Mar 2, 2016
8a795ef
Merge pull request #2 from bbc/music_banner
ankitjain0105 Mar 2, 2016
85db32f
allow bundle exec override to be more flexible
mcrmfc Mar 24, 2016
6ccd717
change in colour for static html red/green result - requested by swati
mcrmfc Apr 8, 2016
b92f738
Commenting survey pop up
ankitjain0105 Apr 8, 2016
06377de
don't set app host for mechanize
mcrmfc May 18, 2016
7486679
Making changes as per ruby 2.3.0
ankitjain0105 Jun 10, 2016
b50ee2d
Added size changes and timout changes
ankitjain0105 Jun 10, 2016
906cc4a
reverted the size changes
ankitjain0105 Jun 10, 2016
2fee09c
Added survey pop up code again
ankitjain0105 Jun 16, 2016
3e3a2b7
Merge pull request #3 from bbc/music-docker-test
ankitjain0105 Jun 16, 2016
aabe4b5
Commenting survey pop up code again
ankitjain0105 Jun 17, 2016
b9abe95
Merge branch 'master' of github.com:bbc/frameworks-capybara
ankitjain0105 Jun 20, 2016
18a91d1
Changing live condition
ankitjain0105 Sep 6, 2016
47db270
Changing live condition
ankitjain0105 Sep 6, 2016
f968cc5
Merge pull request #4 from bbc/automation_fix_live
ankitjain0105 Sep 6, 2016
9c1fe73
update
SwatiTabib Dec 6, 2016
5b37b64
Update
SwatiTabib Dec 6, 2016
5f64a1b
rubocop fixes
Jul 3, 2017
ebd914a
rubocop fixes
Jul 7, 2017
83ceb9a
Added save screenshot code
Jul 18, 2017
954851b
Merge pull request #6 from bbc/automation-fixes
ankitjain0105 Jul 20, 2017
dfdcf7c
resolving rubocop offenses
SwatiTabib Jul 25, 2017
6dcee28
removing chrome headless driver code
SwatiTabib Jul 26, 2017
a08f5a8
Merge pull request #7 from bbc/rubocop-fixes
SwatiTabib Jul 28, 2017
49959a1
Revert "Rubocop fixes"
SwatiTabib Jul 28, 2017
197456f
Merge pull request #8 from bbc/revert-7-rubocop-fixes
SwatiTabib Jul 28, 2017
77b94f5
removing chrome driver code
SwatiTabib Jul 28, 2017
4aa9864
Merge pull request #9 from bbc/rubocop-fixes
SwatiTabib Jul 28, 2017
15c9023
Revert "Revert "Rubocop fixes""
ankitjain0105 Jul 28, 2017
4090aba
Merge pull request #10 from bbc/revert-8-revert-7-rubocop-fixes
SwatiTabib Jul 28, 2017
c1bd8d1
removing chrome driver code
SwatiTabib Jul 28, 2017
f10354e
removing JS error opt
SwatiTabib Jul 31, 2017
527da2b
setting JS error opt to false
SwatiTabib Aug 1, 2017
f19ee3b
Added new method for a section
Aug 3, 2017
178c57b
Merge pull request #11 from bbc/listen-later-auto
Aug 3, 2017
487d798
Add privileges to spec files to allow deletion on jenkins
Aug 17, 2017
16d25c0
Merge pull request #12 from bbc/workspace-fix
SwatiTabib Aug 17, 2017
2c546e2
Added method for translations
Sep 13, 2017
b30bfc1
Merge pull request #13 from bbc/localisation-code
ankitjain0105 Sep 14, 2017
d23e97f
Added
Sep 20, 2017
bd3b61e
Added few methods
Sep 20, 2017
f0976f9
Added element translation method
Sep 21, 2017
865adf9
Merge pull request #14 from bbc/localisation-code
ankitjain0105 Sep 21, 2017
8673921
downgrading cucumber gem version to 2.4.0 due to failures in parallel…
SwatiTabib Sep 29, 2017
b44b414
Merge pull request #15 from bbc/cucumber-gem-downgrade
SwatiTabib Sep 29, 2017
c5d54c4
Added method for msi
Oct 2, 2017
48937c6
Merge pull request #16 from bbc/msi-auto-code
ankitjain0105 Oct 3, 2017
880fdc9
created a method to get logs
Nov 21, 2017
24d7118
Incorporated review comments
Nov 22, 2017
de1bd44
Merge pull request #17 from bbc/console_logs
ajaykumarraghav Nov 23, 2017
3f84882
Added include method
Nov 23, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Metrics/LineLength:
Max: 150

Metrics/AbcSize:
Max: 21

Metrics/MethodLength:
Max: 25

Metrics/ClassLength:
Max: 250

Metrics/CyclomaticComplexity:
Max: 10
1 change: 1 addition & 0 deletions .ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.9.3-p551
89 changes: 58 additions & 31 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,65 +1,84 @@
PATH
remote: .
specs:
frameworks-capybara (2.3.1)
capybara
frameworks-capybara (3.0.0)
capybara (~> 2.5)
capybara-mechanize
cucumber
json
logging
mechanize
poltergeist
selenium-webdriver
show_me_the_cookies
w3c_validators

GEM
remote: https://rubygems.org/
specs:
builder (3.2.2)
capybara (2.4.4)
capybara (2.5.0)
mime-types (>= 1.16)
nokogiri (>= 1.3.3)
rack (>= 1.0.0)
rack-test (>= 0.5.4)
xpath (~> 2.0)
capybara-mechanize (1.4.0)
capybara (~> 2.4.4)
mechanize (~> 2.7.0)
childprocess (0.5.5)
capybara-mechanize (1.0.1)
capybara (~> 2.0, >= 2.0.1)
mechanize (~> 2.5)
childprocess (0.5.9)
ffi (~> 1.0, >= 1.0.11)
cucumber (1.3.17)
cliver (0.3.2)
cucumber (2.3.0)
builder (>= 2.1.2)
cucumber-core (~> 1.4.0)
cucumber-wire (~> 0.0.1)
diff-lcs (>= 1.1.3)
gherkin (~> 2.12)
event-bus (~> 0.1.0)
gherkin (~> 3.2.0)
multi_json (>= 1.7.5, < 2.0)
multi_test (>= 0.1.1)
multi_test (>= 0.1.2)
cucumber-core (1.4.0)
gherkin (~> 3.2.0)
cucumber-wire (0.0.1)
diff-lcs (1.2.5)
domain_name (0.5.22)
domain_name (0.5.25)
unf (>= 0.0.5, < 1.0.0)
ffi (1.9.6)
gherkin (2.12.2)
multi_json (~> 1.3)
event-bus (0.1.0)
ffi (1.9.10)
gherkin (3.2.0)
http-cookie (1.0.2)
domain_name (~> 0.5)
json (1.8.1)
mechanize (2.7.3)
json (1.8.3)
little-plugger (1.1.4)
logging (2.0.0)
little-plugger (~> 1.1)
multi_json (~> 1.10)
mechanize (2.7.4)
domain_name (~> 0.5, >= 0.5.1)
http-cookie (~> 1.0)
mime-types (~> 2.0)
mime-types (>= 1.17.2, < 3)
net-http-digest_auth (~> 1.1, >= 1.1.1)
net-http-persistent (~> 2.5, >= 2.5.2)
nokogiri (~> 1.4)
nokogiri (~> 1.6)
ntlm-http (~> 0.1, >= 0.1.1)
webrobots (>= 0.0.9, < 0.2)
mime-types (2.4.3)
mini_portile (0.6.0)
multi_json (1.10.1)
multi_test (0.1.1)
mime-types (2.99)
mini_portile2 (2.0.0)
multi_json (1.11.2)
multi_test (0.1.2)
net-http-digest_auth (1.4)
net-http-persistent (2.9.4)
nokogiri (1.6.3.1)
mini_portile (= 0.6.0)
nokogiri (1.6.7.1)
mini_portile2 (~> 2.0.0.rc2)
ntlm-http (0.1.1)
rack (1.5.2)
rack-test (0.6.2)
poltergeist (1.8.1)
capybara (~> 2.1)
cliver (~> 0.3.1)
multi_json (~> 1.0)
websocket-driver (>= 0.2.0)
rack (1.6.4)
rack-test (0.6.3)
rack (>= 1.0)
rake (10.1.1)
rspec (2.13.0)
Expand All @@ -70,20 +89,25 @@ GEM
rspec-expectations (2.13.0)
diff-lcs (>= 1.1.3, < 2.0)
rspec-mocks (2.13.1)
rubyzip (1.1.6)
selenium-webdriver (2.43.0)
rubyzip (1.1.7)
selenium-webdriver (2.49.0)
childprocess (~> 0.5)
multi_json (~> 1.0)
rubyzip (~> 1.0)
websocket (~> 1.0)
show_me_the_cookies (3.1.0)
capybara (~> 2.0)
unf (0.1.4)
unf_ext
unf_ext (0.0.6)
unf_ext (0.0.7.1)
w3c_validators (1.2)
json
nokogiri
webrobots (0.1.1)
websocket (1.2.1)
webrobots (0.1.2)
websocket (1.2.2)
websocket-driver (0.6.3)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.2)
xpath (2.0.0)
nokogiri (~> 1.3)

Expand All @@ -94,3 +118,6 @@ DEPENDENCIES
frameworks-capybara!
rake
rspec

BUNDLED WITH
1.10.6
52 changes: 42 additions & 10 deletions README.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,20 @@ The principle behind this gem is to factor out all the common setup code for reg

Below are the current drivers that can be registered:

* Selenium-Webdriver (Selenium2) - LOCAL: This can be used to drive 'in-browser' tests runnong on your local machine in IE, Firefox and Chrome (and any other browsers as and when they are added into the Selenium-Webdriver project)
* Selenium-Webdriver (Selenium2) - LOCAL: This can be used to drive 'in-browser' tests running on your local machine in IE, Firefox and Chrome (and any other browsers as and when they are added into the Selenium-Webdriver project)


* Selenium-Webdriver (Selenium2) - REMOTE: This can be used to drive 'in-browser' tests on a remote macine, this could be another macine on your local network which is running a Selenium-Webdriver server or indeed a cloud service such as 'Sauce Labs'
* Selenium-Webdriver (Selenium2) - REMOTE: This can be used to drive 'in-browser' tests on a remote machine, this could be another machine on your local network which is running a Selenium-Webdriver server or indeed a cloud service such as 'Sauce Labs'

* Mechanize-Caybara: This can be used, by setting BROWSER=mechanize

* Poltergeist: This can be used, by setting BROWSER=poltergeist

How to use this gem in your project:

In your env.rb simply add:
require 'frameworks-capybara'

require 'frameworks-capybara'

The following environment variables can be set to configure your tests:

Expand All @@ -37,12 +39,12 @@ The following environment variables can be set to configure your tests:
FIREFOX_PREFS - specify a json string of additional preferences e.g. FIREFOX_PREFS='{"javascript.enabled": false}'
FIREFOX_CERT_PATH - specify optional directory containing Firefox profile certificate (.db) files
FIREFOX_CERT_PREFIX - specify optional prefix for locating Firefox profile certificate files (e.g. <prefix>-<file>.db)
CREATE_NEW_FF_PROFILE - create a new Firefox profile with name provided by FIREFOX_PROFILE
CREATE_NEW_FF_PROFILE - create a new Firefox profile with name provided by FIREFOX_PROFILE
XVFB - (string - 'true', 'false') - determines whether XVFB is used to run browser (i.e. headless Firefox on *nix platform)
FW_CERT_LOCATION - path to client certificate (combined pem)
CHROME_SWITCHES - pass in any allowed switches for the Selenium chrome driver (http://peter.sh/experiments/chromium-command-line-switches/) e.g. CHROME_SWITCHES="--user-agent=Mozilla/5.0 (PLAYSTATION 3; 3.55)"
PROJECT_NAME - optional project name description which gets displayed in Cucumber html reports
TEAM_NAME - optional team name description which gets displayed in Cucumber html reports
PROJECT_NAME - optional project name description which gets displayed in Cucumber html reports
TEAM_NAME - optional team name description which gets displayed in Cucumber html reports
BROWSER_CLI_ARGS - optional additional arguments to pass to local browser processes (individual arguments should be separated with spaces)

The following environment variables are specific to running tests against a BrowserStack remote grid:
Expand All @@ -54,6 +56,13 @@ The following environment variables are specific to running tests against a Brow
BS_PROJECT - allows the user to specify a name for a logical group of builds e.g. 'Project X'
BS_RESOLUTION - set the browser resolution e.g. '1024x768'

The following environment variables are specific to running tests against an Appium server:

APPIUM_PLATFORM - one of iOS, Android, or FirefoxOS
APPIUM_DEVICE - e.g. iPhone Simulator, iPad Simulator, iPhone Retina 4-inch, Android Emulator
APPIUM_BROWSER - e.g. chrome, safari
APPIUM_UDID - the device id, note you can find this by doing +adb devices+ if you are working on a local machine

Here is a sample cucumber.yml:

<%intenv='ENVIRONMENT=int'%>
Expand All @@ -80,13 +89,37 @@ Here is a sample cucumber.yml:


This gem also sets up a number of 'base urls' for you to use in your tests, these are set based on the ENVIRONMENT variable you set when running cucumber tests (either from the comand line or in cucumber.yml), the following URLs are set:

@base_url
@base_static_url
@base_open_url

Finally this gem contains some useful monkey-patches to core libraries e.g. Capybara-Mechanize, Selenium-Webdriver and Cucumber.

== Wait Helpers

This gem provides some default wait helpers useful for when the 'out of the box' mechanisms provided by Capybara and/or SitePrism aren't quite enough.

To use these include the +FrameworksCapybara+::+Wait+ module in your class.

+wait_for+ - simple wait for boolean condition
wait_for { (Random.rand(2) % 2) }


+wait_for_assertion+ - wait for rspec assertion to pass without raising exceptions

wait_for_assertion('Cannot find foo on page') do
expect(page).to have_content 'foo'
end


+wait_for_no_exception+ - wait for block to NOT raise provided exception

wait_for_no_exception('Author image not visible', SitePrism::TimeOutWaitingForElementVisibility) do
article.wait_until_author_image_visible
end


== Release instructions

* Run tests - 'rake'
Expand All @@ -105,7 +138,7 @@ You should see something like:
Pushed frameworks-capybara 0.2.23 to rubygems.org

== Contributing to frameworks-capybara

* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
* Fork the project
Expand All @@ -117,4 +150,3 @@ You should see something like:
== Copyright

See LICENSE.txt for further details.

6 changes: 3 additions & 3 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ require 'cucumber/rake/task'

Bundler::GemHelper.install_tasks

desc "Run all examples"
desc 'Run all examples'
RSpec::Core::RakeTask.new(:spec) do |t|
t.rspec_opts = %w[--color]
t.rspec_opts = %w(--color)
end
task :default => [:spec]
task default: [:spec]
44 changes: 23 additions & 21 deletions frameworks-capybara.gemspec
Original file line number Diff line number Diff line change
@@ -1,32 +1,34 @@
# -*- encoding: utf-8 -*-

lib = File.expand_path('../lib/', __FILE__)
$:.unshift lib unless $:.include?(lib)
$LOAD_PATH.unshift lib unless $LOAD_PATH.include?(lib)

require 'version'

Gem::Specification.new do |s|
s.name = "frameworks-capybara"
s.name = 'frameworks-capybara'
s.version = FrameworksCapybara::VERSION

s.authors = ["matt robbins"]
s.email = ["mcrobbins@gmail.com"]
s.description = "Gem to ease the pain of managing capybara driver config and provide a home for common utils and patches"

s.files = Dir.glob("{features,lib,bin,config,vendor,.bundle}/**/*") + %w(Gemfile Gemfile.lock)

s.require_paths = ["lib"]
s.rubygems_version = "2.4.2"
s.summary = "Gem to ease the pain of managing capybara driver config and provide a home for common utils and patches"
s.authors = ['Radio and Music Test team']
s.email = ['']
s.description = 'Gem to ease the pain of managing capybara driver config and provide a home for common utils and patches'

s.files = `git ls-files`.split("\n")
s.files = Dir.glob('{features,lib,bin,config,vendor,.bundle}/**/*') + %w(Gemfile Gemfile.lock)

s.add_runtime_dependency("selenium-webdriver")
s.add_runtime_dependency("capybara")
s.add_runtime_dependency("mechanize")
s.add_runtime_dependency("capybara-mechanize")
s.add_runtime_dependency("json")
s.add_runtime_dependency("cucumber")
s.add_runtime_dependency("w3c_validators")
s.add_development_dependency("rake")
s.add_development_dependency("rspec")
s.require_paths = ['lib']
s.rubygems_version = '2.4.2'
s.summary = 'Gem to ease the pain of managing capybara driver config and provide a home for common utils and patches'
s.files = `git ls-files`.split("\n")
s.add_runtime_dependency('selenium-webdriver')
s.add_runtime_dependency('capybara', '~> 2.5')
s.add_runtime_dependency('mechanize')
s.add_runtime_dependency('capybara-mechanize')
s.add_runtime_dependency('poltergeist')
s.add_runtime_dependency('json')
s.add_runtime_dependency('cucumber', '~> 2.4.0')
s.add_runtime_dependency('logging')
s.add_runtime_dependency('show_me_the_cookies')
s.add_runtime_dependency('w3c_validators')
s.add_development_dependency('rake')
s.add_development_dependency('rspec')
end
Loading