Sha256: 9857d8aba4c56f3a09009a96263cbdc074b1f18b2ff7bd9d46d1b9895ad92f00

Contents?: true

Size: 1.36 KB

Versions: 5

Compression:

Stored size: 1.36 KB

Contents

module SharedLoginScreen
  def verify_page_ui
    super
    ui = {
      header_label   => { visible: true, caption: 'Login' },
      username_label => { visible: true, caption: 'Username' },
      username_field => { visible: true, enabled: true },
      password_label => { visible: true, caption: 'Password' },
      password_field => { visible: true, enabled: true },
      login_button   => { visible: true, enabled: true, caption: 'Login' }
    }
    verify_ui_states(ui)
  end

  def login(username, password)
    fields = {
      username_field => username,
      password_field => password
    }
    populate_data_fields(fields)
    login_button.tap
  end

  def verify_entry_error(reason)
    ui = case reason.gsub(/\s+/, '_').downcase.to_sym
         when :invalid_password, :invalid_user
           { generic_error => { visible: true, caption: 'Provided credentials do not match any user in this service.' } }
         when :locked_account
           { generic_error => { visible: true, caption: 'Sorry, this user has been locked out.' } }
         when :no_username
           { username_error => { visible: true, caption: 'Username is required' } }
         when :no_password
           { password_error => { visible: true, caption: 'Password is required' } }
         else
           raise "#{reason} is not a valid selector"
         end
    verify_ui_states(ui)
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
testcentricity-3.0.4 features/support/shared_components/screens/login_screen.rb
testcentricity-3.0.3 features/support/shared_components/screens/login_screen.rb
testcentricity-3.0.2 features/support/shared_components/screens/login_screen.rb
testcentricity-3.0.1 features/support/shared_components/screens/login_screen.rb
testcentricity-3.0.0 features/support/shared_components/screens/login_screen.rb