@@ -10,7 +10,7 @@ module.exports = {
1010 client . setValue ( '#field-input--mobile' , '07123456789' ) ;
1111 client . setValue ( '#field-input--firstname' , 'test' ) ;
1212 client . setValue ( '#field-input--lastname' , 'user' ) ;
13- client . setValue ( '#field-input--postcode' , 'se17tp ' ) ;
13+ client . setValue ( '#field-input--postcode' , 'SE1 7TP ' ) ;
1414 client . click ( '#postcode_button' ) ;
1515 client . waitForElementVisible ( 'select#field-select--addressSelect' , 1000 ) ;
1616 client . expect . element ( 'label#field-label--addressSelect' ) . text . to . equal ( 'Select your address' ) ;
@@ -32,7 +32,7 @@ module.exports = {
3232 client . setValue ( '#field-input--mobile' , '07123456789' ) ;
3333 client . setValue ( '#field-input--firstname' , 'test' ) ;
3434 client . setValue ( '#field-input--lastname' , 'user' ) ;
35- client . setValue ( '#field-input--postcode' , 'se17tp ' ) ;
35+ client . setValue ( '#field-input--postcode' , 'SE1 7TP ' ) ;
3636 client . click ( 'a[aria-describedby=field-error--addressDetails]' ) ;
3737 client . waitForElementPresent ( '#field-input--address1' , 1000 ) ;
3838 client . setValue ( '#field-input--address1' , '21 test road' ) ;
@@ -54,62 +54,63 @@ module.exports = {
5454 client . setValue ( '#field-input--mobile' , '07123456789' ) ;
5555 client . setValue ( '#field-input--firstname' , 'test' ) ;
5656 client . setValue ( '#field-input--lastname' , 'user' ) ;
57- // postcode entered in lowercase should not show error message
57+
58+ // postcode entered in lowercase should show error message
5859 client . setValue ( '#field-input--postcode' , 'se17tp' ) ;
59- client . click ( '#postcode_button' ) ;
60- client . assert . not . elementPresent ( 'div#field-error--postcode > span' ) ;
60+ client . assert . textContains ( 'div#field-error--postcode > span' , 'Please enter a valid UK postcode, using a space and capital letters' ) ;
6161 client . clearValue ( '#field-input--postcode' ) ;
62- // postcode entered in uppercase should not show error message
62+
63+ // postcode entered in uppercase should show error message
6364 client . setValue ( '#field-input--postcode' , 'SE17TP' ) ;
64- client . click ( '#postcode_button' ) ;
65- client . assert . not . elementPresent ( 'div#field-error--postcode > span' ) ;
65+ client . assert . textContains ( 'div#field-error--postcode > span' , 'Please enter a valid UK postcode, using a space and capital letters' ) ;
6666 client . clearValue ( '#field-input--postcode' ) ;
67+
6768 // postcode with valid spaces should not show error message
6869 client . setValue ( '#field-input--postcode' , 'SE1 7TP' ) ;
69- client . click ( '#postcode_button' ) ;
7070 client . assert . not . elementPresent ( 'div#field-error--postcode > span' ) ;
7171 client . clearValue ( '#field-input--postcode' ) ;
72- // postcode with extra spaces as long as the value is right should not show error message
72+
73+ // postcode with extra spaces should not show error message
7374 client . setValue ( '#field-input--postcode' , 'SE 1 7TP' ) ;
74- client . click ( '#postcode_button' ) ;
75- client . assert . not . elementPresent ( 'div#field-error--postcode > span' ) ;
75+ client . assert . textContains ( 'div#field-error--postcode > span' , 'Please enter a valid UK postcode, using a space and capital letters' ) ;
7676 client . clearValue ( '#field-input--postcode' ) ;
77+
7778 // postcode with extra numbers in first part should show error message
7879 client . setValue ( '#field-input--postcode' , 'SE 134 7TP' ) ;
79- client . click ( '#postcode_button' ) ;
8080 client . expect . element ( 'div#field-error--postcode > span' ) . text . to . equal ( 'Please enter a valid UK postcode, using a space and capital letters' ) ;
8181 client . clearValue ( '#field-input--postcode' ) ;
82+
8283 // postcode with 3 numbers in second part should show error message
8384 client . setValue ( '#field-input--postcode' , 'SE1 777TP' ) ;
84- client . click ( '#postcode_button' ) ;
8585 client . expect . element ( 'div#field-error--postcode > span' ) . text . to . equal ( 'Please enter a valid UK postcode, using a space and capital letters' ) ;
8686 client . clearValue ( '#field-input--postcode' ) ;
87+
8788 // postcode with 2 numbers in second part should show error message
8889 client . setValue ( '#field-input--postcode' , 'SE1 77TP' ) ;
89- client . click ( '#postcode_button' ) ;
90- client . expect . element ( 'div#field-error--postcode > span' ) . text . to . equal ( 'Sorry, we could not find any addresses in that postcode, please check the postcode, or use the manual entry' ) ;
90+ client . expect . element ( 'div#field-error--postcode > span' ) . text . to . equal ( 'Please enter a valid UK postcode, using a space and capital letters' ) ;
91+ client . clearValue ( '#field-input--postcode' ) ;
92+
93+ // postcode with special characters should show error message
94+ client . setValue ( '#field-input--postcode' , 'SE1@£7tp' ) ;
95+ client . expect . element ( 'div#field-error--postcode > span' ) . text . to . equal ( 'Please enter a valid UK postcode, using a space and capital letters' ) ;
96+ client . clearValue ( '#field-input--postcode' ) ;
97+
98+ // valid postcode with lower and uppercase characters should not show error message
99+ client . setValue ( '#field-input--postcode' , 'sE17tP' ) ;
100+ client . expect . element ( 'div#field-error--postcode > span' ) . text . to . equal ( 'Please enter a valid UK postcode, using a space and capital letters' ) ;
91101 client . clearValue ( '#field-input--postcode' ) ;
92102
93- // TODO: commenting out validation steps temporarily
94- // // postcode with special characters should show error message
95- // client.setValue('#field-input--postcode', 'SE1@£7tp');
96- // client.click('#postcode_button');
97- // client.expect.element('div#field-error--postcode > span').text.to.equal('Please enter a valid postcode');
98- // client.clearValue('#field-input--postcode');
99- // // valid postcode with lower and uppercase characters should not show error message
100- // client.setValue('#field-input--postcode', 'sE17tP');
101- // client.click('#postcode_button');
102- // client.assert.not.elementPresent('div#field-error--postcode > span');
103- // client.clearValue('#field-input--postcode');
104103 // submit form with valid postcode but not entering address field should show error messages on address fields
105- client . setValue ( '#field-input--postcode' , 'SE17TP ' ) ;
104+ client . setValue ( '#field-input--postcode' , 'SE1 7TP ' ) ;
106105 client . click ( 'button[type="submit"]' ) ;
107- client . expect . element ( 'div#field-error--addressSelect > span' ) . text . to . equal ( 'Please select your address' ) ;
108- client . expect . element ( 'a[aria-describedby=field-error--addressDetails]' ) . text . to . equal ( 'Or enter your address manually' ) ;
106+ client . expect . element ( 'div#field-error--addressDetails > span' ) . text . to . equal ( 'Please fill in your address' ) ;
107+
109108 // click enter address manually link to see the error messages
109+ client . expect . element ( 'a[aria-describedby=field-error--addressDetails]' ) . text . to . equal ( 'Or enter your address manually' ) ;
110110 client . click ( 'a[aria-describedby=field-error--addressDetails]' ) ;
111111 client . expect . element ( 'div#field-error--address1 > span' ) . text . to . equal ( 'Please fill in your address line 1' ) ;
112112 client . expect . element ( 'div#field-error--town > span' ) . text . to . equal ( 'Please fill in your town/city' ) ;
113+
113114 // enter address fields with valid inputs should not show error messages
114115 client . setValue ( 'input#field-input--address1' , 'COMIC RELIEF' ) ;
115116 client . assert . not . elementPresent ( 'div#field-error--address1 > span' ) ;
0 commit comments