update for features

+ added flash/message assertions
+ adjusted urls to be http://google.com for tests for now
+ added @db-test tags to tests that use db interactions
+ added a scenario for duplicate URLs being used
+ added before and after steps to init and clean up db tests
+ added initialization of a test db for tests instead of interacting
  with the production database
This commit is contained in:
2023-10-03 15:58:56 -07:00
parent 8639c785b7
commit 8b2780820c
3 changed files with 49 additions and 1 deletions
+14 -1
View File
@@ -7,6 +7,7 @@ Feature: Homepage
Scenario: Homepage Loads with a form
Given I visit the "/" page
Then I should see text "URL Shortener"
And I should see the message "Enter a URL"
And I should see a form field "url"
And I should see a "Submit" button
@@ -14,9 +15,21 @@ Feature: Homepage
Given I visit the "/" page
When I click the "Submit" button
Then I should be on "/" page
And I should see the message "Please enter a valid URL"
@db-test
Scenario: Submitting the form with a correct URL
Given I visit the "/" page
When I type "http://google.com/" in the "url" field
When I type "http://google.com" in the "url" field
And I click the "Submit" button
Then I should be on "/create" page
And I should see the message "Link created"
@db-test
Scenario: Submitting the form with an existing URL
Given I visit the "/" page
And A link already exists with the url "http://google.com"
When I type "http://google.com" in the "url" field
And I click the "Submit" button
Then I should be on "/create" page
And I should see the message "Link exists"