Skip to content

Commit c3940f2

Browse files
committed
chore: use a global keyword for disabling client validation.
HtmlUnit/htmlunit#75 has been fixed and we can use "novalidate" attribute to turn off validation of a particular form. Follow-up to #1251
1 parent 1aad86e commit c3940f2

File tree

15 files changed

+23
-72
lines changed

15 files changed

+23
-72
lines changed

src/test/robotframework/account/activation/misc-anonymous.robot

+2-6
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Library SeleniumLibrary
44
Resource ../../selenium.utils.robot
55
Suite Setup Before Test Suite
66
Suite Teardown Close Browser
7-
Test Setup Disable Client Validation
7+
Test Setup Disable Client Validation activate-account-form
88
Force Tags account activation misc
99

1010
*** Test Cases ***
@@ -58,13 +58,9 @@ Before Test Suite
5858
Open Browser ${SITE_URL}/account/activate ${BROWSER}
5959
Register Keyword To Run On Failure Log Source
6060

61-
Disable Client Validation
62-
Remove Element Attribute password required
63-
Remove Element Attribute passwordConfirmation required
64-
6561
Name should not cause an error
6662
[Arguments] ${name}
67-
Disable Client Validation
63+
Disable Client Validation activate-account-form
6864
Input Text id:name ${name}
6965
Submit Form id:activate-account-form
7066
Page Should Not Contain Element id:name.errors

src/test/robotframework/account/activation/validation.robot

+2-8
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Library SeleniumLibrary
44
Resource ../../selenium.utils.robot
55
Suite Setup Before Test Suite
66
Suite Teardown Close Browser
7-
Test Setup Disable Client Validation
7+
Test Setup Disable Client Validation activate-account-form
88
Force Tags account activation validation
99

1010
*** Test Cases ***
@@ -105,15 +105,9 @@ Before Test Suite
105105
Open Browser ${SITE_URL}/account/activate ${BROWSER}
106106
Register Keyword To Run On Failure Log Source
107107

108-
Disable Client Validation
109-
Remove Element Attribute login required
110-
Remove Element Attribute password required
111-
Remove Element Attribute passwordConfirmation required
112-
Remove Element Attribute activationKey required
113-
114108
Login should not contain repeated special characters
115109
[Arguments] ${login}
116-
Disable Client Validation
110+
Disable Client Validation activate-account-form
117111
Input Text id:login ${login}
118112
Submit Form id:activate-account-form
119113
Element Text Should Be id:login.errors Login must not contain repetition of hyphen, dot or underscore

src/test/robotframework/account/authentication/validation.robot

+1-5
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Force Tags account authentication validation
88

99
*** Test Cases ***
1010
Authenticate with empty credentials
11-
[Setup] Disable Client Validation
11+
[Setup] Disable Client Validation auth-account-form
1212
Input Text id:login ${EMPTY}
1313
Input Text id:password ${EMPTY}
1414
Submit Form id:auth-account-form
@@ -25,7 +25,3 @@ Before Test Suite
2525
Open Browser ${SITE_URL}/account/auth ${BROWSER}
2626
Register Keyword To Run On Failure Log Source
2727

28-
Disable Client Validation
29-
Remove Element Attribute login required
30-
Remove Element Attribute password required
31-

src/test/robotframework/collection/add-series/validation.robot

+1-4
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Force Tags collection validation
99

1010
*** Test Cases ***
1111
Add a series without required field
12-
[Setup] Disable Client Validation
12+
[Setup] Disable Client Validation add-series-form
1313
Input Text id:number-of-stamps ${EMPTY}
1414
Submit Form id:add-series-form
1515
Element Text Should Be id:number-of-stamps.errors Value must not be empty
@@ -33,6 +33,3 @@ Before Test Suite
3333
# We need a series with more than 1 stamp, so the number-of-stamps field won't be hidden.
3434
# We also need a series with no more than 4 stamps, so the 5 stamps will lead to an error.
3535
Go To ${SITE_URL}/series/2
36-
37-
Disable Client Validation
38-
Remove Element Attribute number-of-stamps required

src/test/robotframework/participant/creation/validation.robot

+1-4
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Force Tags participant validation
99

1010
*** Test Cases ***
1111
Create participant with blank required fields
12-
[Setup] Disable Client Validation
12+
[Setup] Disable Client Validation add-participant-form
1313
Submit Form id:add-participant-form
1414
Element Text Should Be id:name.errors Value must not be empty
1515

