Skip to content

Commit 5abff06

Browse files
committed
WhenAnyUserAtAnyPageWithForm(requiredFieldsShouldBeMarkedByAsterisk): remove check.
I don't want to port it to Robot Framework because I'm trying to make tests to test behavior instead of the pages state. No functional changes.
1 parent a035a71 commit 5abff06

File tree

10 files changed

+15
-41
lines changed

10 files changed

+15
-41
lines changed

src/main/webapp/WEB-INF/views/account/activate.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ <h3 th:text="#{t_activation_on_site}">
124124
<div class="form-group" th:classappend="${#fields.hasErrors('login') ? 'has-error' : ''}">
125125
<label for="login" class="control-label col-sm-3">
126126
<span th:remove="tag" th:text="#{t_login}">Login</span>
127-
<span id="login.required" class="required_field">*</span>
127+
<span class="required_field">*</span>
128128
</label>
129129
<div class="col-sm-5">
130130
<input type="text" id="login" class="form-control" required="required" th:field="*{login}" />
@@ -149,7 +149,7 @@ <h3 th:text="#{t_activation_on_site}">
149149
<div class="form-group" th:classappend="${#fields.hasErrors('password') ? 'has-error' : ''}">
150150
<label for="password" class="control-label col-sm-3">
151151
<span th:remove="tag" th:text="#{t_password}">Password</span>
152-
<span id="password.required" class="required_field">*</span>
152+
<span class="required_field">*</span>
153153
</label>
154154
<div class="col-sm-5">
155155
<input type="password" id="password" class="form-control" required="required" th:field="*{password}" />
@@ -162,7 +162,7 @@ <h3 th:text="#{t_activation_on_site}">
162162
<div class="form-group" th:classappend="${#fields.hasErrors('passwordConfirmation') ? 'has-error' : ''}">
163163
<label for="passwordConfirmation" class="control-label col-sm-3">
164164
<span th:remove="tag" th:text="#{t_password_again}">Retype password</span>
165-
<span id="passwordConfirmation.required" class="required_field">*</span>
165+
<span class="required_field">*</span>
166166
</label>
167167
<div class="col-sm-5">
168168
<input type="password" id="passwordConfirmation" class="form-control" required="required" th:field="*{passwordConfirmation}" />
@@ -175,7 +175,7 @@ <h3 th:text="#{t_activation_on_site}">
175175
<div class="form-group" th:classappend="${#fields.hasErrors('activationKey') ? 'has-error' : ''}">
176176
<label for="activationKey" class="control-label col-sm-3">
177177
<span th:remove="tag" th:text="#{t_activation_key}">Activation key</span>
178-
<span id="activationKey.required" class="required_field">*</span>
178+
<span class="required_field">*</span>
179179
</label>
180180
<div class="col-sm-5">
181181
<input type="text" id="activationKey" class="form-control" required="required" th:field="*{activationKey}" />

src/main/webapp/WEB-INF/views/account/auth.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ <h3 th:text="#{t_authentication_on_site}">
128128
<div class="form-group">
129129
<label for="login" class="control-label col-sm-4">
130130
<span th:remove="tag" th:text="#{t_login}">Login</span>
131-
<span id="login.required" class="required_field">*</span>
131+
<span class="required_field">*</span>
132132
</label>
133133
<div class="col-sm-4">
134134
<input type="text" id="login" name="login" required="required" value="" class="form-control" />
@@ -138,7 +138,7 @@ <h3 th:text="#{t_authentication_on_site}">
138138
<div class="form-group">
139139
<label for="password" class="control-label col-sm-4">
140140
<span th:remove="tag" th:text="#{t_password}">Password</span>
141-
<span id="password.required" class="required_field">*</span>
141+
<span class="required_field">*</span>
142142
</label>
143143
<div class="col-sm-4">
144144
<input type="password" id="password" name="password" required="required" value="" class="form-control" />

src/main/webapp/WEB-INF/views/account/register.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ <h3 th:text="#{t_registration_on_site}">
116116
<div class="form-group" th:classappend="${#fields.hasErrors('email') ? 'has-error' : ''}">
117117
<label class="control-label col-sm-4" for="email">
118118
<span th:remove="tag" th:text="#{t_email}">E-mail</span>
119-
<span id="email.required" class="required_field">*</span>
119+
<span class="required_field">*</span>
120120
</label>
121121
<div class="col-sm-5">
122122
<input class="form-control" type="email" id="email" required="required" autofocus="autofocus" th:field="*{email}" />

src/main/webapp/WEB-INF/views/category/add.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ <h3 th:text="${#strings.capitalize(create_category)} ">
113113
<span th:remove="tag" th:text="#{t_name_in_english}">
114114
Name (in English)
115115
</span>
116-
<span id="name.required" class="required_field">*</span>
116+
<span class="required_field">*</span>
117117
</label>
118118
<div class="col-sm-5">
119119
<input id="name" type="text" class="form-control" required="required" th:field="*{name}" />

src/main/webapp/WEB-INF/views/country/add.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ <h3 th:text="${#strings.capitalize(add_country)}">
113113
<span th:remove="tag" th:text="#{t_name_in_english}">
114114
Name (in English)
115115
</span>
116-
<span id="name.required" class="required_field">*</span>
116+
<span class="required_field">*</span>
117117
</label>
118118
<div class="col-sm-5">
119119
<input id="name" type="text" class="form-control" required="required" th:field="*{name}" />

