Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP]4987+4988: Angular select class implementation and refactoring tests #5096

Open
wants to merge 4 commits into
base: angular_rework_development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import io.github.com.pages.ProgressBarPage;
import io.github.com.pages.ProgressSpinnerPage;
import io.github.com.pages.RadioButtonPage;
import io.github.com.pages.SelectPage;

@JSite("https://jdi-testing.github.io/jdi-light/angular-page/#/")
public class StaticSite {
Expand All @@ -36,6 +37,9 @@ public class StaticSite {
@Url("autocompletes")
public static AutocompletePage autocompletePage;

@Url("select")
public static SelectPage selectPage;

@Url("radio_button")
public static RadioButtonPage radioButtonPage;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ public class AngularPage extends WebPage {
public static ToolbarSection toolbarSection;
public static SlideToggleSection slideToggleSection;
public static InputSection inputSection;
public static SelectSection selectSection;
public static ListSection listSection;
public static GridListSection gridListSection;
public static SnackbarSection snackbarSection;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,45 +1,48 @@
package io.github.com.pages.sections;

import com.epam.jdi.light.angular.elements.common.Checkbox;
import com.epam.jdi.light.angular.elements.complex.MaterialSelector;
import com.epam.jdi.light.angular.elements.complex.NativeSelector;
import com.epam.jdi.light.elements.composite.Section;
import com.epam.jdi.light.ui.html.elements.common.Text;

public class SelectSection extends Section {
public static MaterialSelector basicMatSelect;
public static NativeSelector basicNativeSelect;

public static MaterialSelector twoBindingSelect;
public static Text selectBindingConfirm;

public static MaterialSelector formMatSelect;
public static Text formMatSelectConfirm;

public static NativeSelector formNativeSelect;
public static Text formNativeSelectConfirm;

public static MaterialSelector formMatFeatureSelect;
public static NativeSelector formNativeFeatureSelect;

public static MaterialSelector disableMatSelect;
public static NativeSelector disableNativeSelect;
public static Checkbox disableCheckboxSelect;

public static MaterialSelector resetMatSelect;
public static NativeSelector resetNativeSelect;

public static MaterialSelector optionGroupsMatSelect;
public static NativeSelector optionGroupsNativeSelect;

public static MaterialSelector multipleSelect;

public static MaterialSelector customTriggerTextSelect;

public static MaterialSelector noOptionRippleSelect;

public static MaterialSelector customPanelStylingSelect;

public static MaterialSelector matErrorStateMatcherSelect;
public static NativeSelector nativeErrorStateMatcherSelect;
}
package io.github.com.pages;

import com.epam.jdi.light.angular.elements.common.Checkbox;
import com.epam.jdi.light.angular.elements.complex.MaterialSelector;
import com.epam.jdi.light.angular.elements.complex.NativeSelector;
import com.epam.jdi.light.elements.pageobjects.annotations.locators.UI;
import com.epam.jdi.light.ui.html.elements.common.Text;

public class SelectPage extends NewAngularPage {

public static MaterialSelector basicMatSelect;
public static NativeSelector basicNativeSelect;

public static MaterialSelector twoBindingSelect;
public static Text selectBindingConfirm;

public static MaterialSelector formMatSelect;
public static Text formMatSelectConfirm;

public static NativeSelector formNativeSelect;
public static Text formNativeSelectConfirm;

public static MaterialSelector formMatFeatureSelect;
public static NativeSelector formNativeFeatureSelect;

public static MaterialSelector disableMatSelect;
public static NativeSelector disableNativeSelect;
public static Checkbox disableCheckboxSelect;

public static MaterialSelector resetMatSelect;
public static NativeSelector resetNativeSelect;

public static MaterialSelector optionGroupsMatSelect;
public static NativeSelector optionGroupsNativeSelect;

public static MaterialSelector multipleSelect;

public static MaterialSelector customTriggerTextSelect;

public static MaterialSelector noOptionRippleSelect;

@UI("#custom-panel-styling-select")
public static MaterialSelector customPanelStylingSelect;

public static MaterialSelector matErrorStateMatcherSelect;
public static NativeSelector nativeErrorStateMatcherSelect;

}
Original file line number Diff line number Diff line change
@@ -1,62 +1,48 @@
package io.github.epam.angular.tests.elements.complex.select;

import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Ignore;
import org.testng.annotations.Test;

import java.util.Arrays;
import java.util.Collections;

import static com.epam.jdi.light.settings.JDISettings.ELEMENT;
import static io.github.com.StaticSite.angularPage;
import static io.github.com.pages.sections.SelectSection.basicMatSelect;
import static com.jdiai.tools.Timer.waitCondition;
import static io.github.com.StaticSite.selectPage;
import static io.github.com.pages.SelectPage.basicMatSelect;
import static org.hamcrest.Matchers.hasItems;

// TODO Move to the new page
@Ignore
public class BasicMatSelectTests extends TestsSelectBase {
@BeforeMethod(alwaysRun = true)
public void before() {
angularPage.shouldBeOpened();
basicMatSelect.show();
selectPage.open();
waitCondition(() -> selectPage.isOpened());
selectPage.checkOpened();
}

@Test
@Test(description = "Test checks label value")
public void checkLabelValue() {
basicMatSelect.label().has().value("Favorite food");
}

@Test
@Test(description = "Test checks expand-collapse functionality")
public void checkSelectorExpanded() {
basicMatSelect.expand();
basicMatSelect.is().expanded();
basicMatSelect.collapse();
basicMatSelect.is().collapsed();
}

@Test
public void checkSelectorCollapsed() {
basicMatSelect.collapse();
basicMatSelect.is().collapsed();
}

@Test
public void checkOptionCanBeSelectedByIndex() {
basicMatSelect.select(ELEMENT.startIndex + 1);
basicMatSelect.is().selected(PIZZA);
}

@Test
@Test(description = "Test checks that element does not contain disabled options")
public void checkListDisabledOptions() {
basicMatSelect.has().listDisabled(Collections.EMPTY_LIST);
}

@Test
@Test(description = "Test checks that element contains certain enabled options")
public void checkListEnabledOptions() {
basicMatSelect.has().listEnabled(Arrays.asList(STEAK, PIZZA, TACOS));
}

@Test
@Test(description = "Test checks that element contains certain options")
public void checkAvailableOptions() {
basicMatSelect.assertThat().values(hasItems(TACOS, STEAK, PIZZA));
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,55 +1,42 @@
package io.github.epam.angular.tests.elements.complex.select;

import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Ignore;
import org.testng.annotations.Test;

import java.util.Arrays;
import java.util.Collections;

import static io.github.com.pages.sections.SelectSection.basicNativeSelect;
import static io.github.com.pages.SelectPage.basicNativeSelect;
import static org.hamcrest.Matchers.*;

// TODO Move to the new page
@Ignore
public class BasicNativeSelectTests extends TestsSelectBase {
@BeforeMethod(alwaysRun = true)
public void before() {
basicNativeSelect.show();
}

@Test
@Test(description = "Test checks label value")
public void checkLabelValue() {
basicNativeSelect.label().has().value("Cars *");
basicNativeSelect.label().has().value("Cars");
}

@Test
@Test(description = "Test checks preselected value in the field")
public void checkPreselectedValue() {
basicNativeSelect.verify().selected(matchesPattern("[a-zA-Z]+"));
}

@Test
@Test(description = "Test checks option can be selected by name")
public void checkOptionCanBeSelectedByName() {
basicNativeSelect.select(SAAB);
basicNativeSelect.is().selected(SAAB);
}

@Test
public void checkListDisabledOptions() {
basicNativeSelect.has().listDisabled(Collections.EMPTY_LIST);
}

@Test
public void checkListEnabledOptions() {
basicNativeSelect.has().listEnabled(Arrays.asList(VOLVO, SAAB, MERCEDES, AUDI));
}

@Test
@Test(description = "Test checks available groups")
public void checkAvailableGroups() {
basicNativeSelect.is().groups(Collections.EMPTY_LIST);
}

@Test
@Test(description = "Test checks available options")
public void checkAvailableOptions() {
basicNativeSelect.assertThat().values(hasItem(AUDI)).values(hasItems(AUDI, VOLVO, SAAB, MERCEDES));
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
package io.github.epam.angular.tests.elements.complex.select;

import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Ignore;
import org.testng.annotations.Test;

import java.util.Arrays;

import static io.github.com.pages.sections.SelectSection.customPanelStylingSelect;
import static com.jdiai.tools.Timer.sleep;
import static com.jdiai.tools.Timer.waitCondition;
import static io.github.com.pages.SelectPage.customPanelStylingSelect;
import static org.hamcrest.Matchers.hasItems;

// TODO Move to the new page
@Ignore
public class CustomPanelStylingSelectTests extends TestsSelectBase {
@BeforeMethod(alwaysRun = true)
public void before() {
Expand All @@ -37,7 +36,7 @@ public void checkGreenOptionCanBeSelectedByName() {
}

@Test
public void checkBlueOptionCanBeSelectedByName() {
public void checkBlueOptionCanBeSelectedByName() throws InterruptedException {
customPanelStylingSelect.select(BLUE);
customPanelStylingSelect.is().selected(BLUE);
customPanelStylingSelect.has().color(0, 0, 255, 0.5);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
package io.github.epam.angular.tests.elements.complex.select;

import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Ignore;
import org.testng.annotations.Test;

import java.util.Arrays;

import static io.github.com.StaticSite.angularPage;
import static io.github.com.pages.sections.SelectSection.customTriggerTextSelect;
import static com.jdiai.tools.Timer.waitCondition;
import static io.github.com.StaticSite.selectPage;
import static io.github.com.pages.SelectPage.customTriggerTextSelect;


// TODO Move to the new page
@Ignore
public class CustomTriggerTextSelectTests extends TestsSelectBase {
private String[] multiOptions = new String[1];

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

@Test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
package io.github.epam.angular.tests.elements.complex.select;

import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Ignore;
import org.testng.annotations.Test;

import java.util.Arrays;

import static com.epam.jdi.light.settings.JDISettings.ELEMENT;
import static io.github.com.pages.sections.SelectSection.disableCheckboxSelect;
import static io.github.com.pages.sections.SelectSection.disableMatSelect;
import static io.github.com.pages.SelectPage.disableCheckboxSelect;
import static io.github.com.pages.SelectPage.disableMatSelect;

// TODO Move to the new page
@Ignore
public class DisableMatSelectTests extends TestsSelectBase {
private static final String ARIA_DISABLED = "aria-disabled";
private static final String OPTION_2_DISABLED = "Option 2 (disabled)";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
package io.github.epam.angular.tests.elements.complex.select;

import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Ignore;
import org.testng.annotations.Test;

import java.util.Arrays;

import static com.epam.jdi.light.settings.JDISettings.ELEMENT;
import static io.github.com.pages.sections.SelectSection.disableNativeSelect;
import static io.github.com.pages.SelectPage.disableNativeSelect;

// TODO Move to the new page
@Ignore
public class DisableNativeSelectTests extends TestsSelectBase {
private static final String DISABLED = "disabled";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
package io.github.epam.angular.tests.elements.complex.select;

import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Ignore;
import org.testng.annotations.Test;

import java.util.Arrays;

import static io.github.com.pages.sections.SelectSection.formMatFeatureSelect;
import static io.github.com.pages.SelectPage.formMatFeatureSelect;
import static org.hamcrest.Matchers.matchesPattern;

// TODO Move to the new page
@Ignore
public class FormMatFeatureSelectTests extends TestsSelectBase {
@BeforeMethod(alwaysRun = true)
public void before() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
package io.github.epam.angular.tests.elements.complex.select;

import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Ignore;
import org.testng.annotations.Test;

import java.util.Arrays;
import java.util.Collections;

import static com.epam.jdi.light.settings.JDISettings.ELEMENT;
import static io.github.com.pages.sections.SelectSection.formMatSelect;
import static io.github.com.pages.sections.SelectSection.formMatSelectConfirm;
import static io.github.com.pages.SelectPage.formMatSelect;
import static io.github.com.pages.SelectPage.formMatSelectConfirm;
import static org.hamcrest.Matchers.hasItems;

// TODO Move to the new page
@Ignore
public class FormMatSelectTests extends TestsSelectBase {
@BeforeMethod(alwaysRun = true)
public void before() {
Expand Down
Loading
Loading