With the function below, I can receive a print of the last execution of the test, however I want to learn how to receive a print at every step executed by the automation.
How can this be done?
env.rb
# encoding: utf-8
require 'watir'
require 'rspec'
hooks.rb
# coding: utf-8
require 'json'
require 'magic_encoding'
require 'win32console'
require 'watir'
require 'rspec'
browser = Watir::Browser.new
browser.driver.manage.window.maximize
Before do
@browser
@browser = browser
end
After do |_scenario|
browser.screenshot.save 'screenshot.png'
embed 'screenshot.png', 'image/png'
end
login.rb
given("que estou na tela de login") do
@browser.goto "url"
#I want a screenshot of this step
end
There is an
AfterStephook if you want to do an action after each step - eg: