Scenario outline does not work when run directly in class with Ruby

103 Views Asked by At

When I run my Outline Scenario directly from step_definition it works but if I implement it in the class it doesn't. When I run the class method I get the following error: undefined local variable or method _email' for #<CriaScreenLogin:0x0000016956d426f8> (NameError) ./features/pages/page_login.rb:49:in invalid_login'

See my code from step_defintion work fine
When('to provide {string} or {string} inválids') do |_email, _pswd|
  screen_login.input_user.set(_email).send_keys(:tab)
  screen_login.input_pswd.set(_pswd).send_keys(:tab)
  screen_login. btn_enter.click
end

my code from class (site-prism)
class CreateScreenLogin < SitePrism::Page

  include RSpec::Mocks::ExampleMethods::ExpectHost
  include RSpec::Matchers 

  element :input_user,                        "#usuario"  
  element :input_pswd,                         "#senha"
  element :btn_enter,                        "#btn-submit" 
     
  def invalid_login
     input_user.set(_email).send_keys(:tab)
     input_pswd.set(_pswd).send_keys(:tab)
     btn_enter.click
   end

Screen_login.invalid_login   #error
0

There are 0 best solutions below