From 52a6bac85f32d6d71b8d2ef062fa8ed19ced18d5 Mon Sep 17 00:00:00 2001 From: Adam Townsend Date: Mon, 2 Oct 2023 11:37:19 -0700 Subject: [PATCH] added 3rd test case for submitting a url --- features/homepage.feature | 9 +++++++-- features/step_definitions/steps.rb | 4 ++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/features/homepage.feature b/features/homepage.feature index 3322c55..9215df1 100644 --- a/features/homepage.feature +++ b/features/homepage.feature @@ -5,13 +5,18 @@ Feature: Homepage Loading the homepage is the initial starting point for this tool Scenario: Homepage Loads with a form - Given I visit the '/' page + Given I visit the "/" page Then I should see text "URL Shortener" And I should see a form field "url" And I should see a "Submit" button Scenario: Submitting the form without entering a URL - Given I visit the '/' page + Given I visit the "/" page When I click the "Submit" button Then I should be on "/" page + Scenario: Submitting the form with a correct URL + Given I visit the "/" page + When I type "http://google.com/" in the "url" field + And I click the "Submit" button + Then I should be on "/create" page diff --git a/features/step_definitions/steps.rb b/features/step_definitions/steps.rb index 7698ccb..0e99923 100644 --- a/features/step_definitions/steps.rb +++ b/features/step_definitions/steps.rb @@ -10,6 +10,10 @@ When('I click the {string} button') do |string| click_button {string} end +When('I type {string} in the {string} field') do |email_txt, email_field| + fill_in email_field, with: email_txt +end + # THEN Then('I should see text {string}') do |string|