From 72f3e03edd2635cd2607b35298fa36f6f3b44050 Mon Sep 17 00:00:00 2001 From: Adam Townsend Date: Thu, 12 Oct 2023 23:42:04 -0700 Subject: [PATCH] added tests for invalid URL entries + URL that returns a 404 + URL where the domain does not resolve with DNS + URL that is not properly formatted --- features/submit.feature | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/features/submit.feature b/features/submit.feature index 422e082..7bbbf69 100644 --- a/features/submit.feature +++ b/features/submit.feature @@ -26,3 +26,27 @@ Feature: Submit And I click the "Submit" button Then I should be on "/create" page And I should see the message "Link exists" + + @db-test + Scenario: Submitting the form with a URL that is 404 + Given I visit the "/" page + When I type "http://google.com/example" in the "url" field + And I click the "Submit" button + Then I should be on "/" page + And I should see the message "URL not found" + + @db-test + Scenario: Submitting the form with a URL that does not resolve + Given I visit the "/" page + When I type "http://bad.tld" in the "url" field + And I click the "Submit" button + Then I should be on "/" page + And I should see the message "URL does not resolve" + + @db-test + Scenario: Submitting the form with an invalid URL + Given I visit the "/" page + When I type "not-an-url" in the "url" field + And I click the "Submit" button + Then I should be on "/" page + And I should see the message "Invalid URL"