Sha256: a31e17a15f933d165617d586ece7b50269dad09e96ddb4097c73deb7cb9c49a6

Contents?: true

Size: 1.9 KB

Versions: 3

Compression:

Stored size: 1.9 KB

Contents

include TestCentricity


Given(/^I have launched the SauceLabs My Demo app$/) do
  # activate the app
  AppiumConnect.launch_app
end


When(/^I (?:load|am on) the (.*) (?:page|screen)$/) do |screen_name|
  # find and load the specified target page/screen
  target_page = PageManager.find_page(screen_name)
  target_page.load_page
end


When(/^I (?:click|tap) the ([^\"]*) navigation menu item$/) do |screen_name|
  # find and navigate to the specified target page/screen
  target_page = PageManager.find_page(screen_name)
  target_page.navigate_to
end


Then(/^I expect the (.*) (?:page|screen) to be correctly displayed$/) do |screen_name|
  # find and verify that the specified target page/screen is loaded
  target_page = PageManager.find_page(screen_name)
  target_page.verify_page_exists
  # verify that target page/screen is correctly displayed
  target_page.verify_page_ui
end


When(/^I enter user credentials with (.*)$/) do |reason|
  case reason.gsub(/\s+/, '_').downcase.to_sym
  when :valid_data
    username = 'bob@example.com'
    password = '10203040'
  when :invalid_user
    username = 'iggy.snicklefritz@example.com'
    password = '10203040'
  when :locked_account
    username = 'alice@example.com'
    password = '10203040'
  when :no_username
    password = '10203040'
  when :no_password
    username = 'bob@example.com'
  else
    raise "#{reason} is not a valid selector"
  end
  login_screen.login(username, password)
end


Then(/^I expect an error to be displayed due to (.*)$/) do |reason|
  PageManager.current_page.verify_entry_error(reason)
end


When(/^I (.*) the navigation menu$/) do |action|
  PageManager.current_page.nav_menu_action(action)
end


Then(/^I expect the navigation menu to be correctly displayed$/) do
  PageManager.current_page.verify_nav_menu(state = :displayed)
end


Then(/^I expect the navigation menu to be hidden$/) do
  PageManager.current_page.verify_nav_menu(state = :closed)
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
testcentricity-3.0.2 features/step_definitions/generic_steps.rb
testcentricity-3.0.1 features/step_definitions/generic_steps.rb
testcentricity-3.0.0 features/step_definitions/generic_steps.rb