Skip to content

Commit 30a1d2e

Browse files
committed
test(WhenAnyUserAtAnyPageWithForm): remove shouldHaveFields check.
I don't want to port it to Robot Framework because I'm trying to make the tests to test behavior instead of the pages state. Also deprecate the WhenAnyUserAtAnyPageWithForm class. Related to #530 No functional changes.
1 parent 235b8fa commit 30a1d2e

File tree

3 files changed

+3
-30
lines changed

3 files changed

+3
-30
lines changed

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

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,30 +18,18 @@
1818
package ru.mystamps.web.tests.cases;
1919

2020
import ru.mystamps.web.tests.page.AbstractPageWithForm;
21-
import ru.mystamps.web.tests.page.element.Form.Field;
22-
23-
import static org.fest.assertions.api.Assertions.assertThat;
2421

2522
@SuppressWarnings("checkstyle:abstractclassname")
23+
@Deprecated
2624
abstract class WhenAnyUserAtAnyPageWithForm<T extends AbstractPageWithForm>
2725
extends WhenAnyUserAtAnyPage<T> {
2826

2927
WhenAnyUserAtAnyPageWithForm(Class<T> pageClass) {
3028
super(pageClass);
3129
}
3230

31+
@Deprecated
3332
protected void checkStandardStructure() {
34-
shouldHaveFields();
35-
}
36-
37-
private void shouldHaveFields() {
38-
for (Field field : page.getForm().getFields()) {
39-
if (field.isAccessibleByAll()) {
40-
assertThat(page.isFieldExists(field))
41-
.overridingErrorMessage("field with XPath '" + field + "' should exists")
42-
.isTrue();
43-
}
44-
}
4533
}
4634

4735
}

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

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import org.openqa.selenium.support.ui.Select;
2424
import ru.mystamps.web.tests.WebElementUtils;
2525
import ru.mystamps.web.tests.page.element.Form;
26-
import ru.mystamps.web.tests.page.element.Form.Field;
2726
import ru.mystamps.web.tests.page.element.Form.SubmitButton;
2827

2928
import java.util.List;
@@ -43,10 +42,6 @@ protected void hasForm(Form form) {
4342
this.form = form;
4443
}
4544

46-
public boolean isFieldExists(Field field) {
47-
return elementWithXPathExists(field.toString());
48-
}
49-
5045
public boolean isFieldHasError(String id) {
5146
return elementWithXPathExists(String.format(FIELD_ERROR_LOCATOR, id));
5247
}

src/test/java/ru/mystamps/web/tests/page/element/Form.java

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public final class Form {
3535
// CheckStyle: ignore LineLength for next 1 line
3636
private static final String SUBMIT_WITH_VALUE_LOCATOR = "//input[@type=\"submit\"][@value=\"%s\"]";
3737

38-
@Getter private List<Field> fields;
38+
private List<Field> fields;
3939
@Getter private List<SubmitButton> submitButtons;
4040

4141
private Form() {
@@ -143,7 +143,6 @@ public static class Field {
143143
@Getter private final String name;
144144

145145
private final String xpath;
146-
private boolean accessibleByAll = false;
147146

148147
protected Field(String name, String xpath) {
149148
this.name = name;
@@ -157,15 +156,6 @@ public Field and() {
157156
return this;
158157
}
159158

160-
public Field accessibleByAll(boolean visible) {
161-
accessibleByAll = visible;
162-
return this;
163-
}
164-
165-
public boolean isAccessibleByAll() {
166-
return accessibleByAll;
167-
}
168-
169159
@Override
170160
public String toString() {
171161
return xpath;

0 commit comments

Comments
 (0)