src/main/webapp/WEB-INF/views/participant/add.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ <h3 th:text="${#strings.capitalize(header)} ">
113113
<span th:remove="tag" th:text="#{t_name}">
114114
Name
115115
</span>
116-
<span id="name.required" class="required_field">*</span>
116+
<span class="required_field">*</span>
117117
</label>
118118
<div class="col-sm-5">
119119
<input id="name" type="text" class="form-control" required="required" th:field="*{name}" />

src/main/webapp/WEB-INF/views/series/add.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ <h3 th:text="${#strings.capitalize(add_series)}">
133133
<span th:remove="tag" th:text="#{t_category}">
134134
Category
135135
</span>
136-
<span id="category.required" class="required_field">*</span>
136+
<span class="required_field">*</span>
137137
</label>
138138
<div class="col-sm-5">
139139
<select id="category" name="category" class="form-control" required="required">
@@ -214,7 +214,7 @@ <h3 th:text="${#strings.capitalize(add_series)}">
214214
<span th:remove="tag" th:text="#{t_quantity}">
215215
Quantity
216216
</span>
217-
<span id="quantity.required" class="required_field">*</span>
217+
<span class="required_field">*</span>
218218
</label>
219219
<div class="col-sm-6">
220220
<div class="row">
@@ -263,7 +263,7 @@ <h3 th:text="${#strings.capitalize(add_series)}">
263263
<span th:remove="tag" th:text="#{t_image}">
264264
Image
265265
</span>
266-
<span id="image.required" class="required_field">*</span>
266+
<span class="required_field">*</span>
267267
</label>
268268
<div class="col-sm-7">
269269
<input type="file" id="image" style="box-shadow: none; border: 0px;" required="required" accept="image/png,image/jpeg" th:field="*{image}" />

src/main/webapp/WEB-INF/views/series/info.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ <h5 th:text="|#{t_add_info_who_selling_series}:|">Add info about selling/buying
388388
<span th:remove="tag" th:text="#{t_seller}">
389389
Seller
390390
</span>
391-
<span id="seller.required" class="required_field">*</span>
391+
<span class="required_field">*</span>
392392
</label>
393393
<div class="col-sm-6">
394394
<select id="seller" class="form-control" required="required" th:field="*{sellerId}">
@@ -432,7 +432,7 @@ <h5 th:text="|#{t_add_info_who_selling_series}:|">Add info about selling/buying
432432
<span th:remove="tag" th:text="#{t_price}">
433433
Price
434434
</span>
435-
<span id="price.required" class="required_field">*</span>
435+
<span class="required_field">*</span>
436436
</label>
437437
<div class="col-sm-6">
438438
<div class="row">

src/test/java/ru/mystamps/web/tests/cases/WhenAnyUserAtAnyPageWithForm.java

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ abstract class WhenAnyUserAtAnyPageWithForm<T extends AbstractPageWithForm>
3737
protected void checkStandardStructure() {
3838
shouldHaveFields();
3939

40-
requiredFieldsShouldBeMarkedByAsterisk();
4140
mayExistsLegendAboutRequiredFields();
4241
emptyValueShouldBeForbiddenForRequiredFields();
4342

@@ -54,18 +53,6 @@ private void shouldHaveFields() {
5453
}
5554
}
5655

57-
private void requiredFieldsShouldBeMarkedByAsterisk() {
58-
for (Field field : page.getForm().getRequiredFields()) {
59-
assertThat(page.inputHasAsterisk(field.getId()))
60-
.overridingErrorMessage(
61-
String.format(
62-
"required field with id '%s' should be marked by asterisk", field.getId()
63-
)
64-
)
65-
.isTrue();
66-
}
67-
}
68-
6956
private void mayExistsLegendAboutRequiredFields() {
7057
if (page.getForm().getRequiredFields().isEmpty()) {
7158
return;

src/test/java/ru/mystamps/web/tests/page/AbstractPageWithForm.java

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919

2020
import java.util.List;
2121

22-
import org.openqa.selenium.NoSuchElementException;
2322
import org.openqa.selenium.WebDriver;
2423
import org.openqa.selenium.support.ui.Select;
2524

@@ -35,7 +34,6 @@
3534
public abstract class AbstractPageWithForm extends AbstractPage {
3635

3736
private static final String FIELD_ERROR_LOCATOR = "//span[@id=\"%s.errors\"]";
38-
private static final String FIELD_REQUIRED_LOCATOR = "//span[@id=\"%s.required\"]";
3937
private static final String FORM_ERROR_LOCATOR = "//div[@id=\"form.errors\"]";
4038

4139
@Getter private Form form;
@@ -81,17 +79,6 @@ public AbstractPage submit() {
8179
return this;
8280
}
8381

84-
public boolean inputHasAsterisk(String id) {
85-
try {
86-
String requiredFieldMark =
87-
getTextOfElementByXPath(String.format(FIELD_REQUIRED_LOCATOR, id));
88-
89-
return "*".equals(requiredFieldMark);
90-
} catch (NoSuchElementException ex) {
91-
return false;
92-
}
93-
}
94-
9582
public String getFieldValue(String name) {
9683
Validate.validState(
9784
form != null,

0 commit comments

Comments
 (0)