@@ -37,6 +37,3 @@ Before Test Suite
3737
Register Keyword To Run On Failure Log Source
3838
Log In As login=admin password=test
3939
Go To ${SITE_URL}/participant/add
40-
41-
Disable Client Validation
42-
Remove Element Attribute name required

src/test/robotframework/selenium.utils.robot

+4-4
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ Select Random Option From List
5252
${randomIndex}= Evaluate random.randint(0, ${size}-1) modules=random
5353
Select From List By Index ${locator} ${randomIndex}
5454

55-
Remove Element Attribute
56-
[Documentation] Remove an attribute with a specified name from an element identified by its id
57-
[Arguments] ${id} ${name}
58-
Execute Javascript return window.document.getElementById('${id}').removeAttribute('${name}');
55+
Disable Client Validation
56+
[Documentation] Disable client validation for a form with a specified ID
57+
[Arguments] ${id}
58+
Execute Javascript return window.document.getElementById('${id}').setAttribute('novalidate', 'true');

src/test/robotframework/series/creation/misc-admin.robot

+1-4
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Force Tags series misc
99

1010
*** Test Cases ***
1111
Comment should be stripped from leading and trailing spaces
12-
Disable Client Validation
12+
Disable Client Validation add-series-form
1313
Click Element id:add-comment-link
1414
Input Text id:comment ${SPACE * 2}example comment${SPACE * 2}
1515
Submit Form id:add-series-form
@@ -21,6 +21,3 @@ Before Test Suite
2121
Register Keyword To Run On Failure Log Source
2222
Log In As login=admin password=test
2323
Go To ${SITE_URL}/series/add
24-
25-
Disable Client Validation
26-
Remove Element Attribute quantity required

src/test/robotframework/series/creation/misc-user.robot

+2-6
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Catalog numbers should accept valid values
2929

3030
Catalog numbers should be stripped from any spaces
3131
Go To ${SITE_URL}/series/add
32-
Disable Client Validation
32+
Disable Client Validation add-series-form
3333
Click Element id:add-catalog-numbers-link
3434
Wait Until Element Is Visible id:michelNumbers
3535
Input Text id:michelNumbers ${SPACE * 2}1 , 2${SPACE * 2}
@@ -93,14 +93,10 @@ Before Test Suite
9393
Log In As login=coder password=test
9494
Go To ${SITE_URL}/series/add
9595

96-
Disable Client Validation
97-
Remove Element Attribute quantity required
98-
Remove Element Attribute image required
99-
10096
Valid Catalog Numbers Should Be Accepted
10197
[Arguments] ${catalogNumbers}
10298
Go To ${SITE_URL}/series/add
103-
Disable Client Validation
99+
Disable Client Validation add-series-form
104100
Click Element id:add-catalog-numbers-link
105101
Wait Until Element Is Visible id:michelNumbers
106102
Input Text id:michelNumbers ${catalogNumbers}

src/test/robotframework/series/creation/validation-admin.robot

+1-4
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Resource ../../auth.steps.robot
55
Resource ../../selenium.utils.robot
66
Suite Setup Before Test Suite
77
Suite Teardown Close Browser
8-
Test Setup Disable Client Validation
8+
Test Setup Disable Client Validation add-series-form
99
Force Tags series validation
1010

1111
*** Test Cases ***
@@ -67,6 +67,3 @@ Before Test Suite
6767
Register Keyword To Run On Failure Log Source
6868
Log In As login=admin password=test
6969
Go To ${SITE_URL}/series/add
70-
71-
Disable Client Validation
72-
Remove Element Attribute quantity required

src/test/robotframework/series/creation/validation-user.robot

+3-7
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Resource ../../auth.steps.robot
55
Resource ../../selenium.utils.robot
66
Suite Setup Before Test Suite
77
Suite Teardown Close Browser
8-
Test Setup Disable Client Validation
8+
Test Setup Disable Client Validation add-series-form
99
Force Tags series validation
1010

1111
*** Test Cases ***
@@ -61,10 +61,6 @@ Before Test Suite
6161
Log In As login=coder password=test
6262
Go To ${SITE_URL}/series/add
6363

