|
2 | 2 |
|
3 | 3 | import com.jdiai.tools.func.JAction; |
4 | 4 | import io.github.epam.TestsInit; |
5 | | -import org.testng.annotations.BeforeMethod; |
6 | | -import org.testng.annotations.Ignore; |
| 5 | +import org.testng.annotations.BeforeClass; |
7 | 6 | import org.testng.annotations.Test; |
8 | 7 |
|
9 | | -import static io.github.com.StaticSite.angularPage; |
10 | | -import static io.github.com.pages.AngularPage.snackbarSection; |
11 | | -import static io.github.epam.site.steps.States.shouldBeLoggedIn; |
| 8 | +import static com.jdiai.tools.Timer.waitCondition; |
| 9 | +import static io.github.com.StaticSite.snackBarPage; |
| 10 | + |
12 | 11 |
|
13 | | -// TODO Move to the new page |
14 | | -@Ignore |
15 | 12 | public class SnackbarTests extends TestsInit { |
16 | 13 |
|
17 | 14 | private static final String MESSAGE = "Test Message"; |
18 | 15 | private static final String ACTION = "Test Action"; |
19 | 16 |
|
20 | | - @BeforeMethod |
| 17 | + @BeforeClass |
21 | 18 | public void before() { |
22 | | - shouldBeLoggedIn(); |
23 | | - angularPage.shouldBeOpened(); |
| 19 | + snackBarPage.open(); |
| 20 | + waitCondition(() -> snackBarPage.isOpened()); |
| 21 | + snackBarPage.checkOpened(); |
24 | 22 | } |
25 | 23 |
|
26 | 24 | @Test |
27 | 25 | public void checkBasicSnackbarTest() { |
28 | | - snackbarSection.messageInput.setValue(MESSAGE); |
29 | | - snackbarSection.actionInput.setValue(ACTION); |
30 | | - snackbarSection.openButton.click(); |
| 26 | + snackBarPage.messageInput.setValue(MESSAGE); |
| 27 | + snackBarPage.actionInput.setValue(ACTION); |
| 28 | + snackBarPage.openButton.click(); |
31 | 29 |
|
32 | | - snackbarSection.basicSnackbar.is().displayed(); |
33 | | - snackbarSection.basicSnackbar.has().message(MESSAGE); |
34 | | - snackbarSection.basicSnackbar.has().action(ACTION); |
| 30 | + snackBarPage.basicSnackbar.is().displayed(); |
| 31 | + snackBarPage.basicSnackbar.has().message(MESSAGE); |
| 32 | + snackBarPage.basicSnackbar.has().action(ACTION); |
35 | 33 | } |
36 | 34 |
|
37 | 35 | @Test |
38 | 36 | public void checkSnackbarClickActionDismissTest() { |
39 | | - snackbarSection.messageInput.setValue(MESSAGE); |
40 | | - snackbarSection.actionInput.setValue(ACTION); |
41 | | - snackbarSection.openButton.click(); |
| 37 | + snackBarPage.messageInput.setValue(MESSAGE); |
| 38 | + snackBarPage.actionInput.setValue(ACTION); |
| 39 | + snackBarPage.openButton.click(); |
42 | 40 |
|
43 | | - snackbarSection.basicSnackbar.clickAction(); |
44 | | - snackbarSection.basicSnackbar.is().disappear(); |
| 41 | + snackBarPage.basicSnackbar.clickAction(); |
| 42 | + snackBarPage.basicSnackbar.is().disappear(); |
45 | 43 | } |
46 | 44 |
|
47 | 45 | @Test |
48 | 46 | public void checkSnackbarWithNoActionTest() { |
49 | | - snackbarSection.messageInput.setValue(MESSAGE); |
50 | | - snackbarSection.actionInput.setValue(""); |
51 | | - snackbarSection.openButton.click(); |
| 47 | + snackBarPage.messageInput.setValue(MESSAGE); |
| 48 | + snackBarPage.actionInput.setValue(""); |
| 49 | + snackBarPage.openButton.click(); |
52 | 50 |
|
53 | | - snackbarSection.basicSnackbar.has().action(); |
| 51 | + snackBarPage.basicSnackbar.has().action(); |
54 | 52 | } |
55 | 53 |
|
56 | 54 | @Test |
57 | 55 | public void checkSnackbarDurationTest() { |
58 | 56 | final int DURATION = 5; |
59 | 57 |
|
60 | 58 | JAction action = () -> { |
61 | | - snackbarSection.customSnackbar.base().timer().wait(() -> snackbarSection.customSnackbar.isDisplayed()); |
62 | | - snackbarSection.customSnackbar.base().timer().wait(() -> snackbarSection.customSnackbar.isHidden()); |
| 59 | + snackBarPage.customSnackbar.base().timer().wait(() -> snackBarPage.customSnackbar.isDisplayed()); |
| 60 | + snackBarPage.customSnackbar.base().timer().wait(() -> snackBarPage.customSnackbar.isHidden()); |
63 | 61 | }; |
64 | 62 |
|
65 | | - snackbarSection.durationInput.setValue(String.valueOf(DURATION)); |
66 | | - snackbarSection.customSnackbarOpenButton.click(); |
| 63 | + snackBarPage.durationInput.setValue(String.valueOf(DURATION)); |
| 64 | + snackBarPage.customSnackbarOpenButton.click(); |
67 | 65 |
|
68 | 66 | //duration(DURATION, 1000, action); |
69 | 67 | } |
|
0 commit comments