53 lines
1.7 KiB
Gherkin
53 lines
1.7 KiB
Gherkin
# features/submit.feature
|
|
|
|
Feature: Submit
|
|
|
|
Submitting URL's on the homepage
|
|
|
|
Scenario: Submitting the form without entering a URL
|
|
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
|
|
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"
|
|
|
|
@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"
|