Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ You can create the baseline_images if you include the tag `@create_baseline_imag
You can crop a screenshot around element, just only use `take_screenshot_and_crop` method:
`take_screenshot_and_crop(name_file, folder_to_save, css_selector)`


## TODO

1. Run tests in Remote Server
Expand Down
8 changes: 5 additions & 3 deletions lib/skeleton/Gemfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
source 'https://rubygems.org'

group :test do
gem 'ffi', '1.9.14'
gem 'capybara'
gem 'ffi', '1.9.25'
gem 'capybara', '3.5.1'
gem 'cucumber'
gem 'rake'
gem 'selenium-webdriver'
gem 'site_prism'
gem 'site_prism', '~> 2.17', '>= 2.17.1'
gem 'rspec'
gem 'syntax'
gem 'poltergeist'
Expand All @@ -18,4 +18,6 @@ group :test do
gem 'pry'
gem 'pry-byebug'
gem 'headless'
gem 'allure-cucumber'
gem 'allure-ruby-adaptor-api'
end
23 changes: 22 additions & 1 deletion lib/skeleton/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ Install and include in PATH
- [internetExplorerDriver](http://www.seleniumhq.org/download/)
- [Firefox Geckodriver](https://developer.mozilla.org/en-US/docs/Mozilla/QA/Marionette/WebDriver)

Install [Webdriver Safari extension](http://selenium-release.storage.googleapis.com/2.48/SafariDriver.safariextz).
- Install [Webdriver Safari extension](http://selenium-release.storage.googleapis.com/2.48/SafariDriver.safariextz).
- Install [Allure Report](https://docs.qameta.io/allure/#_installation_11)


### Run tests in DEV with Chrome ###
Expand Down Expand Up @@ -128,3 +129,23 @@ Type this in the tests folder:
```shell
bundle exec cucumber --tags @run
```

### Allure Report ###
In the cucumber.yml file change the value of html_report
```shell
html_report: --format AllureCucumber::Formatter --out
```
To generate the report from existing Allure results you can use the following command:
```shell
allure generate <directory-with-results>
```
The report will be generated to allure-report folder. You can change the destination folder using -o flag:
```shell
allure generate <directory-with-results> -o <directory-with-report>
```

The report will be generated to allure-report folder. You can change the destination folder using -o flag:
```shell
allure open <directory-with-report>
```
More information read item 13.1.2 of the [Allure documentation](https://docs.qameta.io/allure/#_configuration_3)
19 changes: 19 additions & 0 deletions lib/skeleton/features/support/env.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,29 @@
require 'chunky_png'
require 'os'
require 'headless'
require 'allure-cucumber'

BROWSER = ENV['BROWSER']
ENVIRONMENT_TYPE = ENV['ENVIRONMENT_TYPE']

## Configure Allure
class Cucumber::Core::Test::Step
def name
return text if self.text == 'Before hook'
return text if self.text == 'After hook'
"#{source.last.keyword}#{text}"
end
end

AllureCucumber.configure do |c|
#Generate the XML in the reports directory and not in the allure pattern
c.output_dir = "reports"
c.clean_dir = false
c.tms_prefix = '@TMS:'
c.issue_prefix = '@ISSUE:'
c.severity_prefix = '@SEVERITY:'
end

## register driver according with browser chosen
Capybara.register_driver :selenium do |app|
if BROWSER.eql?('chrome')
Expand Down
4 changes: 3 additions & 1 deletion lib/skeleton/features/support/hooks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Before do |_feature|
## variable which loads the data file according to the environment
CONFIG = YAML.load_file(File.dirname(__FILE__) + "/config/#{ENVIRONMENT_TYPE}.yaml")
CONFIG ||= YAML.load_file(File.dirname(__FILE__) + "/config/#{ENVIRONMENT_TYPE}.yaml")

I18n.config.available_locales = :en

Expand All @@ -23,6 +23,8 @@
## take screenshot if scenario fail
if scenario.failed?
@helper.take_screenshot(scenario.name, 'screenshots/test_failed')
include AllureCucumber::DSL
embed(File.open("screenshots/test_failed/" + scenario.name + ".png"),'image/png', scenario.name + ".png")
end
end

Expand Down