Accelerate Your Debugging with Pry

This video is not available. Please contact the instructor for more information.

Sample code: https://github.com/cucumber-mastery/lesson_pry

Video blurry? Right click on the video and select "720p" or "1080p" for sharper video.

How was this lesson?

Let me know in the comments below!


#Gemfile 

source "https://rubygems.org"

gem "cucumber"
gem "watir-webdriver"
gem "pry"


# features/support/env.rb

require 'watir-webdriver'
require 'pry'

After do
  @browser.close
end


# features/submit_expense.feature

Feature: Submit an expense with a receipt

  As a user I want to upload expenses so I can get reimbursed.

  Scenario: Happy Path
    Given I am logged in to the expense application
    When I click the "+" button
    And I select the receipt
    And I fill out the merchant, total and date
    And I click "SAVE"
    Then I should see my expensed item show up in the tables


#features/step_definitions/steps.rb

Given(/^I am logged in to the expense application$/) do
  @browser = Watir::Browser.new :chrome
  @browser.goto "https://wc.demo.vaadin.com/expense-manager/#/d3b8b65d89"
end
When(/^I click the "([^"]*)" button$/) do |arg1|
  Watir::Wait.until { @browser.element(css: "body/deep/paper-fab").exist? }
  @browser.element(css: "body/deep/paper-fab").click
end
When(/^I select the receipt$/) do
  binding.pry
end
When(/^I fill out the merchant, total and date$/) do
  pending # Write code here that turns the phrase above into concrete actions
end
When(/^I click "([^"]*)"$/) do |arg1|
  pending # Write code here that turns the phrase above into concrete actions
end
Then(/^I should see my expensed item show up in the tables$/) do
  pending # Write code here that turns the phrase above into concrete actions
end

Complete and Continue