-
Notifications
You must be signed in to change notification settings - Fork 47
4916 refactor chips element #5111
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
Open
NewerNaigil
wants to merge
13
commits into
angular_rework_development
Choose a base branch
from
4916_refactor_Chips_element
base: angular_rework_development
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
96f6f03
rebase commit
c8fdb1e
rebase
9a846af
rebase
aad3991
Added corrections according to comments
c402ce0
fix checkstyle error
a74c6e4
deleted unusual class ChipsSection
2b4178e
Amended in accordance with the comments
d552742
Modified in accordance with the comments
589fd64
Modified in accordance with the comments
daa066e
Merge branch 'angular_rework_development' into 4916_refactor_Chips_el…
cabfa98
checkstyle's fixes
1e38219
checkstyle's fixes
a614fd6
Modified in accordance with the comments
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
...t-angular-tests/src/main/java/io/github/com/custom/elements/ChipGroupWithAutocomlete.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| package io.github.com.custom.elements; | ||
|
|
||
| import com.epam.jdi.light.angular.elements.complex.AutoComplete; | ||
| import com.epam.jdi.light.angular.elements.complex.ChipGroup; | ||
| import com.epam.jdi.light.common.JDIAction; | ||
|
|
||
| public class ChipGroupWithAutocomlete extends ChipGroup { | ||
|
|
||
| @JDIAction("Get '{name}' input field") | ||
| public AutoComplete inputField() { | ||
| return new AutoComplete().setCore(AutoComplete.class, core().find("input")); | ||
| } | ||
| } |
55 changes: 55 additions & 0 deletions
55
jdi-light-angular-tests/src/main/java/io/github/com/pages/ChipsPage.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| package io.github.com.pages; | ||
|
|
||
| import com.epam.jdi.light.angular.elements.complex.ChipGroup; | ||
| import com.epam.jdi.light.elements.pageobjects.annotations.locators.UI; | ||
| import com.epam.jdi.light.ui.html.elements.common.Text; | ||
| import io.github.com.custom.elements.ChipGroupWithAutocomlete; | ||
|
|
||
| public class ChipsPage extends NewAngularPage { | ||
|
|
||
| @UI("#basic-chips-row") | ||
| public static ChipGroup basicChips; | ||
|
|
||
| @UI("#stacked-chips-list") | ||
| public static ChipGroup stackedChips; | ||
|
|
||
| @UI("#chips-autocomplete-field") | ||
| public static ChipGroupWithAutocomlete autocompleteChips; | ||
|
|
||
| @UI("#chips-with-input-field") | ||
| public static ChipGroupWithAutocomlete inputChips; | ||
|
|
||
| @UI("#chips-with-form-control") | ||
| public static ChipGroup formControlChips; | ||
|
|
||
| @UI("#chips-drag-and-drop") | ||
| public static ChipGroup dragAndDropChips; | ||
|
|
||
| @UI("#chips-avatar") | ||
| public static ChipGroup avatarChips; | ||
|
|
||
| @UI("#chips-disabled-ripple") | ||
| public static ChipGroup disabledRippleChips; | ||
|
|
||
| @UI("#chips-enabled-ripple") | ||
| public static ChipGroup enabledRippleChips; | ||
|
|
||
| @UI("#chips-disabled") | ||
| public static ChipGroup disabledChips; | ||
|
|
||
| @UI("#chips-highlighted") | ||
| public static ChipGroup highlightedChips; | ||
|
|
||
| @UI("#multiple-chips") | ||
| public static ChipGroup multipleChips; | ||
|
|
||
| @UI("#chips-with-error-state") | ||
| public static ChipGroupWithAutocomlete errorChips; | ||
|
|
||
| @UI("#basic-chips-label") | ||
| public static Text basicSelectedValue; | ||
|
|
||
| @UI("#stacked-chips-label") | ||
| public static Text stackedSelectedValue; | ||
|
|
||
| } | ||
42 changes: 0 additions & 42 deletions
42
jdi-light-angular-tests/src/main/java/io/github/com/pages/sections/ChipsSection.java
This file was deleted.
Oops, something went wrong.
213 changes: 151 additions & 62 deletions
213
...angular-tests/src/test/java/io/github/epam/angular/tests/elements/complex/ChipsTests.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,98 +1,187 @@ | ||
| package io.github.epam.angular.tests.elements.complex; | ||
|
|
||
| import com.epam.jdi.light.angular.elements.enums.AngularColors; | ||
| import io.github.com.pages.ChipsPage; | ||
| import io.github.epam.TestsInit; | ||
| import org.testng.annotations.BeforeMethod; | ||
| import org.testng.annotations.Ignore; | ||
| import org.testng.annotations.BeforeClass; | ||
| import org.testng.annotations.Test; | ||
|
|
||
| import java.util.Arrays; | ||
| import java.util.List; | ||
|
|
||
| import static com.jdiai.tools.StringUtils.format; | ||
| import static io.github.com.StaticSite.angularPage; | ||
| import static io.github.com.pages.sections.ChipsSection.*; | ||
| import static io.github.epam.site.steps.States.shouldBeLoggedIn; | ||
| import static com.jdiai.tools.Timer.waitCondition; | ||
| import static io.github.com.StaticSite.chipsPage; | ||
| import static io.github.com.pages.ChipsPage.autocompleteChips; | ||
| import static io.github.com.pages.ChipsPage.avatarChips; | ||
| import static io.github.com.pages.ChipsPage.basicChips; | ||
| import static io.github.com.pages.ChipsPage.disabledChips; | ||
| import static io.github.com.pages.ChipsPage.errorChips; | ||
| import static io.github.com.pages.ChipsPage.highlightedChips; | ||
| import static io.github.com.pages.ChipsPage.inputChips; | ||
| import static io.github.com.pages.ChipsPage.multipleChips; | ||
| import static io.github.com.pages.ChipsPage.stackedChips; | ||
|
|
||
| // TODO Move to the new page | ||
| @Ignore | ||
| public class ChipsTests extends TestsInit { | ||
|
|
||
| private static final String ONEFISH = "One fish"; | ||
| private static final String TWOFISH = "Two fish"; | ||
| private static final String PRIMARYFISH = "Primary fish"; | ||
| private static final String ACCENTFISH = "Accent fish"; | ||
| private static final String WARNFISH = "Warn fish"; | ||
|
|
||
| private static final String NONE = "none"; | ||
| private static final String PRIMARY = "Primary"; | ||
| private static final String ACCENT = "Accent"; | ||
| private static final String WARN = "Warn"; | ||
|
|
||
| private static final String PLACEHOLDER = "New fruit..."; | ||
| private static final String APPLE = "Apple"; | ||
| private static final String LEMON = "Lemon"; | ||
| private static final String LIME = "Lime"; | ||
| private static final String KIWI = "Kiwi"; | ||
| private static final String ROCKMELON = "Rockmelon"; | ||
| private static final String MELON = "Melon"; | ||
|
|
||
|
|
||
| @BeforeMethod(alwaysRun = true) | ||
| @BeforeClass | ||
| public void before() { | ||
NewerNaigil marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| shouldBeLoggedIn(); | ||
| angularPage.shouldBeOpened(); | ||
| chipsPage.open(); | ||
| waitCondition(() -> chipsPage.isOpened()); | ||
| chipsPage.checkOpened(); | ||
| } | ||
|
|
||
| @Test | ||
| @Test(description = "Test verifies that chip group is selectable") | ||
| public void basicChipsTest() { | ||
| basicChipsRow.show(); | ||
| basicChipsRow.is().displayed(); | ||
| basicChipsRow.is().assertChipsIsEnabled(); | ||
| basicChipsRow.clickChipsByTextValue(ONEFISH); | ||
| basicChipsRow.clickChipsByTextValue(TWOFISH); | ||
| basicChipsRow.clickChipsByTextValue(PRIMARYFISH); | ||
| basicChipsRow.clickChipsByTextValue(ACCENTFISH); | ||
|
|
||
| basicSelectedValue.has().text(format("You clicked: %s", ACCENTFISH)); | ||
| basicChips.show(); | ||
| basicChips.is().displayed().and().enabled(); | ||
| basicChips.selectByLabel(TWOFISH); | ||
| basicChips.getElement(TWOFISH).is().selected(); | ||
| basicChips.selectByLabel(WARNFISH); | ||
| basicChips.getElement(WARNFISH).is().selected(); | ||
|
|
||
| ChipsPage.basicSelectedValue.has().text(format("You clicked: %s", WARNFISH)); | ||
| } | ||
|
|
||
| @Test | ||
| @Test(description = "Test verifies that chip group is vertical") | ||
| public void stackedChipsTest() { | ||
| stackedChipsList.show(); | ||
| stackedChipsList.is().displayed(); | ||
| stackedChipsList.is().assertChipsIsEnabled(); | ||
| stackedChipsList.clickChipsByTextValue(NONE); | ||
| stackedChipsList.clickChipsByTextValue(PRIMARY); | ||
| stackedChipsList.clickChipsByTextValue(ACCENT); | ||
| stackedChipsList.clickChipsByTextValue(WARN); | ||
| stackedChips.show(); | ||
| stackedChips.is().displayed().and().vertical(); | ||
| } | ||
|
|
||
| @Test(description = "Test verifies that chip group is not vertical") | ||
| public void horizontalChipsTest() { | ||
| basicChips.show(); | ||
| basicChips.is().displayed().and().notVertical(); | ||
| } | ||
|
|
||
| @Test(description = "Test check chips colors") | ||
| public void chipsColorTest() { | ||
| highlightedChips.show(); | ||
| highlightedChips.is().displayed(); | ||
| highlightedChips.getElement("Highlighted color Primary").is().color(AngularColors.PRIMARY) | ||
| .and().highlighted(); | ||
| highlightedChips.getElement("Highlighted color Accent").is().color(AngularColors.ACCENT) | ||
| .and().highlighted(); | ||
| highlightedChips.getElement("Highlighted color Warn").is().color(AngularColors.WARN) | ||
| .and().highlighted(); | ||
| } | ||
|
|
||
| stackedSelectedValue.has().text(format("You clicked: %s", WARN)); | ||
| @Test(description = "Test verifies that chips isn't highlighted") | ||
| public void chipsNotHighlightedTest() { | ||
| basicChips.show(); | ||
| basicChips.is().displayed().and().enabled(); | ||
| basicChips.getElement(TWOFISH).is().notHighlighted(); | ||
| basicChips.getElement(WARNFISH).is().notHighlighted(); | ||
| } | ||
|
|
||
| @Test | ||
| @Test(description = "Test checks the operation of the autocomplete in chips group") | ||
| public void chipsAutocompleteTest() { | ||
| String[] expectedValuesArray = { | ||
| "Apple", "Lemon", "Lime", "Orange", "Strawberry"}; | ||
| APPLE, LEMON, LIME, "Orange", "Strawberry"}; | ||
| List<String> expectedValues = Arrays.asList(expectedValuesArray); | ||
| chipsAutocompleteField.show(); | ||
| chipsAutocompleteField.is().displayed(); | ||
| chipsAutocompleteInput.is().assertChipsIsEnabled(); | ||
| chipsAutocompleteInput.has().assertChipsHasPlaceholder(PLACEHOLDER); | ||
| chipsAutocompleteInput.has().assertChipsHasOptions(expectedValues); | ||
|
|
||
| chipsAutocompleteInput.setValue(LEMON); | ||
| chipsAutocompleteField.collapseField(); | ||
| chipsAutocompleteInput.setValue(APPLE); | ||
| chipsAutocompleteField.collapseField(); | ||
| chipsAutocompleteInput.setValue(LIME); | ||
| chipsAutocompleteField.collapseField(); | ||
| autocompleteChips.show(); | ||
| autocompleteChips.is().displayed(); | ||
| autocompleteChips.inputField().has().placeholder("New Fruit..."); | ||
| autocompleteChips.inputField().has().options(expectedValues); | ||
|
|
||
| autocompleteChips.inputField().select(LEMON); | ||
| autocompleteChips.is().hasElement(LEMON); | ||
| autocompleteChips.inputField().select(APPLE); | ||
| autocompleteChips.is().hasElement(APPLE); | ||
| } | ||
|
|
||
| @Test | ||
| @Test(description = "Test checks the input field in chips group") | ||
| public void chipsWithInputTest() { | ||
| chipsWithInputField.show(); | ||
| chipsWithInputField.is().displayed(); | ||
| chipsWithInputInput.is().assertChipsIsEnabled(); | ||
| chipsWithInputInput.has().assertChipsHasPlaceholder(PLACEHOLDER); | ||
| chipsWithInputInput.input("Kiwi" + "\n"); | ||
| chipsWithInputInput.input("Melon"); | ||
| chipsWithInputInput.clearInputField(); | ||
| chipsWithInputInput.input("Rockmelon" + "\n"); | ||
| } | ||
| } | ||
| inputChips.show(); | ||
| inputChips.is().displayed(); | ||
| inputChips.inputField().has().placeholder("New fruit..."); | ||
| inputChips.inputField().input(KIWI + "\n"); | ||
| inputChips.inputField().input(MELON); | ||
| inputChips.inputField().clear(); | ||
| inputChips.inputField().input(ROCKMELON + "\n"); | ||
| inputChips.is().hasElement(KIWI); | ||
| inputChips.is().hasElement(ROCKMELON); | ||
| } | ||
|
|
||
| @Test(description = "Test checks that chips can be removed") | ||
| public void chipsRemovableTest() { | ||
| inputChips.show(); | ||
| inputChips.is().displayed(); | ||
| inputChips.getElement(LEMON).is().removable(); | ||
| inputChips.getElement(LEMON).remove(); | ||
| } | ||
|
|
||
| @Test(description = "Test checks that chips can't be removed") | ||
| public void chipsNotRemovableTest() { | ||
| basicChips.show(); | ||
| basicChips.is().displayed(); | ||
| basicChips.getElement(WARNFISH).is().notRemovable(); | ||
| } | ||
|
|
||
| @Test(description = "Test checks that chips can be focused") | ||
| public void chipFocusedTest() { | ||
| inputChips.show(); | ||
| inputChips.is().displayed(); | ||
| inputChips.getElement(APPLE).click(); | ||
| inputChips.getElement(APPLE).is().focused(); | ||
| inputChips.getElement(LIME).click(); | ||
| inputChips.getElement(LIME).is().focused(); | ||
| inputChips.getElement(APPLE).is().notFocused(); | ||
| } | ||
|
|
||
| @Test(description = "Test checks that chips has avatar image") | ||
| public void chipAvatarTest() { | ||
| avatarChips.show(); | ||
| avatarChips.getElement("Dog one").has().image(); | ||
| } | ||
|
|
||
| @Test(description = "Test checks that chips can be disabled") | ||
| public void chipDisabledTest() { | ||
| disabledChips.show(); | ||
| disabledChips.is().displayed().and().disabled(); | ||
| } | ||
|
|
||
| @Test(description = "Test checks chips multiply selection") | ||
| public void chipsMultipleSelectionTest() { | ||
| multipleChips.show(); | ||
| multipleChips.is().displayed(); | ||
| multipleChips.is().multiselectable(); | ||
NewerNaigil marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| multipleChips.selectByLabel("multiple color none"); | ||
| multipleChips.selectByLabel("multiple color Primary"); | ||
| multipleChips.getElement("multiple color none").is().selected(); | ||
| multipleChips.getElement("multiple color Primary").is().selected(); | ||
| } | ||
|
|
||
| @Test(description = "Test checks chips isn't multiply selection") | ||
| public void chipsNotMultipleSelectionTest() { | ||
| basicChips.show(); | ||
| basicChips.is().displayed(); | ||
| basicChips.is().notMultiselectable(); | ||
| basicChips.selectByLabel(TWOFISH); | ||
| basicChips.selectByLabel(WARNFISH); | ||
| basicChips.getElement(TWOFISH).is().deselected(); | ||
| basicChips.getElement(WARNFISH).is().selected(); | ||
|
|
||
| } | ||
|
|
||
| @Test(description = "Test checks that chips has error state") | ||
| public void chipsErrorState() { | ||
| errorChips.show(); | ||
| errorChips.is().displayed(); | ||
| errorChips.inputField().input(KIWI + "\n"); | ||
| errorChips.has().errorState(); | ||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.