Skip to content

Commit

Permalink
tests of Divider page, task # 4941
Browse files Browse the repository at this point in the history
  • Loading branch information
Igor Vlasiuk committed Nov 30, 2023
1 parent 56d22a0 commit 05f1218
Show file tree
Hide file tree
Showing 3 changed files with 96 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import io.github.com.pages.ButtonTogglePage;
import io.github.com.pages.ButtonsPage;
import io.github.com.pages.CheckBoxPage;
import io.github.com.pages.DividerPage;
import io.github.com.pages.ProgressBarPage;
import io.github.com.pages.ProgressSpinnerPage;
import io.github.com.pages.RadioButtonPage;
Expand All @@ -33,6 +34,9 @@ public class StaticSite {
@Url("buttons_toggle")
public static ButtonTogglePage buttonTogglePage;

@Url("divider")
public static DividerPage dividerPage;

@Url("autocompletes")
public static AutocompletePage autocompletePage;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
package io.github.com.pages;

import com.epam.jdi.light.angular.elements.common.Divider;
import com.epam.jdi.light.elements.common.UIElement;
import com.epam.jdi.light.elements.complex.JList;
import com.epam.jdi.light.elements.pageobjects.annotations.locators.UI;

public class DividerPage extends NewAngularPage {

@UI("/descendant::h3[1]")
public static UIElement textWithDefaultDividers;

@UI("#divider-list:first-of-type > mat-list-item")
public static JList<Divider> defaultDividersList;

@UI("#divider-list:first-of-type > mat-divider[role=\"separator\"]")
public static JList<UIElement> defaultDividersSeparators;

@UI("#divider-list:first-of-type > mat-list-item:nth-of-type(1)")
public static UIElement elementDefaultItemOneDivider;

@UI("#divider-list:first-of-type > mat-list-item:nth-of-type(2)")
public static UIElement elementDefaultItemTwoDivider;

@UI("#divider-list:first-of-type > mat-list-item:nth-of-type(3)")
public static UIElement elementDefaultItemThreeDivider;

@UI("/descendant::h3[2]")
public static UIElement textInsetDividers;

@UI("#divider-list:nth-of-type(2) > mat-list-item")
public static JList<Divider> insetDividersList;

@UI("#divider-list:nth-of-type(2) > mat-divider[role=\"separator\"]")
public static JList<UIElement> insetDividerSeparators;

@UI("#divider-list:nth-of-type(2) > mat-list-item:nth-of-type(1)")
public static UIElement elementInsetItemOneDivider;

@UI("#divider-list:nth-of-type(2) > mat-list-item:nth-of-type(2)")
public static UIElement elementInsetItemTwoDivider;

@UI("#divider-list:nth-of-type(2) > mat-list-item:nth-of-type(3)")
public static UIElement elementInsetItemThreeDivider;

@UI("/descendant::h3[3]")
public static UIElement textVerticalDividers;

@UI(".vertical-dividers > mat-list-item")
public static JList<Divider> verticalDividersList;

@UI(".vertical-dividers > mat-divider[role=\"separator\"]")
public static JList<UIElement> verticalDividerSeparators;

@UI(".vertical-dividers > mat-list-item:nth-of-type(1)")
public static UIElement elementVerticalItemOneDivider;

@UI(".vertical-dividers > mat-list-item:nth-of-type(2)")
public static UIElement elementVerticalItemTwoDivider;

@UI(".vertical-dividers > mat-list-item:nth-of-type(3)")
public static UIElement elementVerticalItemThreeDivider;

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,44 @@

import io.github.epam.TestsInit;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Ignore;
import org.testng.annotations.Test;

import static io.github.com.StaticSite.angularPage;
import static io.github.com.pages.AngularPage.dividerSection;
import static io.github.epam.site.steps.States.shouldBeLoggedIn;
import static com.jdiai.tools.Timer.waitCondition;
import static io.github.com.StaticSite.dividerPage;
import static io.github.com.pages.DividerPage.defaultDividersSeparators;
import static io.github.com.pages.DividerPage.insetDividerSeparators;
import static io.github.com.pages.DividerPage.textWithDefaultDividers;
import static io.github.com.pages.DividerPage.verticalDividerSeparators;
import static org.hamcrest.Matchers.equalTo;

// TODO Move to the new page
@Ignore
public class DividerTests extends TestsInit {

@BeforeMethod(alwaysRun = true)
public void before() {
shouldBeLoggedIn();
angularPage.shouldBeOpened();
dividerPage.open();
waitCondition(() -> dividerPage.isOpened());
dividerPage.checkOpened();
textWithDefaultDividers.show();
}

@Test
public void dividerDisplayTest() {
dividerSection.dividers.has().size(equalTo(2));
dividerSection.dividers.get(1).is().displayed();
dividerSection.dividers.get(2).is().displayed();
@Test(description = "Test checks presence of mat-divider-horizontal class for default divider separators")
public void defaultDividersSeparatorsTest() {
defaultDividersSeparators.has().size(equalTo(2));
defaultDividersSeparators.get(1).hasClass("mat-divider-horizontal");
defaultDividersSeparators.get(2).hasClass("mat-divider-horizontal");
}

@Test
public void dividerHorizontalOrientationTest() {
dividerSection.dividers.get(1).is().horizontal();
dividerSection.dividers.get(2).is().horizontal();
@Test(description = "Test checks presence of mat-divider-inset class for inset divider separators")
public void insetDividersSeparatorsTest() {
insetDividerSeparators.has().size(equalTo(2));
insetDividerSeparators.get(1).hasClass("mat-divider-inset");
insetDividerSeparators.get(2).hasClass("mat-divider-inset");
}
}

@Test(description = "Test checks presence of mat-divider-vertical class for vertical divider separators")
public void verticalDividerSeparatorsTest() {
verticalDividerSeparators.has().size(equalTo(2));
verticalDividerSeparators.get(1).hasClass("mat-divider-vertical");
verticalDividerSeparators.get(2).hasClass("mat-divider-vertical");
}
}

0 comments on commit 05f1218

Please sign in to comment.