diff --git a/README.md b/README.md index cc282df..6bbee47 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/lib/skeleton/Gemfile b/lib/skeleton/Gemfile index 2e0090a..86c16e1 100644 --- a/lib/skeleton/Gemfile +++ b/lib/skeleton/Gemfile @@ -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' @@ -18,4 +18,6 @@ group :test do gem 'pry' gem 'pry-byebug' gem 'headless' + gem 'allure-cucumber' + gem 'allure-ruby-adaptor-api' end diff --git a/lib/skeleton/README.md b/lib/skeleton/README.md index 3735223..e973c98 100644 --- a/lib/skeleton/README.md +++ b/lib/skeleton/README.md @@ -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 ### @@ -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 +``` +The report will be generated to allure-report folder. You can change the destination folder using -o flag: +```shell +allure generate -o +``` + +The report will be generated to allure-report folder. You can change the destination folder using -o flag: +```shell +allure open +``` +More information read item 13.1.2 of the [Allure documentation](https://docs.qameta.io/allure/#_configuration_3) diff --git a/lib/skeleton/features/support/env.rb b/lib/skeleton/features/support/env.rb index 8161fca..2720288 100644 --- a/lib/skeleton/features/support/env.rb +++ b/lib/skeleton/features/support/env.rb @@ -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') diff --git a/lib/skeleton/features/support/hooks.rb b/lib/skeleton/features/support/hooks.rb index 6940ea3..8355e53 100644 --- a/lib/skeleton/features/support/hooks.rb +++ b/lib/skeleton/features/support/hooks.rb @@ -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 @@ -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