64-
Disable Client Validation
65-
Remove Element Attribute quantity required
66-
Remove Element Attribute image required
67-
6864
Invalid Catalog Numbers Should Be Rejected
6965
[Arguments] ${catalogNumbers}
7066
# open page each time to be sure that we're starting from the clean state.
@@ -73,7 +69,7 @@ Invalid Catalog Numbers Should Be Rejected
7369
# invisible (because link is toggling the visibility and when there are
7470
# errors, fields are visible from the begining).
7571
Go To ${SITE_URL}/series/add
76-
Disable Client Validation
72+
Disable Client Validation add-series-form
7773
Click Element id:add-catalog-numbers-link
7874
# we should wait until all 4 fields with class js-catalogs-info will be
7975
# visible but for simplicity we just check that the last field is visible
@@ -103,7 +99,7 @@ Invalid Catalog Price Should Be Rejected
10399
# invisible (because link is toggling the visibility and when there are
104100
# errors, fields are visible from the begining).
105101
Go To ${SITE_URL}/series/add
106-
Disable Client Validation
102+
Disable Client Validation add-series-form
107103
Click Element id:add-catalog-numbers-link
108104
# we should wait until all 4 fields with class js-catalogs-info will be
109105
# visible but for simplicity we just check that the last field is visible

src/test/robotframework/series/import/request-validation.robot

+1-4
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Force Tags series import-series validation
99

1010
*** Test Cases ***
1111
Submit request with blank required field
12-
[Setup] Disable Client Validation
12+
[Setup] Disable Client Validation import-series-form
1313
Submit Form id:import-series-form
1414
Element Text Should Be id:url.errors Value must not be empty
1515

@@ -30,6 +30,3 @@ Before Test Suite
3030
Register Keyword To Run On Failure Log Source
3131
Log In As login=admin password=test
3232
Go To ${SITE_URL}/series/import/request
33-
34-
Disable Client Validation
35-
Remove Element Attribute url required

src/test/robotframework/series/sales/import/validation.robot

+1-4
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Force Tags series sales import-sales validation
1010

1111
*** Test Cases ***
1212
Import a series sale with empty required field
13-
Disable Client Validation
13+
Disable Client Validation import-series-sale-form
1414
Submit Form id:import-series-sale-form
1515
Wait Until Element Is Visible id:series-sale-url.errors
1616
Element Text Should Be id:series-sale-url.errors Value must not be empty
@@ -36,6 +36,3 @@ Before Test Suite
3636

3737
Before Test
3838
Go To ${SITE_URL}/series/1
39-
40-
Disable Client Validation
41-
Remove Element Attribute series-sale-url required

src/test/robotframework/series/sales/misc.robot

+1-4
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Force Tags series sales misc
99

1010
*** Test Cases ***
1111
Url should be stripped from leading and trailing spaces
12-
[Setup] Disable Client Validation
12+
[Setup] Disable Client Validation add-series-sales-form
1313
Input Text id:url ${SPACE * 2}bad-value${SPACE * 2}
1414
Submit Form id:add-series-sales-form
1515
Textfield Value Should Be id:url bad-value
@@ -20,6 +20,3 @@ Before Test Suite
2020
Register Keyword To Run On Failure Log Source
2121
Log In As login=admin password=test
2222
Go To ${SITE_URL}/series/1
23-
24-
Disable Client Validation
25-
Remove Element Attribute price required

src/test/robotframework/series/sales/validation.robot

+1-4
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Resource ../../auth.steps.robot
55
Resource ../../selenium.utils.robot
66
Suite Setup Before Test Suite
77
Suite Teardown Close Browser
8-
Test Setup Disable Client Validation
8+
Test Setup Disable Client Validation add-series-sales-form
99
Force Tags series sales validation
1010

1111
*** Test Cases ***
@@ -40,6 +40,3 @@ Before Test Suite
4040
Register Keyword To Run On Failure Log Source
4141
Log In As login=admin password=test
4242
Go To ${SITE_URL}/series/1
43-
44-
Disable Client Validation
45-
Remove Element Attribute price required

src/test/robotframework/series/search/validation.robot

+1-4
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,11 @@ Force Tags series search validation
88

99
*** Test Cases ***
1010
Search the series with empty required field
11-
[Setup] Disable Client Validation
11+
[Setup] Disable Client Validation search-series-form
1212
Submit Form id:search-series-form
1313
Element Text Should Be id:catalogNumber.errors Value must not be empty
1414

1515
*** Keywords ***
1616
Before Test Suite
1717
Open Browser ${SITE_URL}/ ${BROWSER}
1818
Register Keyword To Run On Failure Log Source
19-
20-
Disable Client Validation
21-
Remove Element Attribute catalogNumber required

0 commit comments

Comments
 (0)