url-shortener/features/homepage.feature

42 lines
1.4 KiB
Gherkin

# features/home.feature
Feature: Homepage
Loading the homepage is the initial starting point for this tool
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
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: Accessing the URL based on the shortcode
Given A link already exists with the url "https://google.com" and code "aaaaaa"
When I visit the "/aaaaaa" location
Then I should be redirected to "https://google.com"