Skip to content

Commit 03d6175

Browse files
committed
Extract workaround into a separate keyword and use it everywhere.
No functional changes.
1 parent d14bb06 commit 03d6175

File tree

4 files changed

+18
-22
lines changed

4 files changed

+18
-22
lines changed

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
Documentation Verify miscellaneous aspects of participant creation
33
Library Selenium2Library
44
Resource ../../auth.steps.robot
5+
Resource ../../selenium.utils.robot
56
Suite Setup Before Test Suite
67
Suite Teardown After Test Suite
78
Force Tags participant misc
@@ -12,10 +13,7 @@ Name and url should be stripped from leading and trailing spaces
1213
Input Text id=url ${SPACE * 2}url${SPACE * 2}
1314
Submit Form id=add-participant-form
1415
Textfield Value Should Be id=name f
15-
# We can't use "Textfield Value Should Be" because it causes NPE:
16-
# https://github.com/MarkusBernhardt/robotframework-selenium2library-java/issues/92
17-
${value}= Get Value id=url
18-
Should Be Equal ${value} url
16+
Urlfield Value Should Be id=url url
1917

2018
*** Keywords ***
2119
Before Test Suite

src/test/robotframework/selenium.utils.robot

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,11 @@ Element Text Should Match Regexp
77
[Arguments] ${locator} ${regexp}
88
${text}= Get Text ${locator}
99
Should Match Regexp ${text} ${regexp}
10+
11+
# Workaround for "Textfield Value Should Be" that causes NPE with <input type="url">:
12+
# https://github.com/MarkusBernhardt/robotframework-selenium2library-java/issues/92
13+
Urlfield Value Should Be
14+
[Documentation] Verifies text field locator has exactly text expected
15+
[Arguments] ${locator} ${expected}
16+
${value}= Get Value ${locator}
17+
Should Be Equal ${expected} ${value}

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

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ Documentation Verify scenarios of importing a series from an external site
33
Library Selenium2Library
44
Library DateTime
55
Resource ../../auth.steps.robot
6+
Resource ../../selenium.utils.robot
67
Suite Setup Before Test Suite
78
Suite Teardown After Test Suite
89
Test Setup Before Test
@@ -18,18 +19,15 @@ Import series from an external site (in English, use category, country and date
1819
Should Match Regexp ${requestLocation} /series/import/request/\\d+
1920
${category}= Get Selected List Label id=category
2021
${country}= Get Selected List Label id=country
21-
# We can't use "Textfield Value Should Be" because it causes NPE on inputs of type url/number:
22-
# https://github.com/MarkusBernhardt/robotframework-selenium2library-java/issues/92
2322
${quantity}= Get Value id=quantity
24-
${imageUrl}= Get Value id=image-url
2523
${year}= Get Selected List Label id=year
2624
Element Text Should Be id=request-url ${importUrl}
2725
Element Text Should Be id=request-status ParsingSucceeded
2826
Should Be Equal ${category} Prehistoric animals
2927
Should Be Equal ${country} Italy
3028
Should Be Empty ${quantity}
3129
Checkbox Should Be Selected id=perforated
32-
Should Be Equal ${imageUrl} http://127.0.0.1:8080/image/1
30+
Urlfield Value Should Be id=image-url http://127.0.0.1:8080/image/1
3331
Should Be Equal ${year} 2000
3432
Input Text id=quantity 1
3533
Submit Form id=create-series-form
@@ -62,18 +60,15 @@ Import series from an external site (in Russian, use description locator)
6260
Should Match Regexp ${location} /series/import/request/\\d+
6361
${category}= Get Selected List Label id=category
6462
${country}= Get Selected List Label id=country
65-
# We can't use "Textfield Value Should Be" because it causes NPE on inputs of type url/number:
66-
# https://github.com/MarkusBernhardt/robotframework-selenium2library-java/issues/92
6763
${quantity}= Get Value id=quantity
68-
${imageUrl}= Get Value id=image-url
6964
${year}= Get Selected List Label id=year
7065
Element Text Should Be id=request-url http://localhost:8080/series/2?lang=ru&str=тест
7166
Element Text Should Be id=request-status ParsingSucceeded
7267
Should Be Equal ${category} Prehistoric animals
7368
Should Be Equal ${country} Italy
7469
Should Be Empty ${quantity}
7570
Checkbox Should Be Selected id=perforated
76-
Should Be Equal ${imageUrl} http://localhost:8080/image/1
71+
Urlfield Value Should Be id=image-url http://localhost:8080/image/1
7772
Should Be Equal ${year} 2000
7873

7974
Import series from external site with catalog numbers (use description locator)
@@ -120,10 +115,7 @@ Import series and series sale with a new seller from an external site
120115
${group}= Get Selected List Label id=seller-group
121116
Should Be Equal ${group} example.com
122117
Textfield Value Should Be id=seller-name Lando Livianus
123-
# We can't use "Textfield Value Should Be" because it causes NPE:
124-
# https://github.com/MarkusBernhardt/robotframework-selenium2library-java/issues/92
125-
${sellerUrl}= Get Value id=seller-url
126-
Should Be Equal ${sellerUrl} http://example.com/lando-livianus
118+
Urlfield Value Should Be id=seller-url http://example.com/lando-livianus
127119
Submit Form id=create-series-form
128120
${seriesLocation}= Get Location
129121
Should Match Regexp ${seriesLocation} /series/\\d+

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

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,16 @@
22
Documentation Verify miscellaneous aspects of adding series sales
33
Library Selenium2Library
44
Resource ../../auth.steps.robot
5+
Resource ../../selenium.utils.robot
56
Suite Setup Before Test Suite
67
Suite Teardown After Test Suite
78
Force Tags series sales misc
89

910
*** Test Cases ***
1011
Url should be stripped from leading and trailing spaces
11-
Input Text id=url ${SPACE * 2}bad-value${SPACE * 2}
12-
Submit Form id=add-series-sales-form
13-
# We can't use "Textfield Value Should Be" because it causes NPE:
14-
# https://github.com/MarkusBernhardt/robotframework-selenium2library-java/issues/92
15-
${value}= Get Value id=url
16-
Should Be Equal ${value} bad-value
12+
Input Text id=url ${SPACE * 2}bad-value${SPACE * 2}
13+
Submit Form id=add-series-sales-form
14+
Urlfield Value Should Be id=url bad-value
1715

1816
*** Keywords ***
1917
Before Test Suite

0 commit comments

Comments
 (0)