Skip to content

Commit 5bb625d

Browse files
committed
test: convert submit dir tests into Gherkin and add step definitions
1 parent 6a524f7 commit 5bb625d

26 files changed

Lines changed: 567 additions & 470 deletions
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
@sanity @nightly-sanity @address-validation
2+
Feature: Address validation
3+
4+
Background:
5+
Given I am on the Giftaid page
6+
And I select Giftaid
7+
And I enter supporter details
8+
9+
Scenario: Empty postcode should show error message
10+
When I clear the postcode field
11+
And I submit the Giftaid form
12+
Then I should see postcode error message "Please enter your postcode"
13+
14+
Scenario Outline: Invalid postcodes should show error messages
15+
When I enter postcode "<postcode>"
16+
Then I should see postcode error message "<message>"
17+
18+
Examples:
19+
| postcode | message |
20+
| 12SE17TP | Please enter a valid UK postcode, using a space. For non-UK addresses, please use manual entry below. |
21+
| comic relief | Please enter a valid UK postcode, using a space. For non-UK addresses, please use manual entry below. |
22+
| cro 7tp | Please enter a valid UK postcode, using a space. For non-UK addresses, please use manual entry below. |
23+
24+
Scenario: Enter postcode but submit without selecting address should show error message
25+
When I enter postcode "SE1 7TP"
26+
And I search for the postcode
27+
Then I should see the address dropdown
28+
When I submit the Giftaid form
29+
Then I should see address select error message "Please select your address"
30+
31+
Scenario: Clicking on manual address link should show address fields
32+
When I enter postcode "SE1 7TP"
33+
Then I should see the manual address link
34+
When I click the manual address link
35+
Then I should see the manual address fields
36+
37+
Scenario: Invalid address fields should show error messages
38+
When I enter postcode "SE1 7TP"
39+
And I click the manual address link
40+
And I enter invalid address line 1
41+
Then I should see address line 1 error message
42+
When I enter invalid town
43+
Then I should see town error message

playwright-staging/tests/features/submit/addressValidation.spec.js

Lines changed: 0 additions & 76 deletions
This file was deleted.
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
@sanity @nightly-sanity @form-validation
2+
Feature: Giftaid form validation
3+
4+
Background:
5+
Given I am on the Giftaid page
6+
And I select Giftaid
7+
8+
Scenario Outline: Invalid mobile numbers should show error message
9+
When I enter mobile number "<mobile>"
10+
Then I should see mobile error message "<message>"
11+
12+
Examples:
13+
| mobile | message |
14+
| 0712345678 | Please enter a valid mobile phone number - it must be the same number associated with your donation. |
15+
| 0712345678900 | Please enter a valid mobile phone number - it must be the same number associated with your donation. |
16+
| 0712 345 6789 | Please enter a valid mobile phone number - it must be the same number associated with your donation. |
17+
| 0780ab5694245 | Please enter a valid mobile phone number - it must be the same number associated with your donation. |
18+
19+
Scenario: Valid mobile number should submit the form
20+
When I complete the Giftaid form with mobile number "07123456789"
21+
And I submit the Giftaid form
22+
Then I should see the Giftaid thank you message
23+
24+
Scenario Outline: Invalid first name values should show error message
25+
When I enter first name "<firstName>"
26+
Then I should see first name error message "<message>"
27+
28+
Examples:
29+
| firstName | message |
30+
| Test^$%£ | This field only accepts 25 alphabetic characters and ' - starting with alphabetic characters |
31+
| SPACE | This field only accepts 25 alphabetic characters and ' - starting with alphabetic characters |
32+
| 123Test | This field only accepts 25 alphabetic characters and ' - starting with alphabetic characters |
33+
34+
Scenario: Valid first name should submit the form
35+
When I complete the Giftaid form with first name "testFirstname"
36+
And I submit the Giftaid form
37+
Then I should see thank you message for "testFirstname"
38+
39+
Scenario Outline: Invalid last name values should show error message
40+
When I enter last name "<lastName>"
41+
Then I should see last name error message "<message>"
42+
43+
Examples:
44+
| lastName | message |
45+
| Test^$%£ | This field only accepts 25 alphanumeric characters and , . ( ) / & ' - starting with alphanumeric characters |
46+
| SPACE | This field only accepts 25 alphanumeric characters and , . ( ) / & ' - starting with alphanumeric characters |
47+
48+
Scenario: Alphanumeric last name should not show error message
49+
When I enter last name "123Test"
50+
Then I should not see last name error message
51+
52+
Scenario: Valid last name should submit the form
53+
When I complete the Giftaid form with valid details
54+
And I submit the Giftaid form
55+
Then I should see the Giftaid thank you message

playwright-staging/tests/features/submit/formValidation.spec.js

Lines changed: 0 additions & 83 deletions
This file was deleted.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
@sanity @nightly-sanity @international
2+
Feature: International address validation
3+
4+
Scenario: Selecting a non-UK country and entering a non-UK postcode should submit the form
5+
Given I am on the Giftaid page
6+
And I select Giftaid
7+
And I enter supporter details
8+
When I enter a non UK postcode
9+
Then I should see postcode validation error for UK format
10+
When I enter international address details manually
11+
And I select a non UK country
12+
Then postcode error should disappear
13+
When I select marketing preferences
14+
And I submit the Giftaid form
15+
Then I should see the Giftaid thank you message

playwright-staging/tests/features/submit/internationalAddressesValidation.spec.js

Lines changed: 0 additions & 57 deletions
This file was deleted.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
@sanity @nightly-sanity @marketing-preferences-data @contact-store
2+
Feature: Giftaid marketing preferences contact-store verification
3+
4+
Scenario: Verify giftaid marketing preferences data in contact-store
5+
Given I am on the Giftaid page
6+
And I select Giftaid
7+
When I populate the Giftaid form with generated supporter details
8+
And I select generated marketing preferences
9+
And I submit the Giftaid form
10+
Then I should see the generated supporter thank you message
11+
And the marketing preferences data should be stored in contact-store

0 commit comments

Comments
 (0)