Skip to content

Commit

Permalink
MNT Add behat test for form validation
Browse files Browse the repository at this point in the history
  • Loading branch information
GuySartorelli committed Aug 8, 2023
1 parent cbccd37 commit c61ddbd
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions tests/behat/features/validation.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
Feature: Form validation
As a content author
I want form validation to work in the CMS
So that I know my data is sane

Background:
Given the "Company" "Walmart" with "Category"="Retail"
And the "Company" "ExxonMobil" with "Category"="Oil"
And the "Company" "Vitol" with "Category"="Other"
And the "group" "EDITOR" has permissions "Access to 'Pages' section" and "Access to 'Test ModelAdmin' section" and "TEST_DATAOBJECT_EDIT"
And I am logged in as a member of "EDITOR" group
And I go to "/admin/test/SilverStripe-FrameworkTest-Model-Employee"
And I press the "Add Employee" button

@gsat
Scenario: Field validation works as expected even if no validator is explicitly declared
When I fill in "Name" with "any name"
And I fill in "Email" with "invalid email"
And I press the "Create" button
Then I should not see "Saved Employee"
And I should see "Please enter an email address"

And I fill in "Email" with "email@example.com"
And I press the "Create" button
Then I should see "Saved Employee"
And I should not see "Please enter an email address"

0 comments on commit c61ddbd

Please sign in to comment.