Skip to content

Commit 8b7f60c

Browse files
committed
Fix asserts material ui - remove timer
1 parent 527b4eb commit 8b7f60c

File tree

7 files changed

+11
-32
lines changed

7 files changed

+11
-32
lines changed

jdi-light-material-ui/src/main/java/com/epam/jdi/light/material/asserts/feedback/DialogAssert.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import com.epam.jdi.light.asserts.generic.UIAssert;
44
import com.epam.jdi.light.common.JDIAction;
55
import com.epam.jdi.light.material.elements.feedback.Dialog;
6-
import com.jdiai.tools.Timer;
76
import org.hamcrest.Matchers;
87

98
import static com.epam.jdi.light.asserts.core.SoftAssert.jdiAssert;
@@ -13,16 +12,13 @@
1312
*/
1413
public class DialogAssert extends UIAssert<DialogAssert, Dialog> {
1514

16-
private final Timer timer = new Timer(5000L, 500L);
17-
1815
/**
1916
* Checks that dialog has scrollable content.
2017
*
2118
* @return this {@link DialogAssert} instance
2219
*/
2320
@JDIAction(value = "Assert that '{name}' has scrollable content", isAssert = true)
2421
public DialogAssert scrollableContent() {
25-
timer.wait(() -> element().isDisplayed());
2622
jdiAssert(element().hasScrollableContent(), Matchers.is(true), "Dialog has no scrollable content");
2723
return this;
2824
}
@@ -34,7 +30,6 @@ public DialogAssert scrollableContent() {
3430
*/
3531
@JDIAction(value = "Assert that '{name}' has scrollable body", isAssert = true)
3632
public DialogAssert scrollableBody() {
37-
timer.wait(() -> element().isDisplayed());
3833
jdiAssert(element().hasScrollableBody(), Matchers.is(true), "Dialog has no scrollable body");
3934
return this;
4035
}
@@ -47,7 +42,6 @@ public DialogAssert scrollableBody() {
4742
@JDIAction(value = "Assert that '{name}' is hidden", isAssert = true)
4843
@Override
4944
public DialogAssert hidden() {
50-
timer.wait(() -> element().isNotVisible());
5145
jdiAssert(element().isHidden(), Matchers.is(true), "Dialog is not hidden");
5246
return this;
5347
}
@@ -60,7 +54,6 @@ public DialogAssert hidden() {
6054
@JDIAction(value = "Assert that '{name}' is displayed", isAssert = true)
6155
@Override
6256
public DialogAssert displayed() {
63-
timer.wait(() -> element().isDisplayed());
6457
jdiAssert(element().isDisplayed(), Matchers.is(true), "Dialog is not displayed");
6558
return this;
6659
}

jdi-light-material-ui/src/main/java/com/epam/jdi/light/material/asserts/feedback/ProgressAssert.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import org.hamcrest.Matchers;
88

99
import static com.epam.jdi.light.asserts.core.SoftAssert.jdiAssert;
10-
import static com.jdiai.tools.Timer.waitCondition;
1110

1211
/**
1312
* Assertions for {@link Progress}
@@ -22,8 +21,7 @@ public class ProgressAssert<A extends ProgressAssert<?, ?>, E extends Progress<?
2221
*/
2322
@JDIAction(value = "Assert that '{name}' is indeterminate", isAssert = true)
2423
public A indeterminate() {
25-
boolean isIndeterminate = waitCondition(() -> element().isIndeterminate());
26-
jdiAssert(isIndeterminate, Matchers.is(true), "Progress is not indeterminate");
24+
jdiAssert(element().isIndeterminate(), Matchers.is(true), "Progress is not indeterminate");
2725
return (A) this;
2826
}
2927

@@ -34,8 +32,7 @@ public A indeterminate() {
3432
*/
3533
@JDIAction(value = "Assert that '{name}' is determinate", isAssert = true)
3634
public A determinate() {
37-
boolean isDeterminate = waitCondition(() -> element().isDeterminate());
38-
jdiAssert(isDeterminate, Matchers.is(true), "Progress is not determinate");
35+
jdiAssert(element().isDeterminate(), Matchers.is(true), "Progress is not determinate");
3936
return (A) this;
4037
}
4138

jdi-light-material-ui/src/main/java/com/epam/jdi/light/material/asserts/inputs/TransferListAssert.java

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import com.epam.jdi.light.material.elements.inputs.transferlist.EnhancedTransferList;
66
import com.epam.jdi.light.material.elements.inputs.transferlist.TransferList;
77

8-
import com.jdiai.tools.Timer;
98
import org.apache.commons.lang3.StringUtils;
109
import org.hamcrest.Matchers;
1110

@@ -27,9 +26,7 @@ public class TransferListAssert extends UIAssert<TransferListAssert, TransferLis
2726
*/
2827
@JDIAction(value = "Assert that '{name}' item '{0}' is checked", isAssert = true)
2928
public TransferListAssert checked(String itemText) {
30-
boolean isChecked = new Timer(base().getTimeout() * 1000L)
31-
.wait(() -> element().isChecked(itemText));
32-
jdiAssert(isChecked, Matchers.is(true), String.format("Element %s in Transferlist is not checked", itemText));
29+
jdiAssert(element().isChecked(itemText), Matchers.is(true), String.format("Element %s in Transferlist is not checked", itemText));
3330
return this;
3431
}
3532

@@ -41,9 +38,7 @@ public TransferListAssert checked(String itemText) {
4138
*/
4239
@JDIAction(value = "Assert that '{name}' item '{0}' is unchecked", isAssert = true)
4340
public TransferListAssert unchecked(String itemText) {
44-
boolean isUnchecked = new Timer(base().getTimeout() * 1000L)
45-
.wait(() -> element().isUnchecked(itemText));
46-
jdiAssert(isUnchecked, Matchers.is(true),
41+
jdiAssert(element().isUnchecked(itemText), Matchers.is(true),
4742
String.format("Element %s in Transferlist is not unchecked", itemText));
4843
return this;
4944
}

jdi-light-material-ui/src/main/java/com/epam/jdi/light/material/asserts/navigation/DrawerAssert.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import org.hamcrest.Matchers;
77

88
import static com.epam.jdi.light.asserts.core.SoftAssert.jdiAssert;
9-
import static com.jdiai.tools.Timer.waitCondition;
109

1110
/**
1211
* Assertions for {@link Drawer}.
@@ -51,7 +50,7 @@ public DrawerAssert sublistWithSize(int listIndex, int expectedSize) {
5150
@Override
5251
@JDIAction(value = "Assert that '{name}' is hidden", isAssert = true)
5352
public DrawerAssert hidden() {
54-
jdiAssert(waitCondition(() -> element().isHidden()), Matchers.is(true),
53+
jdiAssert(element().isHidden(), Matchers.is(true),
5554
"Drawer is not hidden");
5655
return this;
5756
}
@@ -63,7 +62,7 @@ public DrawerAssert hidden() {
6362
*/
6463
@JDIAction(value = "Assert that '{name}' is not exist", isAssert = true)
6564
public DrawerAssert notExist() {
66-
jdiAssert(waitCondition(() -> element().core().isNotExist()), Matchers.is(true),
65+
jdiAssert(element().core().isNotExist(), Matchers.is(true),
6766
"Drawer is exists");
6867
return this;
6968
}

jdi-light-material-ui/src/main/java/com/epam/jdi/light/material/asserts/navigation/MUIStepperAssert.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import com.epam.jdi.light.asserts.core.SoftAssert;
44
import com.epam.jdi.light.common.JDIAction;
55
import com.epam.jdi.light.material.elements.navigation.steppers.MUIStepper;
6-
import com.jdiai.tools.Timer;
76
import org.hamcrest.Matchers;
87

98
import java.util.Arrays;
@@ -76,8 +75,7 @@ public MUIStepperAssert allStepsIncomplete() {
7675
*/
7776
@JDIAction(value = "Assert that step '{0}' in '{name}' is completed", isAssert = true)
7877
public MUIStepperAssert stepCompleted(int stepNumber) {
79-
Timer timer = new Timer(base().getTimeout() * 1000L);
80-
SoftAssert.jdiAssert(timer.wait(() -> element().hasStepCompleted(stepNumber - 1)),
78+
SoftAssert.jdiAssert(element().hasStepCompleted(stepNumber - 1),
8179
Matchers.is(true), String.format("Step %s in not completed", stepNumber));
8280
return this;
8381
}

jdi-light-material-ui/src/main/java/com/epam/jdi/light/material/asserts/utils/PopperAssert.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import org.hamcrest.Matcher;
77

88
import static com.epam.jdi.light.asserts.core.SoftAssert.jdiAssert;
9-
import static com.jdiai.tools.Timer.waitCondition;
109

1110
/**
1211
* Assertions for {@link Popper}
@@ -23,7 +22,6 @@ public PopperAssert text(Matcher<String> condition) {
2322
@Override
2423
@JDIAction(value = "Assert that '{name}' is not visible by user", isAssert = true)
2524
public PopperAssert notVisible() {
26-
waitCondition(() -> element().isNotVisible());
2725
super.notVisible();
2826
return this;
2927
}

jdi-light-material-ui/src/main/java/com/epam/jdi/light/material/asserts/utils/TransitionAssert.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import org.hamcrest.Matchers;
77

88
import static com.epam.jdi.light.asserts.core.SoftAssert.jdiAssert;
9-
import static com.jdiai.tools.Timer.waitCondition;
109

1110
/**
1211
* Assertions for {@link Transition}
@@ -20,7 +19,7 @@ public class TransitionAssert extends UIAssert<TransitionAssert, Transition> {
2019
*/
2120
@JDIAction(value = "Assert that '{name}' is entered", isAssert = true)
2221
public TransitionAssert entered() {
23-
jdiAssert(waitCondition(() -> element().isEntered()), Matchers.is(true),
22+
jdiAssert(element().isEntered(), Matchers.is(true),
2423
"Transition is not entered");
2524
return this;
2625
}
@@ -32,23 +31,23 @@ public TransitionAssert entered() {
3231
*/
3332
@JDIAction(value = "Assert that '{name}' is exited", isAssert = true)
3433
public TransitionAssert exited() {
35-
jdiAssert(waitCondition(() -> element().isExited()), Matchers.is(true),
34+
jdiAssert(element().isExited(), Matchers.is(true),
3635
"Transition is not exited");
3736
return this;
3837
}
3938

4039
@Override
4140
@JDIAction(value = "Assert that '{name}' is hidden", isAssert = true)
4241
public TransitionAssert hidden() {
43-
jdiAssert(waitCondition(() -> element().isHidden()), Matchers.is(true),
42+
jdiAssert(element().isHidden(), Matchers.is(true),
4443
"Transition is visible");
4544
return this;
4645
}
4746

4847
@Override
4948
@JDIAction(value = "Assert that '{name}' is displayed", isAssert = true)
5049
public TransitionAssert displayed() {
51-
jdiAssert(waitCondition(() -> element().isDisplayed()), Matchers.is(true),
50+
jdiAssert(element().isDisplayed(), Matchers.is(true),
5251
"Transition is hidden");
5352
return this;
5453
}

0 commit comments

Comments
 (0)