quke 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.codeclimate.yml +21 -0
- data/.config.example.yml +88 -0
- data/.gitignore +57 -0
- data/.rspec +2 -0
- data/.rubocop.yml +39 -0
- data/.travis.yml +40 -0
- data/Gemfile +4 -0
- data/LICENSE +8 -0
- data/README.md +138 -0
- data/Rakefile +13 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/exe/quke +7 -0
- data/lib/features/support/after_hook.rb +36 -0
- data/lib/features/support/after_step_hook.rb +7 -0
- data/lib/features/support/env.rb +33 -0
- data/lib/quke.rb +24 -0
- data/lib/quke/configuration.rb +166 -0
- data/lib/quke/cuke_runner.rb +49 -0
- data/lib/quke/driver_registration.rb +138 -0
- data/lib/quke/version.rb +3 -0
- data/quke.gemspec +101 -0
- data/quke.png +0 -0
- metadata +274 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 473715c033cd96a2b29d82d54f0340404ac366bd
|
4
|
+
data.tar.gz: 69cfc1b788076ae263170bce1efa958d2091fefc
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5089913eba66efa6a73e69b12a7133cb234834887a5b03e3f7c013a814f11977a56e8c0b8524424a5d5f34a0818d643d07ec8ddcd787c5be89a1e700cd09fa77
|
7
|
+
data.tar.gz: 1f216d61570ac77bd55ec241e923b6bd139acca45d1682dfe344ab1c9ed8b5e8421836588531b5925ee2e43d4c2acf72cf29e0fac9eb6c8fcaca28fdaf3bd371
|
data/.codeclimate.yml
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
---
|
2
|
+
engines:
|
3
|
+
bundler-audit:
|
4
|
+
enabled: true
|
5
|
+
duplication:
|
6
|
+
enabled: true
|
7
|
+
config:
|
8
|
+
languages:
|
9
|
+
- ruby
|
10
|
+
fixme:
|
11
|
+
enabled: true
|
12
|
+
rubocop:
|
13
|
+
enabled: true
|
14
|
+
reek:
|
15
|
+
enabled: true
|
16
|
+
ratings:
|
17
|
+
paths:
|
18
|
+
- "**.module"
|
19
|
+
- "**.rb"
|
20
|
+
exclude_paths:
|
21
|
+
- spec/
|
data/.config.example.yml
ADDED
@@ -0,0 +1,88 @@
|
|
1
|
+
# The standard place to add your features and step_definitions is in a folder
|
2
|
+
# named 'features' at the root of the project. However if you'd like to name
|
3
|
+
# this folder something else, you can tell Quke what the new name is here.
|
4
|
+
# The default is features
|
5
|
+
features_folder: 'cukes'
|
6
|
+
|
7
|
+
# Normally Capybara expects to be testing an in-process Rack application, but
|
8
|
+
# we're using it to talk to a remote host. Users of Quke can set what this
|
9
|
+
# will be by simply setting `app_host`. You can then use it directly using
|
10
|
+
# Capybara `visit('/Main_Page')` or `visit('/')` rather than having to repeat
|
11
|
+
# the full url each time
|
12
|
+
app_host: 'https://en.wikipedia.org/wiki'
|
13
|
+
|
14
|
+
# Tells Quke which browser to use for testing. Choices are firefox, chrome
|
15
|
+
# browserstack and phantomjs, with the default being phantomjs
|
16
|
+
driver: chrome
|
17
|
+
|
18
|
+
# Add a pause (in seconds) between steps so you can visually track how the
|
19
|
+
# browser is responding. Only useful if using a non-headless browser. The
|
20
|
+
# default is 0
|
21
|
+
pause: 1
|
22
|
+
|
23
|
+
# If you select the browserstack driver, there are a number of options you
|
24
|
+
# can pass through to setup your browserstack tests, username and auth_key
|
25
|
+
# being the critical ones.
|
26
|
+
# Please see https://www.browserstack.com/automate/capabilities for more details
|
27
|
+
browserstack:
|
28
|
+
# To run your tests with browserstack you must provide a username and auth_key
|
29
|
+
# as a minimum
|
30
|
+
username: jdoe
|
31
|
+
auth_key: 123456789ABCDE
|
32
|
+
|
33
|
+
# Keep track of all your automated tests using the build and project
|
34
|
+
# capabilities. Group your tests into builds, and builds further into projects
|
35
|
+
build: 'Version 1'
|
36
|
+
project: 'Adding browserstack support'
|
37
|
+
|
38
|
+
# Allows you to specify an identifier for the test run.
|
39
|
+
# If you intend to repeat a test this might not be that aplicable, but in the
|
40
|
+
# case of one off tests it might be useful
|
41
|
+
name: 'Testing google search'
|
42
|
+
|
43
|
+
# MOBILE testing
|
44
|
+
# The docs are a little confusing but essentially if you want to test against
|
45
|
+
# mobile devices you need to define 1 set of capabilities, and if desktop
|
46
|
+
# another
|
47
|
+
# -----
|
48
|
+
# OS you want to test. Accepted values are MAC, WIN8, XP, WINDOWS, ANY, ANDROID
|
49
|
+
# Browserstack default is ANY
|
50
|
+
platform: MAC
|
51
|
+
# Browser you want to test. Accepted values firefox, chrome, internet explorer,
|
52
|
+
# safari, opera, iPad, iPhone, android. Browserstack default is chrome
|
53
|
+
browserName: iPhone
|
54
|
+
# Browser version you want to test. See the docs for the full list of available
|
55
|
+
# versions. Browserstack default is latest stable version of browser selected
|
56
|
+
version: '49'
|
57
|
+
# Device you want to test on. See the docs for the full list of available.
|
58
|
+
device: 'iPhone 5'
|
59
|
+
|
60
|
+
# DESKTOP testing
|
61
|
+
# -----
|
62
|
+
# OS you want to test. Accepted values are WINDOWS, OS X. If both OS and
|
63
|
+
# platform are set, OS will take precedence
|
64
|
+
os: WINDOWS
|
65
|
+
# OS version you want to test. Accepted values are
|
66
|
+
# Windows: XP, 7, 8, 8.1 and 10
|
67
|
+
# OS X: Snow Leopard, Lion, Mountain Lion, Mavericks, Yosemite, El Capitan
|
68
|
+
os_version: '8.1'
|
69
|
+
# Browser you want to test. Accepted values are Firefox, Safari, IE, Chrome,
|
70
|
+
# Opera
|
71
|
+
browser: chrome
|
72
|
+
# Browser version you want to test. See the docs for the full list of
|
73
|
+
# available versions
|
74
|
+
browser_version: '49'
|
75
|
+
# Set the resolution of VM before beginning of your test.
|
76
|
+
# See docs https://www.browserstack.com/automate/capabilities for full list of
|
77
|
+
# accepted values, as it is also OS dependent
|
78
|
+
resolution: '1024x768'
|
79
|
+
|
80
|
+
# To avoid invalid certificate errors while testing set acceptSslCerts to true
|
81
|
+
acceptSslCerts: true
|
82
|
+
|
83
|
+
# Required if you want to generate screenshots at various steps in your test.
|
84
|
+
# Browserstack default is false
|
85
|
+
debug: true
|
86
|
+
# Required if you want to enable video recording during your test.
|
87
|
+
# Browserstack default is true
|
88
|
+
video: true
|
data/.gitignore
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
|
2
|
+
#
|
3
|
+
# If you find yourself ignoring temporary files generated by your text editor
|
4
|
+
# or operating system, you probably want to add a global ignore instead:
|
5
|
+
# git config --global core.excludesfile '~/.gitignore_global'
|
6
|
+
|
7
|
+
vendor/overcommit_bundle
|
8
|
+
|
9
|
+
# Ignore ruby_mine folder
|
10
|
+
/.idea
|
11
|
+
|
12
|
+
# Symbol tags (e.g. generated by Atom Editor)
|
13
|
+
/tags
|
14
|
+
|
15
|
+
*~
|
16
|
+
.DS_Store
|
17
|
+
.svn
|
18
|
+
.*.swp
|
19
|
+
___*
|
20
|
+
chromedriver.log
|
21
|
+
|
22
|
+
# Ignore all logfiles and tempfiles.
|
23
|
+
*.log
|
24
|
+
/log/*
|
25
|
+
!/log/.keep
|
26
|
+
/tmp/
|
27
|
+
|
28
|
+
# Ruby debugger related files
|
29
|
+
.byebug_history
|
30
|
+
|
31
|
+
# Capybara related artifacts
|
32
|
+
capybara-*.html
|
33
|
+
output.html
|
34
|
+
|
35
|
+
# Ignore bundler config.
|
36
|
+
/.bundle/
|
37
|
+
|
38
|
+
# We ignore the Gemfile.lock in a gem
|
39
|
+
/Gemfile.lock
|
40
|
+
|
41
|
+
# When the gem is built it goes here, but we don't want to include this in
|
42
|
+
# the source code repo
|
43
|
+
/pkg/
|
44
|
+
*.gem
|
45
|
+
|
46
|
+
# Ignore folders related to documentation output
|
47
|
+
/.yardoc
|
48
|
+
/_yardoc/
|
49
|
+
/html/
|
50
|
+
/doc/
|
51
|
+
|
52
|
+
# Ignore folders related to test output
|
53
|
+
/coverage/
|
54
|
+
/spec/reports/
|
55
|
+
|
56
|
+
# Ignore your project specific .config.yml config files
|
57
|
+
*.config.yml
|
data/.rspec
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
AllCops:
|
2
|
+
Exclude:
|
3
|
+
# Bin contains standard files created when gem is initialised and therefore
|
4
|
+
# they should be left as is
|
5
|
+
- 'bin/**/*'
|
6
|
+
# Exe contains standard files created when gem is initialised and therefore
|
7
|
+
# they should be left as is
|
8
|
+
- 'exe/**/*'
|
9
|
+
# Rakefile is generated when gem is initialised and therefore should be
|
10
|
+
# left as is
|
11
|
+
- 'Rakefile'
|
12
|
+
# Gemfile is generated when gem is initialised and therefore should be
|
13
|
+
# left as is
|
14
|
+
- 'Gemfile'
|
15
|
+
# Cop names are not displayed in offense messages by default. We find it
|
16
|
+
# useful to include this information so we can use it to investigate what the
|
17
|
+
# fix may be.
|
18
|
+
DisplayCopNames: true
|
19
|
+
# Style guide URLs are not displayed in offense messages by default. Again we
|
20
|
+
# find it useful to go straight to the documentation for a rule when
|
21
|
+
# investigating what the fix may be.
|
22
|
+
DisplayStyleGuide: true
|
23
|
+
|
24
|
+
# Disable this rubocop style because we want to make the arguments passed into
|
25
|
+
# Freakin available to anywhere when the code is executed
|
26
|
+
Style/GlobalVars:
|
27
|
+
Enabled: false
|
28
|
+
|
29
|
+
# It is our opinion that classes are easier to read if a white space is
|
30
|
+
# permitted between the class declaration and the first statement. Ditto the
|
31
|
+
# last statement and the closing tag.
|
32
|
+
Style/EmptyLinesAroundClassBody:
|
33
|
+
Enabled: false
|
34
|
+
|
35
|
+
# It is our opinion that modules are easier to read if a white space is
|
36
|
+
# permitted between the module declaration and the first statement. Ditto the
|
37
|
+
# last statement and the closing tag.
|
38
|
+
Style/EmptyLinesAroundModuleBody:
|
39
|
+
Enabled: false
|
data/.travis.yml
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
sudo: false
|
2
|
+
language: ruby
|
3
|
+
rvm:
|
4
|
+
- 2.3.1
|
5
|
+
before_install: gem install bundler -v 1.12.5
|
6
|
+
|
7
|
+
# Travis CI clones repositories to a depth of 50 commits, which is only really
|
8
|
+
# useful if you are performing git operations.
|
9
|
+
# https://docs.travis-ci.com/user/customizing-the-build/#Git-Clone-Depth
|
10
|
+
git:
|
11
|
+
depth: 3
|
12
|
+
|
13
|
+
# enable Bundler caching
|
14
|
+
# https://docs.travis-ci.com/user/languages/ruby#Caching-Bundler
|
15
|
+
cache: bundler
|
16
|
+
|
17
|
+
# This section was added as per https://docs.travis-ci.com/user/code-climate/
|
18
|
+
# To protect our codeclimate stats rather than adding the Codeclimate API key for ea-area_lookup
|
19
|
+
# in the open we used this guide https://docs.travis-ci.com/user/encryption-keys/ to encryt the
|
20
|
+
# value. Essentially install travis gem, then run `travis encrypt <my_code_climate_api_key>`
|
21
|
+
addons:
|
22
|
+
code_climate:
|
23
|
+
repo_token:
|
24
|
+
secure: "Fa+J+1mLtiQpg9BSwiuZ7Oi9azCMkRaydRkgZe5zN1qt0aMEOhq3bLeNvnmcB8X1024jKWHozweMxE4BZ3lbL2o+QGksg9Sc56j88cTbNr35gdtbFvR/EFbNO0Y8ncmDuovw0lLJa0IwZKQ7E5WexyWhdsQ5ksKPUKr2e5kr/uJKm6B74nffL+W7wP
|
25
|
+
GkTEzfFOYgTJcLzCtSeMuiZy5jnbPca9iiLM5fq0sDZ6RoUfrv8BXLtOAF5hSwKYzhtthNlDVFYGylDB3zmWnhTtqJkUR4+jjQep/SXvOktgYJPXXxK5XV2QnqRUWlpTuOVvnJQKgZAMXlZ9gdQJMWNtL81llBsp65D8ymD8+JyqDunX+WN2aZYbOkN4geKag2ZAB
|
26
|
+
gd5GSvj5ZnEXR+YdxkmPHdeFVmeV3AhlwsX4dtXUV2g6icRmBE1cE/Q+VvS1w4t8xoeiLX12oJSpVGoSAC9Mx1fMtkcjrRmposwS4LMqtIJkEMnbDAo3eCrT2rToFBb/sVgLkuxVuO/nLmfeGoYFVRL3Rhe7rEg5euVYSDFLB/S9FrhTgrmTpGoFNzAKmF/V3+wBf
|
27
|
+
MlNYWWRLGKnQuy8+UUMFjOXP5kWF+pkdK6fB8yz/Jn9wI5OY4bd03V1gcmOxNhaNFIxh6k2x0m4Da3rgIu4bQSXeMtJSKz/OvN8eRZs="
|
28
|
+
|
29
|
+
deploy:
|
30
|
+
provider: rubygems
|
31
|
+
api_key:
|
32
|
+
secure: "mrNfo3ZlO4wtr7fp751jltjKZcWeFXLCxxVDHqJVnkdAKpDcbo99Phlq9+fh5Q/o8gIJ4jKQybvr/Zu5t8mrWYJKKLlsUi3UThJG5hOg64ynJKy3jqtU45uCGOc33oBhQAqHTfDI+DZxQTGs2TepoqdyxsSzki
|
33
|
+
s9TRj+qyeE2HSO+yz5Qyjwql6o5k9xP82uBFaQI0WKqKdTtdNFv5LZ3EZaRWtyM/jGsunaNAYscDOl3cYN1sXlq+wfCTRvjMGmcppdbsaczQNQdIkXBPZEkydO7FdnSwUFuwm30BP0OBks5myB7oHWbbe0p/YRsUbjLF0dVfn
|
34
|
+
AlSERSwhkpMOU1BpK4/vwPBoR8yzgfZG4UZAZQ6hCMtRj+2usKWcI4buryeD+iPDrkVX9FjziOC3OFSbMzo/ojYlkLjvvXuUcTAmWZr0V/VP1x7RAiHNA+Y7EqYRJFJcEE5Av7Yn+hgi8fUtLyiSDLOb4bGJ2fe9R3YeZQ1ge
|
35
|
+
pvnarjriXfNZul3K1tP21/oVeXwCRuOjPMxwUmEsPCCjdIu/44U5CvGRbaqJXAqYJm71u+Y96RfkjytRnLmAc13nIBiFCUqUyoab4GIsy9AZ4TzE9ROGwLTC3y05gMVlYVJk4GTtVCjJwqNB2LWRXo/PseWaDdRZYmnNTr5wI
|
36
|
+
kB5wbWRtEYUdIOb70c="
|
37
|
+
gem: quke
|
38
|
+
on:
|
39
|
+
tags: true
|
40
|
+
repo: EnvironmentAgency/quke
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
The Open Government Licence (OGL) Version 3
|
2
|
+
|
3
|
+
Copyright (c) 2014 Environment Agency
|
4
|
+
|
5
|
+
This source code is licensed under the Open Government Licence v3.0. To view this
|
6
|
+
licence, visit www.nationalarchives.gov.uk/doc/open-government-licence/version/3
|
7
|
+
or write to the Information Policy Team, The National Archives, Kew, Richmond,
|
8
|
+
Surrey, TW9 4DU.
|
data/README.md
ADDED
@@ -0,0 +1,138 @@
|
|
1
|
+
<img src="/quke.png" alt="Git flow" />
|
2
|
+
|
3
|
+
[![Build Status](https://travis-ci.org/EnvironmentAgency/quke.svg?branch=master)](https://travis-ci.org/EnvironmentAgency/quke)
|
4
|
+
[![security](https://hakiri.io/github/EnvironmentAgency/quke/master.svg)](https://hakiri.io/github/EnvironmentAgency/quke/master)
|
5
|
+
[![Code Climate](https://codeclimate.com/github/EnvironmentAgency/quke/badges/gpa.svg)](https://codeclimate.com/github/EnvironmentAgency/quke)
|
6
|
+
[![Test Coverage](https://codeclimate.com/github/EnvironmentAgency/quke/badges/coverage.svg)](https://codeclimate.com/github/EnvironmentAgency/quke/coverage)
|
7
|
+
[![Dependency Status](https://dependencyci.com/github/EnvironmentAgency/quke/badge)](https://dependencyci.com/github/EnvironmentAgency/quke)
|
8
|
+
|
9
|
+
Quke is a gem that helps you to build a suite of [Cucumber](https://cucumber.io/) acceptance tests.
|
10
|
+
|
11
|
+
Quke tries to simplify the process of writing and running these tests by setting up **Cucumber** for you. It handles the config to allow you to run them in [Firefox](https://www.mozilla.org/en-GB/firefox/new/) (via Selenium) and [Chrome](https://www.google.co.uk/chrome/browser/desktop/) (via [Selenium](https://github.com/SeleniumHQ/selenium/tree/master/rb)), or the headless browser [PhantomJS](http://phantomjs.org/) (via [Poltergeist](https://github.com/teampoltergeist/poltergeist)). It also has out of the box support for using [Browserstack automate](https://www.browserstack.com). This leaves you to focus on just your tests.
|
12
|
+
|
13
|
+
It was born out of trying to make the process for team members without a development background as simple as possible, and to get them involved in writing and building acceptance tests that they then manage.
|
14
|
+
|
15
|
+
It also includes the ability to run those tests using **Browserstack**. **Browserstack** gives you the ability to test your application with different combinations of platform, OS, and browser all in the cloud.
|
16
|
+
|
17
|
+
## Pre-requisites
|
18
|
+
|
19
|
+
You'll need [Ruby](https://www.ruby-lang.org/en/) installed (ideally the latest version available) plus the [Bundler](http://bundler.io/) gem.
|
20
|
+
|
21
|
+
The only other dependency this project has is the browsers you intend to use it with. It is currently setup to work with
|
22
|
+
|
23
|
+
- [PhantomJS](http://phantomjs.org/) (via [Poltergeist](https://github.com/teampoltergeist/poltergeist))
|
24
|
+
- [Chrome](https://www.google.co.uk/chrome/browser/desktop/) (via [Selenium](https://github.com/SeleniumHQ/selenium/tree/master/rb))
|
25
|
+
- [Firefox](https://www.mozilla.org/en-GB/firefox/new/) (via Selenium)
|
26
|
+
|
27
|
+
The one you may not have heard of is **PhantomJS**. It is a [headless browser](https://en.wikipedia.org/wiki/Headless_browser).
|
28
|
+
|
29
|
+
> A headless browser is a web browser without a graphical user interface
|
30
|
+
|
31
|
+
Quke uses **PhantomJS** as its default browser. Using a headless browser the tests will run much faster and means Quke can also be used as part of your [CI build](https://en.wikipedia.org/wiki/Build_automation).
|
32
|
+
|
33
|
+
It is assumed you know what **Chrome** and **Firefox** are and how to install them.
|
34
|
+
|
35
|
+
### Install PhantomJS
|
36
|
+
|
37
|
+
#### Mac
|
38
|
+
|
39
|
+
We highly recommend using [Homebrew](http://brew.sh/) if you are using a **Mac** for installing packages like PhantomJS.
|
40
|
+
|
41
|
+
Once installed run `brew install phantomjs`
|
42
|
+
|
43
|
+
#### Linux
|
44
|
+
|
45
|
+
You'll need to
|
46
|
+
|
47
|
+
- Download either the 32bit or 64bit binary from <http://phantomjs.org/download.html>
|
48
|
+
- Extract the content and add the `bin/phantomjs` directory to your `PATH`
|
49
|
+
|
50
|
+
## Installation
|
51
|
+
|
52
|
+
Add this line to your application's Gemfile
|
53
|
+
|
54
|
+
```ruby
|
55
|
+
gem 'quke'
|
56
|
+
```
|
57
|
+
|
58
|
+
And then execute:
|
59
|
+
|
60
|
+
$ bundle
|
61
|
+
|
62
|
+
Or install it yourself as
|
63
|
+
|
64
|
+
$ gem install quke
|
65
|
+
|
66
|
+
## Configuration
|
67
|
+
|
68
|
+
You can use configuration to drive Quke. You can configure Quke using `.config.yml` files. See [.config.example.yml](.config.example.yml) for details of the options to include in your `.config.yml`.
|
69
|
+
|
70
|
+
### Multiple configs
|
71
|
+
|
72
|
+
When Quke runs it will default to looking for `.config.yml`. However you can override this and tell Quke which one to use. This allows you to create multiple config files.
|
73
|
+
|
74
|
+
You do this using an environment variable. The most flexible way is to set the variable as part of your command.
|
75
|
+
|
76
|
+
```bash
|
77
|
+
QUKE_CONFIG='chrome.config.yml' bundle exec quke
|
78
|
+
```
|
79
|
+
|
80
|
+
The use case is to allow you to have different configs setup ready to go, and enable you to switch between them. For example when testing with Chrome and Firefox you set a 1 second delay between steps so you can observe the tests as they run through, but in your default `.config.yml` you want no pauses and use **phantomjs**.
|
81
|
+
|
82
|
+
## Usage
|
83
|
+
|
84
|
+
TODO: Write usage instructions here
|
85
|
+
|
86
|
+
## Behaviours
|
87
|
+
|
88
|
+
You should be aware of some default behaviours included in Quke.
|
89
|
+
|
90
|
+
### Displaying web pages on fail
|
91
|
+
|
92
|
+
Capybara includes the ability to save the source of the current page at any point. Quke has been configured so that if you are not using the headless browser and a step should fail it will save the source to file and then use a tool called [Launchy](https://github.com/copiousfreetime/launchy) to open it in your default browser.
|
93
|
+
|
94
|
+
### Early fail for CI
|
95
|
+
|
96
|
+
When running using the default PhantomJS headless browser, as soon as there is a failure Quke will exit. This is because it is assumed when used in headless mode the key thing to know is *are there any failures*, to ensure fast feedback from your CI build server.
|
97
|
+
|
98
|
+
### Quit on 5 failures
|
99
|
+
|
100
|
+
If you are running using Chrome or Firefox after the 5th failure Quke will automatically stop. This is to prevent scores of tabs being opened in the browser when an error is found, which may just be the result of an error in the test code.
|
101
|
+
|
102
|
+
## Development
|
103
|
+
|
104
|
+
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.
|
105
|
+
|
106
|
+
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).
|
107
|
+
|
108
|
+
### Running
|
109
|
+
|
110
|
+
Whilst just developing a gem like Quke you can execute it with
|
111
|
+
|
112
|
+
$ ruby -Ilib ./exe/quke
|
113
|
+
|
114
|
+
and pass in arguments as well
|
115
|
+
|
116
|
+
$ ruby -Ilib ./exe/quke --tags @wip
|
117
|
+
|
118
|
+
## Contributing to this project
|
119
|
+
|
120
|
+
If you have an idea you'd like to contribute please log an issue.
|
121
|
+
|
122
|
+
All contributions should be submitted via a pull request.
|
123
|
+
|
124
|
+
## License
|
125
|
+
|
126
|
+
THIS INFORMATION IS LICENSED UNDER THE CONDITIONS OF THE OPEN GOVERNMENT LICENCE found at:
|
127
|
+
|
128
|
+
http://www.nationalarchives.gov.uk/doc/open-government-licence/version/3
|
129
|
+
|
130
|
+
The following attribution statement MUST be cited in your products and applications when using this information.
|
131
|
+
|
132
|
+
> Contains public sector information licensed under the Open Government license v3
|
133
|
+
|
134
|
+
### About the license
|
135
|
+
|
136
|
+
The Open Government Licence (OGL) was developed by the Controller of Her Majesty's Stationery Office (HMSO) to enable information providers in the public sector to license the use and re-use of their information under a common open licence.
|
137
|
+
|
138
|
+
It is designed to encourage use and re-use of information freely and flexibly, with only a few conditions.
|
data/Rakefile
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'bundler/gem_tasks'
|
2
|
+
require 'rspec/core/rake_task'
|
3
|
+
require 'rdoc/task'
|
4
|
+
|
5
|
+
RSpec::Core::RakeTask.new(:spec)
|
6
|
+
|
7
|
+
RDoc::Task.new do |doc|
|
8
|
+
doc.main = 'README.md'
|
9
|
+
doc.title = 'Quke'
|
10
|
+
doc.rdoc_files = FileList.new %w[README.md lib LICENSE]
|
11
|
+
end
|
12
|
+
|
13
|
+
task :default => :spec
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'bundler/setup'
|
4
|
+
require 'quke'
|
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
|
data/bin/setup
ADDED
data/exe/quke
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'quke/configuration'
|
2
|
+
|
3
|
+
After('~@nonweb') do |scenario|
|
4
|
+
if scenario.failed?
|
5
|
+
|
6
|
+
$fail_count ||= 0
|
7
|
+
$fail_count = $fail_count + 1
|
8
|
+
|
9
|
+
# Tell Cucumber to quit after first failing scenario when phantomjs is
|
10
|
+
# used. The expectation is that you are using phantomjs as part of your
|
11
|
+
# CI and therefore a fast response is better than a detailed response.
|
12
|
+
# Experience has shown that should a major element of your service go
|
13
|
+
# down all your tests will start failing which means you can be swamped
|
14
|
+
# with output from `save_and_open_page`. Using a global count of the
|
15
|
+
# number of fails, if it hits 5 it will cause cucumber to close.
|
16
|
+
if Quke::Quke.config.driver == :phantomjs || $fail_count >= 5
|
17
|
+
Cucumber.wants_to_quit = true
|
18
|
+
else
|
19
|
+
# If we're not using poltergiest and the scenario has failed, we want
|
20
|
+
# to save a copy of the page and open it automatically using Launchy.
|
21
|
+
# We wrap this in a begin/rescue in case of any issues in which case
|
22
|
+
# it defaults to outputting the source to STDOUT.
|
23
|
+
begin
|
24
|
+
# rubocop:disable Lint/Debugger
|
25
|
+
save_and_open_page
|
26
|
+
# rubocop:enable Lint/Debugger
|
27
|
+
rescue StandardError
|
28
|
+
# handle e
|
29
|
+
puts "FAILED: #{scenario.name}"
|
30
|
+
puts "FAILED: URL of the page with the failure #{page.current_path}"
|
31
|
+
puts ''
|
32
|
+
puts page.html
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'rspec/expectations'
|
2
|
+
require 'capybara/cucumber'
|
3
|
+
require 'site_prism'
|
4
|
+
require 'quke/driver_registration'
|
5
|
+
require 'quke/configuration'
|
6
|
+
|
7
|
+
Capybara.app_host =
|
8
|
+
Quke::Quke.config.app_host unless Quke::Quke.config.app_host.empty?
|
9
|
+
|
10
|
+
driver = Quke::DriverRegistration.new(Quke::Quke.config).register
|
11
|
+
|
12
|
+
Capybara.default_driver = driver
|
13
|
+
Capybara.javascript_driver = driver
|
14
|
+
|
15
|
+
# By default Capybara will try to boot a rack application automatically. This
|
16
|
+
# switches off Capybara's rack server as we are running against a remote
|
17
|
+
# application.
|
18
|
+
Capybara.run_server = false
|
19
|
+
|
20
|
+
# When calling save_and_open_page the current html page is saved to file for
|
21
|
+
# debug purposes. This can be done directly within a step or happens
|
22
|
+
# automatically in the event of an error when using the selenium driver.
|
23
|
+
# Not setting this leads to Capybara saving the file to the root of the project
|
24
|
+
# which can mess up your project structure.
|
25
|
+
Capybara.save_path = 'tmp/'
|
26
|
+
|
27
|
+
# By default, SitePrism element and section methods do not utilize Capybara's
|
28
|
+
# implicit wait methodology and will return immediately if the element or
|
29
|
+
# section requested is not found on the page. Adding the following code
|
30
|
+
# enables Capybara's implicit wait methodology to pass through
|
31
|
+
SitePrism.configure do |config|
|
32
|
+
config.use_implicit_waits = true
|
33
|
+
end
|
data/lib/quke.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'quke/version'
|
2
|
+
require 'quke/configuration'
|
3
|
+
require 'quke/cuke_runner'
|
4
|
+
require 'quke/driver_registration'
|
5
|
+
|
6
|
+
module Quke #:nodoc:
|
7
|
+
|
8
|
+
# The main Quke class. It is not intended to be instantiated and instead
|
9
|
+
# just need to call its +execute+ method.
|
10
|
+
class Quke
|
11
|
+
|
12
|
+
class << self
|
13
|
+
attr_accessor :config
|
14
|
+
end
|
15
|
+
|
16
|
+
# The entry point for Quke, it is the one call made by +exe/quke+.
|
17
|
+
def self.execute(args = [])
|
18
|
+
cuke = CukeRunner.new(@config.features_folder, args)
|
19
|
+
cuke.run
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
@@ -0,0 +1,166 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
|
3
|
+
module Quke #:nodoc:
|
4
|
+
|
5
|
+
# Manages all configuration for Quke.
|
6
|
+
class Configuration
|
7
|
+
|
8
|
+
attr_reader :file_location, :data
|
9
|
+
|
10
|
+
class << self
|
11
|
+
attr_writer :file_location
|
12
|
+
end
|
13
|
+
|
14
|
+
# Returns the expected root location of where Quke expects to find the
|
15
|
+
# the config file.
|
16
|
+
def self.file_location
|
17
|
+
@file_location ||= File.expand_path(
|
18
|
+
"../../#{file_name}",
|
19
|
+
File.dirname(__FILE__)
|
20
|
+
)
|
21
|
+
end
|
22
|
+
|
23
|
+
# Return the file name for the config file, either as set by the user in
|
24
|
+
# an environment variable called `QCONFIG` or the default of +.config.yml+.
|
25
|
+
def self.file_name
|
26
|
+
ENV['QUKE_CONFIG'] || '.config.yml'
|
27
|
+
end
|
28
|
+
|
29
|
+
# When an instance is initialized it will automatically populate itself by
|
30
|
+
# calling a private method +load_data()+.
|
31
|
+
def initialize
|
32
|
+
@data = load_data
|
33
|
+
end
|
34
|
+
|
35
|
+
def features_folder
|
36
|
+
@data['features_folder']
|
37
|
+
end
|
38
|
+
|
39
|
+
# Returns the value set for +app_host+.
|
40
|
+
#
|
41
|
+
# Normally Capybara expects to be testing an in-process Rack application,
|
42
|
+
# but Quke is designed to talk to a remote host. Users of Quke can set
|
43
|
+
# what this will be by setting +app_host+ in their +.config.yml+ file.
|
44
|
+
# Capybara will then combine this with links you provide.
|
45
|
+
#
|
46
|
+
# visit('/Main_Page')
|
47
|
+
# visit('/')
|
48
|
+
#
|
49
|
+
# This saves you from having to repeat the full url each time.
|
50
|
+
def app_host
|
51
|
+
@data['app_host']
|
52
|
+
end
|
53
|
+
|
54
|
+
# Returns the value set for +driver+.
|
55
|
+
#
|
56
|
+
# Tells Quke which browser to use for testing. Choices are firefox,
|
57
|
+
# chrome browserstack and phantomjs, with the default being phantomjs.
|
58
|
+
def driver
|
59
|
+
@data['driver']
|
60
|
+
end
|
61
|
+
|
62
|
+
# Return the value set for +pause+.
|
63
|
+
#
|
64
|
+
# Add a pause (in seconds) between steps so you can visually track how the
|
65
|
+
# browser is responding. Only useful if using a non-headless browser. The
|
66
|
+
# default is 0.
|
67
|
+
def pause
|
68
|
+
@data['pause']
|
69
|
+
end
|
70
|
+
|
71
|
+
# Return the hash of +browserstack+ options.
|
72
|
+
#
|
73
|
+
# If you select the browserstack driver, there are a number of options you
|
74
|
+
# can pass through to setup your browserstack tests, username and auth_key
|
75
|
+
# being the critical ones.
|
76
|
+
#
|
77
|
+
# Please see https://www.browserstack.com/automate/capabilities for more
|
78
|
+
# details.
|
79
|
+
def browserstack
|
80
|
+
@data['browserstack']
|
81
|
+
end
|
82
|
+
|
83
|
+
# The hash returned from this method is intended to used in a call to
|
84
|
+
# Capybara::Poltergeist::Driver.new(app, options).
|
85
|
+
#
|
86
|
+
# There are a number of options for how to configure poltergeist which
|
87
|
+
# drives PhantomJS, and it includes options passed to phantomjs to
|
88
|
+
# configure how it runs.
|
89
|
+
def poltergeist_options
|
90
|
+
{
|
91
|
+
# Javascript errors will get re-raised in our tests causing them to fail
|
92
|
+
js_errors: true,
|
93
|
+
# How long in seconds we'll wait for response when communicating with
|
94
|
+
# Phantomjs
|
95
|
+
timeout: 30,
|
96
|
+
# When true debug output will be logged to STDERR (a terminal thing!)
|
97
|
+
debug: false,
|
98
|
+
# Poltergeist can pass on options for configuring phantomjs
|
99
|
+
phantomjs_options: phantomjs_options,
|
100
|
+
inspector: true
|
101
|
+
}
|
102
|
+
end
|
103
|
+
|
104
|
+
# Override to_s to output the contents of Config as a readable string rather
|
105
|
+
# than the standard object output you get.
|
106
|
+
def to_s
|
107
|
+
@data.to_s
|
108
|
+
end
|
109
|
+
|
110
|
+
private
|
111
|
+
|
112
|
+
def phantomjs_options
|
113
|
+
# Don't load images to help speed up the tests,
|
114
|
+
[
|
115
|
+
'--load-images=no',
|
116
|
+
'--disk-cache=false',
|
117
|
+
'--ignore-ssl-errors=yes'
|
118
|
+
]
|
119
|
+
end
|
120
|
+
|
121
|
+
def load_data
|
122
|
+
data = default_data!(load_yml_data)
|
123
|
+
data['browserstack'] = browserstack_data(data['browserstack'])
|
124
|
+
data
|
125
|
+
end
|
126
|
+
|
127
|
+
# rubocop:disable Metrics/AbcSize
|
128
|
+
def default_data!(data)
|
129
|
+
data.merge(
|
130
|
+
'features_folder' => (data['features'] || 'features').downcase.strip,
|
131
|
+
'app_host' => (data['app_host'] || '').downcase.strip,
|
132
|
+
'driver' => (data['driver'] || 'phantomjs').downcase.strip,
|
133
|
+
'pause' => (data['pause'] || '0').to_s.downcase.strip.to_i
|
134
|
+
)
|
135
|
+
end
|
136
|
+
# rubocop:enable Metrics/AbcSize
|
137
|
+
|
138
|
+
# rubocop:disable Metrics/MethodLength
|
139
|
+
def browserstack_data(data)
|
140
|
+
data = {} if data.nil?
|
141
|
+
data.merge(
|
142
|
+
'username' => (ENV['BROWSERSTACK_USERNAME'] ||
|
143
|
+
data['username'] ||
|
144
|
+
''
|
145
|
+
),
|
146
|
+
'auth_key' => (ENV['BROWSERSTACK_AUTH_KEY'] ||
|
147
|
+
data['auth_key'] ||
|
148
|
+
''
|
149
|
+
)
|
150
|
+
)
|
151
|
+
end
|
152
|
+
# rubocop:enable Metrics/MethodLength
|
153
|
+
|
154
|
+
def load_yml_data
|
155
|
+
if File.exist? self.class.file_location
|
156
|
+
# YAML.load_file returns false if the file exists but is empty. So
|
157
|
+
# added the || {} to ensure we always return a hash from this method
|
158
|
+
YAML.load_file(self.class.file_location) || {}
|
159
|
+
else
|
160
|
+
{}
|
161
|
+
end
|
162
|
+
end
|
163
|
+
|
164
|
+
end
|
165
|
+
|
166
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require 'cucumber'
|
2
|
+
|
3
|
+
module Quke #:nodoc:
|
4
|
+
|
5
|
+
# Handles executing Cucumber, including sorting the arguments we pass to it
|
6
|
+
class CukeRunner
|
7
|
+
|
8
|
+
attr_reader :args
|
9
|
+
|
10
|
+
# When an instance of CukeRunner is initialized it will take the arguments
|
11
|
+
# passed in and combine them with its own default args.
|
12
|
+
#
|
13
|
+
# The default args add the following to the parameters passed to Cucumber
|
14
|
+
#
|
15
|
+
# [my_features_folder, '-r', 'lib/features', '-r', my_features_folder]
|
16
|
+
#
|
17
|
+
# Its these args that pass our features directory to cucumber along with
|
18
|
+
# the user's. So to break it down
|
19
|
+
# - +my_features_folder+, first arg tells Cucumber where the feature files
|
20
|
+
# are located
|
21
|
+
# - +-r 'lib/features'+, tells Cucumber to require our features folder.
|
22
|
+
# This is how we get it to use our +env.rb+ which handles all the
|
23
|
+
# setup on behalf of the user (the point of Quke) to do things like
|
24
|
+
# use Browserstack, or switch between running against Chrom or firefox
|
25
|
+
# locally
|
26
|
+
# - +-r my_features_folder+, if you specify a different folder for
|
27
|
+
# or wish to test just specific features, you are required by Cucumber
|
28
|
+
# to also require the folder which contains your steps
|
29
|
+
# features directory contains the +env.rb+
|
30
|
+
def initialize(features_folder, args = [])
|
31
|
+
@args = [
|
32
|
+
features_folder,
|
33
|
+
'-r', 'lib/features',
|
34
|
+
'-r', features_folder
|
35
|
+
] + args
|
36
|
+
end
|
37
|
+
|
38
|
+
# Executes Cucumber, passing in the arguments hash set when the instance of
|
39
|
+
# CukeRunner was created.
|
40
|
+
def run
|
41
|
+
Cucumber::Cli::Main.new(@args).execute!
|
42
|
+
rescue SystemExit => e
|
43
|
+
# Cucumber calls @kernel.exit() killing your script unless you rescue
|
44
|
+
raise StandardError, 'Cucumber exited in a failed state' unless e.success?
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
@@ -0,0 +1,138 @@
|
|
1
|
+
require 'quke/configuration'
|
2
|
+
require 'capybara/poltergeist'
|
3
|
+
require 'selenium/webdriver'
|
4
|
+
|
5
|
+
module Quke #:nodoc:
|
6
|
+
|
7
|
+
# Helper class that contains all methods related to registering drivers with
|
8
|
+
# Capybara.
|
9
|
+
class DriverRegistration
|
10
|
+
|
11
|
+
attr_reader :config
|
12
|
+
|
13
|
+
def initialize(config)
|
14
|
+
@config = config
|
15
|
+
end
|
16
|
+
|
17
|
+
def register
|
18
|
+
case @config.driver
|
19
|
+
when 'firefox'
|
20
|
+
firefox
|
21
|
+
when 'chrome'
|
22
|
+
chrome
|
23
|
+
when 'browserstack'
|
24
|
+
browserstack(@config.browserstack)
|
25
|
+
else
|
26
|
+
phantomjs(@config.poltergeist_options)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
# Register the poltergeist driver with capybara.
|
33
|
+
#
|
34
|
+
# By default poltergeist is setup to work with phantomjs hence we refer to
|
35
|
+
# it as :phantomjs. There are a number of options for how to configure
|
36
|
+
# poltergeist, and we can even pass on options to phantomjs to configure how
|
37
|
+
# it runs.
|
38
|
+
def phantomjs(options = {})
|
39
|
+
Capybara.register_driver :phantomjs do |app|
|
40
|
+
# We ignore the next line (and those like it in the subsequent methods)
|
41
|
+
# from code coverage because we never actually execute them from Quke.
|
42
|
+
# Capybara.register_driver takes a name and a &block, and holds it in a
|
43
|
+
# hash. It executes the block from within Capybara when Cucumber is
|
44
|
+
# called, all we're doing here is telling it what block (code) to
|
45
|
+
# execute at that time.
|
46
|
+
# :simplecov_ignore:
|
47
|
+
Capybara::Poltergeist::Driver.new(app, options)
|
48
|
+
# :simplecov_ignore:
|
49
|
+
end
|
50
|
+
:phantomjs
|
51
|
+
end
|
52
|
+
|
53
|
+
# Register the selenium driver with capybara. By default selinium is setup
|
54
|
+
# to work with firefox hence we refer to it as :firefox
|
55
|
+
#
|
56
|
+
# N.B. options is not currently used but maybe in the future.
|
57
|
+
def firefox(_options = {})
|
58
|
+
Capybara.register_driver :firefox do |app|
|
59
|
+
# :simplecov_ignore:
|
60
|
+
Capybara::Selenium::Driver.new(app)
|
61
|
+
# :simplecov_ignore:
|
62
|
+
end
|
63
|
+
:firefox
|
64
|
+
end
|
65
|
+
|
66
|
+
# Register the selenium driver again, only this time we are configuring it
|
67
|
+
# to work with chrome.
|
68
|
+
#
|
69
|
+
# N.B. options is not currently used but maybe in the future.
|
70
|
+
def chrome(_options = {})
|
71
|
+
Capybara.register_driver :chrome do |app|
|
72
|
+
# :simplecov_ignore:
|
73
|
+
Capybara::Selenium::Driver.new(app, browser: :chrome)
|
74
|
+
# :simplecov_ignore:
|
75
|
+
end
|
76
|
+
:chrome
|
77
|
+
end
|
78
|
+
|
79
|
+
# Register a browserstack driver. Essentially this the selenium driver but
|
80
|
+
# configured to run remotely using the Browserstack automate service.
|
81
|
+
# As a minimum the options must contain a username and key in order to
|
82
|
+
# authenticate with Browserstack.
|
83
|
+
# rubocop:disable Metrics/MethodLength
|
84
|
+
def browserstack(options = {})
|
85
|
+
Capybara.register_driver :browserstack do |app|
|
86
|
+
# :simplecov_ignore:
|
87
|
+
username = options['username']
|
88
|
+
key = options['auth_key']
|
89
|
+
url = "http://#{username}:#{key}@hub.browserstack.com/wd/hub"
|
90
|
+
|
91
|
+
Capybara::Selenium::Driver.new(
|
92
|
+
app,
|
93
|
+
browser: :remote,
|
94
|
+
url: url,
|
95
|
+
desired_capabilities: browserstack_capabilities(options)
|
96
|
+
)
|
97
|
+
# :simplecov_ignore:
|
98
|
+
end
|
99
|
+
:browserstack
|
100
|
+
end
|
101
|
+
|
102
|
+
# rubocop:disable Metrics/AbcSize
|
103
|
+
def browserstack_capabilities(options = {})
|
104
|
+
capabilities = Selenium::WebDriver::Remote::Capabilities.new
|
105
|
+
|
106
|
+
capabilities['build'] = options['build']
|
107
|
+
capabilities['project'] = options['project']
|
108
|
+
capabilities['name'] = options['name']
|
109
|
+
|
110
|
+
# This and the following section are essentially diametric; you set one
|
111
|
+
# or the other but not both. Some examples seen put logic in place to
|
112
|
+
# test the options passed in and then set the capabilities accordingly,
|
113
|
+
# however Browserstack handles this and has what will happen documented
|
114
|
+
# https://www.browserstack.com/automate/capabilities#capabilities-parameter-override
|
115
|
+
capabilities['platform'] = options['platform']
|
116
|
+
capabilities['browserName'] = options['browserName']
|
117
|
+
capabilities['version'] = options['version']
|
118
|
+
|
119
|
+
capabilities['os'] = options['os']
|
120
|
+
capabilities['os_version'] = options['os_version']
|
121
|
+
capabilities['browser'] = options['browser']
|
122
|
+
capabilities['browser_version'] = options['browser_version']
|
123
|
+
# -----
|
124
|
+
|
125
|
+
capabilities['browserstack.debug'] = options['debug']
|
126
|
+
capabilities['browserstack.video'] = options['video']
|
127
|
+
|
128
|
+
# At this point Quke does not support local testing so we specifically
|
129
|
+
# tell Browserstack we're not doing this
|
130
|
+
capabilities['browserstack.local'] = 'false'
|
131
|
+
capabilities
|
132
|
+
end
|
133
|
+
# rubocop:enable Metrics/AbcSize
|
134
|
+
# rubocop:enable Metrics/MethodLength
|
135
|
+
|
136
|
+
end
|
137
|
+
|
138
|
+
end
|
data/lib/quke/version.rb
ADDED
data/quke.gemspec
ADDED
@@ -0,0 +1,101 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'quke/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'quke'
|
8
|
+
spec.version = Quke::VERSION
|
9
|
+
spec.authors = ['Alan Cruikshanks']
|
10
|
+
spec.email = ['alan.cruikshanks@environment-agency.gov.uk']
|
11
|
+
|
12
|
+
spec.summary = 'A gem to simplify creating acceptance tests using /
|
13
|
+
Cucumber'
|
14
|
+
spec.description = 'Quke tries to simplify the process of writing and /
|
15
|
+
running acceptance tests by setting up Cucumber for /
|
16
|
+
you. /
|
17
|
+
It handles the config to allow you to run your tests /
|
18
|
+
in Firefox and Chrome, or the headless browser /
|
19
|
+
PhantomJS. It also has out of the box setup for /
|
20
|
+
using Browserstack automate. /
|
21
|
+
This leaves you to focus on just your features and
|
22
|
+
/ steps.'
|
23
|
+
spec.homepage = 'https://github.com/environmentagency/quke'
|
24
|
+
spec.license = 'Nonstandard'
|
25
|
+
|
26
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the
|
27
|
+
# 'allowed_push_host' to allow pushing to a single host or delete this section
|
28
|
+
# to allow pushing to any host.
|
29
|
+
if spec.respond_to?(:metadata)
|
30
|
+
spec.metadata['allowed_push_host'] = 'https://rubygems.org/'
|
31
|
+
else
|
32
|
+
raise 'RubyGems 2.0 or newer is required to protect /
|
33
|
+
against public gem pushes.'
|
34
|
+
end
|
35
|
+
|
36
|
+
spec.files = `git ls-files -z`
|
37
|
+
.split("\x0")
|
38
|
+
.reject { |f| f.match(%r{^(test|spec|features)/}) }
|
39
|
+
spec.bindir = 'exe'
|
40
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
41
|
+
spec.require_paths = ['lib']
|
42
|
+
|
43
|
+
spec.required_ruby_version = '>= 1.9'
|
44
|
+
|
45
|
+
# We need the cucumber gem to use cucumber, obviously!
|
46
|
+
spec.add_dependency 'cucumber', '~> 2.4'
|
47
|
+
|
48
|
+
# We use capybara to drive whichever browser we are using, and by drive we
|
49
|
+
# mean things like fill_in x, click_on y etc. Capybara makes it much easier to
|
50
|
+
# do this, though if you're willing to go a level lower you can write your own
|
51
|
+
# code to tell selenium how to interact with a web page
|
52
|
+
spec.add_dependency 'capybara', '~> 2.9'
|
53
|
+
|
54
|
+
# We bring in rspec-expectations to simplify how to actually test if a page is
|
55
|
+
# correct. For example you can test you are on the right page in a step using
|
56
|
+
# expect(page).to have_text 'Welcome to test nirvana!'
|
57
|
+
spec.add_dependency 'rspec-expectations', '~> 3.4'
|
58
|
+
|
59
|
+
# This is the first of our web drivers i.e. the bits that allow capybara to
|
60
|
+
# to drive an actual browser. Poltergeist is used with a headless browser
|
61
|
+
# called phantomjs, which is superfast and great for using on CI servers
|
62
|
+
# as it has no other dependencies
|
63
|
+
spec.add_dependency 'poltergeist', '~> 1.10'
|
64
|
+
|
65
|
+
# selenium-webdriver is used to drive real browsers that may be installed,
|
66
|
+
# for example Firefox, Chrome and Internet Explorer. The benefit of selenium
|
67
|
+
# is you can actually see the tests interacting with the browser, the downside
|
68
|
+
# is they run slower and isn't best suited to a CI environment.
|
69
|
+
spec.add_dependency 'selenium-webdriver', '~> 2.53'
|
70
|
+
|
71
|
+
# Needed when wishing to use Chrome for selenium tests. We could have chosen
|
72
|
+
# to install the chromedriver separately (and it seems more recent tutorials
|
73
|
+
# do it in that way). However in an effort to make using this gem as simple
|
74
|
+
# as possible we have gone with using the chromedriver-helper. To quote
|
75
|
+
# from it "Easy installation and use of chromedriver, the Chromium project's
|
76
|
+
# selenium webdriver adapter."
|
77
|
+
spec.add_dependency 'chromedriver-helper', '~> 1.0'
|
78
|
+
|
79
|
+
# Experience has shown that keeping tests dry helps make them more
|
80
|
+
# maintainable over time. One practice that helps is the use of the
|
81
|
+
# page object pattern. A page object wraps up all functionality for describing
|
82
|
+
# and interacting with a page into a single object. This object can then be
|
83
|
+
# referred to in the steps, rather than risk duplicating the logic in
|
84
|
+
# different steps. Site_Prism provides a page object framework, and we build
|
85
|
+
# it into the gem so users of Quke don't have to add and setup this dependency
|
86
|
+
# themselves
|
87
|
+
spec.add_dependency 'site_prism', '~> 2.9'
|
88
|
+
|
89
|
+
# Capybara includes a method called save_and_open_page. Without Launchy it
|
90
|
+
# will still save to file a copy of the source html of the page in question
|
91
|
+
# at that time. However simply adding this line into the gemfile means it
|
92
|
+
# will instead open in the default browser instead.
|
93
|
+
spec.add_dependency 'launchy', '~> 2.4'
|
94
|
+
|
95
|
+
spec.add_development_dependency 'bundler', '~> 1.12'
|
96
|
+
spec.add_development_dependency 'rake', '~> 10.5'
|
97
|
+
spec.add_development_dependency 'rdoc', '~> 4.2'
|
98
|
+
spec.add_development_dependency 'rspec', '~> 3.5'
|
99
|
+
spec.add_development_dependency 'codeclimate-test-reporter', '~> 0.6'
|
100
|
+
spec.add_development_dependency 'simplecov', '~> 0.12'
|
101
|
+
end
|
data/quke.png
ADDED
Binary file
|
metadata
ADDED
@@ -0,0 +1,274 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: quke
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Alan Cruikshanks
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-10-04 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: cucumber
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.4'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.4'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: capybara
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '2.9'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '2.9'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec-expectations
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.4'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.4'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: poltergeist
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.10'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.10'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: selenium-webdriver
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '2.53'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '2.53'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: chromedriver-helper
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '1.0'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '1.0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: site_prism
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '2.9'
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '2.9'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: launchy
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '2.4'
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '2.4'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: bundler
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '1.12'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '1.12'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: rake
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - "~>"
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '10.5'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - "~>"
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '10.5'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: rdoc
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - "~>"
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '4.2'
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - "~>"
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '4.2'
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: rspec
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - "~>"
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '3.5'
|
174
|
+
type: :development
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - "~>"
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: '3.5'
|
181
|
+
- !ruby/object:Gem::Dependency
|
182
|
+
name: codeclimate-test-reporter
|
183
|
+
requirement: !ruby/object:Gem::Requirement
|
184
|
+
requirements:
|
185
|
+
- - "~>"
|
186
|
+
- !ruby/object:Gem::Version
|
187
|
+
version: '0.6'
|
188
|
+
type: :development
|
189
|
+
prerelease: false
|
190
|
+
version_requirements: !ruby/object:Gem::Requirement
|
191
|
+
requirements:
|
192
|
+
- - "~>"
|
193
|
+
- !ruby/object:Gem::Version
|
194
|
+
version: '0.6'
|
195
|
+
- !ruby/object:Gem::Dependency
|
196
|
+
name: simplecov
|
197
|
+
requirement: !ruby/object:Gem::Requirement
|
198
|
+
requirements:
|
199
|
+
- - "~>"
|
200
|
+
- !ruby/object:Gem::Version
|
201
|
+
version: '0.12'
|
202
|
+
type: :development
|
203
|
+
prerelease: false
|
204
|
+
version_requirements: !ruby/object:Gem::Requirement
|
205
|
+
requirements:
|
206
|
+
- - "~>"
|
207
|
+
- !ruby/object:Gem::Version
|
208
|
+
version: '0.12'
|
209
|
+
description: |-
|
210
|
+
Quke tries to simplify the process of writing and /
|
211
|
+
running acceptance tests by setting up Cucumber for /
|
212
|
+
you. /
|
213
|
+
It handles the config to allow you to run your tests /
|
214
|
+
in Firefox and Chrome, or the headless browser /
|
215
|
+
PhantomJS. It also has out of the box setup for /
|
216
|
+
using Browserstack automate. /
|
217
|
+
This leaves you to focus on just your features and
|
218
|
+
/ steps.
|
219
|
+
email:
|
220
|
+
- alan.cruikshanks@environment-agency.gov.uk
|
221
|
+
executables:
|
222
|
+
- quke
|
223
|
+
extensions: []
|
224
|
+
extra_rdoc_files: []
|
225
|
+
files:
|
226
|
+
- ".codeclimate.yml"
|
227
|
+
- ".config.example.yml"
|
228
|
+
- ".gitignore"
|
229
|
+
- ".rspec"
|
230
|
+
- ".rubocop.yml"
|
231
|
+
- ".travis.yml"
|
232
|
+
- Gemfile
|
233
|
+
- LICENSE
|
234
|
+
- README.md
|
235
|
+
- Rakefile
|
236
|
+
- bin/console
|
237
|
+
- bin/setup
|
238
|
+
- exe/quke
|
239
|
+
- lib/features/support/after_hook.rb
|
240
|
+
- lib/features/support/after_step_hook.rb
|
241
|
+
- lib/features/support/env.rb
|
242
|
+
- lib/quke.rb
|
243
|
+
- lib/quke/configuration.rb
|
244
|
+
- lib/quke/cuke_runner.rb
|
245
|
+
- lib/quke/driver_registration.rb
|
246
|
+
- lib/quke/version.rb
|
247
|
+
- quke.gemspec
|
248
|
+
- quke.png
|
249
|
+
homepage: https://github.com/environmentagency/quke
|
250
|
+
licenses:
|
251
|
+
- Nonstandard
|
252
|
+
metadata:
|
253
|
+
allowed_push_host: https://rubygems.org/
|
254
|
+
post_install_message:
|
255
|
+
rdoc_options: []
|
256
|
+
require_paths:
|
257
|
+
- lib
|
258
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
259
|
+
requirements:
|
260
|
+
- - ">="
|
261
|
+
- !ruby/object:Gem::Version
|
262
|
+
version: '1.9'
|
263
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
264
|
+
requirements:
|
265
|
+
- - ">="
|
266
|
+
- !ruby/object:Gem::Version
|
267
|
+
version: '0'
|
268
|
+
requirements: []
|
269
|
+
rubyforge_project:
|
270
|
+
rubygems_version: 2.5.1
|
271
|
+
signing_key:
|
272
|
+
specification_version: 4
|
273
|
+
summary: A gem to simplify creating acceptance tests using / Cucumber
|
274
|
+
test_files: []
|