-
Notifications
You must be signed in to change notification settings - Fork 225
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
62b726e
commit 5e7f521
Showing
1 changed file
with
89 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
Feature: Userforms | ||
As a website user | ||
I want to user userforms | ||
|
||
Background: | ||
Given the "group" "EDITOR group" has permissions "CMS_ACCESS_LeftAndMain" | ||
# TODO: remove | ||
Given I take a screenshot after every step | ||
|
||
@sboyd | ||
Scenario: Operate userforms | ||
Given I am logged in with "ADMIN" permissions | ||
When I go to "/admin/pages" | ||
And I press the "Add new" button | ||
And I select the "User Defined Form" radio button | ||
And I press the "Create" button | ||
And I fill in "Page name" with "My userform" | ||
And I press the "Save" button | ||
|
||
When I click the "Recipients" CMS tab | ||
And I press the "Add Email Recipient" button | ||
And I fill in "Type subject" with "New userform submission" | ||
And I fill in "Type to address" with "[email protected]" | ||
And I fill in "Send email from" with "[email protected]" | ||
And I press the "Create" button | ||
And I follow "My userform" | ||
|
||
When I click the "Form Fields" CMS tab | ||
And I press the "Add Field" button | ||
And I press the "Add Field" button | ||
When I fill in "Form_Fields_GridFieldEditableColumns_2_Title" with "My textfield 1" | ||
When I fill in "Form_Fields_GridFieldEditableColumns_3_Title" with "My textfield 2" | ||
And I press the "Save" button | ||
When I press the "Add Page Break" button | ||
And I press the "Add Field" button | ||
And I fill in "Form_Fields_GridFieldEditableColumns_4_Title" with "Second Page" | ||
When I fill in "Form_Fields_GridFieldEditableColumns_5_Title" with "My textfield 3" | ||
And I press the "Save" button | ||
|
||
# Edit My textfield 3 | ||
When I click on the ".ss-gridfield-item[data-id='5'] .edit-link" element | ||
And I click the "Validation" CMS tab | ||
And I check "Is this field Required?" | ||
And I press the "Save" button | ||
And I follow "My userform" | ||
|
||
# Drag and drop my text field 2 to Page Two | ||
Then I drag the ".ss-gridfield-item[data-id='3'] .handle" element to the ".ss-gridfield-item[data-id='5'] .handle" element | ||
And I press the "Publish" button | ||
|
||
# View frontend | ||
When I go to "/my-userform" | ||
Then I should see "Page 1 of 2" | ||
Then I should see "First Page" | ||
And I should not see "Second Page" | ||
And I should see "My textfield 1" | ||
And I should not see "My textfield 2" | ||
And I should not see "My textfield 3" | ||
|
||
# Pressing '2' buton should do nothing at this stage | ||
When I press the "2" button | ||
Then I should see "First Page" | ||
|
||
When I press the "Next" button | ||
Then I should see "Page 2 of 2" | ||
Then I should not see "First Page" | ||
And I should see "Second Page" | ||
And I should not see "My textfield 1" | ||
And I should see "My textfield 2" | ||
And I should see "My textfield 3" | ||
|
||
When I press the "1" button | ||
Then I should see "First Page" | ||
When I press the "2" button | ||
Then I should see "Second Page" | ||
When I press the "Prev" button | ||
Then I should see "First Page" | ||
|
||
When I fill in "My textfield 1" with "My value 1" | ||
And I press the "Next" button | ||
And I fill in "My textfield 2" with "My value 2" | ||
And I press the "Submit" button | ||
Then I should see "'My textfield 3' is required" | ||
|
||
When I fill in "My textfield 3" with "My value 3" | ||
And I press the "Submit" button | ||
Then I should see "Thanks, we've received your submission." | ||
|
||
And there should be an email to "[email protected]" titled "New userform submission" |