-
Notifications
You must be signed in to change notification settings - Fork 48
4952 + 4964: Angular grid list class implementation and refactoring tests #5085
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
b14ckster
wants to merge
37
commits into
angular_rework_development
Choose a base branch
from
angular_grid_list_class_implementation
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 30 commits
Commits
Show all changes
37 commits
Select commit
Hold shift + click to select a range
a18ae08
add grid list implementation and refactor tests
b14ckster 95a1554
add grid list implementation and add tests
b14ckster e32700e
refactor code
b14ckster eac88c8
refactor code and implement using new page
b14ckster 854d3a2
implement grid list class and refactor tests
b14ckster 4478d36
refactor imports and enum
b14ckster 260fab6
refactor unit tests
b14ckster dc4d9c9
refactor tests and Element Object
b14ckster e407e9b
hot fix Colors
b14ckster dd6abf5
grid list tests refactoring
b14ckster f2f26c5
refactor asserts
b14ckster b2d62cd
4952-64-refactoringGridListAfterRebase
MayaElf b2f8717
4952-64-refactoringGridListAfterRebase
MayaElf 5be7585
Merge branch 'angular_rework_development' into angular_grid_list_clas…
AlinaLysenko 32ebfa6
Merge branch 'angular_rework_development' into angular_grid_list_clas…
AlinaLysenko d1f6926
gridTile implemented with header, footer and avatar
AlinaLysenko 13595b0
changed cell to tile in naming
AlinaLysenko fe09856
Merge branch 'angular_rework_development' into angular_grid_list_clas…
AlinaLysenko c42148a
fixed comments
AlinaLysenko fa15251
removed unused imports
AlinaLysenko 34b2f5e
Merge branch 'angular_rework_development' into angular_grid_list_clas…
AlinaLysenko c20c5d8
added background colors
AlinaLysenko 763b7b9
text method updated
AlinaLysenko 473ff98
Merge branch 'angular_rework_development' into angular_grid_list_clas…
AlinaLysenko 7125245
option to implement extending UIListBase
AlinaLysenko 1aa6a2d
removed creating variables for actual values for asserts
AlinaLysenko 42db430
added getting footer and header as uiElement. No extra asserts added
AlinaLysenko f219d10
fixed text colors and added names for tiles
AlinaLysenko 2aab439
Merge branch 'angular_rework_development' into angular_grid_list_clas…
AlinaLysenko 7720301
added get content option, removed "in pixels" and changed tileByIngex…
AlinaLysenko bb6f030
removed content option, and separated getting tiles in stream and list
AlinaLysenko b67c3ba
added assertions for grid list and test examples for it
AlinaLysenko 1f0dd27
removed methods itemsWithTexts and textsInItems
AlinaLysenko 9eb0550
Update jdi-light-angular/src/main/java/com/epam/jdi/light/angular/ass…
vklonin eae91ea
Update jdi-light-angular-tests/src/test/java/io/github/epam/angular/t…
vklonin 969e802
added custom tile, fixed empty matcher, removed mismatch message
AlinaLysenko 50a42ae
Merge remote-tracking branch 'origin/angular_grid_list_class_implemen…
AlinaLysenko 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
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
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
10 changes: 10 additions & 0 deletions
10
jdi-light-angular-tests/src/main/java/io/github/com/pages/GridListPage.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,10 @@ | ||
| package io.github.com.pages; | ||
|
|
||
| import com.epam.jdi.light.angular.elements.complex.gridlist.GridList; | ||
| import com.epam.jdi.light.elements.pageobjects.annotations.locators.UI; | ||
|
|
||
| public class GridListPage extends NewAngularPage { | ||
|
|
||
| @UI("#dynamic-grid-list") | ||
| public static GridList dynamicGridList; | ||
| } |
14 changes: 0 additions & 14 deletions
14
jdi-light-angular-tests/src/main/java/io/github/com/pages/sections/GridListSection.java
This file was deleted.
Oops, something went wrong.
96 changes: 55 additions & 41 deletions
96
...ular-tests/src/test/java/io/github/epam/angular/tests/elements/complex/GridListTests.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,59 +1,73 @@ | ||
| package io.github.epam.angular.tests.elements.complex; | ||
|
|
||
| import com.epam.jdi.light.angular.elements.enums.AngularColors; | ||
| 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 static io.github.com.StaticSite.angularPage; | ||
| import static io.github.com.pages.AngularPage.gridListSection; | ||
| import static io.github.epam.site.steps.States.shouldBeLoggedIn; | ||
| import static io.github.com.enums.Colors.BLACK_TRANSPARENT_087; | ||
| import static io.github.com.enums.Colors.LIGHT_GREEN_2; | ||
| import static io.github.com.enums.Colors.LIGHT_LILAC; | ||
| import static com.jdiai.tools.Timer.waitCondition; | ||
| import static io.github.com.StaticSite.gridListPage; | ||
|
|
||
| import static io.github.com.enums.Colors.LIGHT_PINK; | ||
| import static io.github.com.enums.Colors.WHITE; | ||
| import static io.github.com.enums.Colors.WHITE_TRANSPARENT_038; | ||
| import static io.github.com.pages.GridListPage.dynamicGridList; | ||
|
|
||
| // TODO Move to the new page | ||
| @Ignore | ||
| public class GridListTests extends TestsInit { | ||
|
|
||
| @BeforeMethod | ||
| @BeforeClass | ||
| public void before() { | ||
| shouldBeLoggedIn(); | ||
| angularPage.shouldBeOpened(); | ||
| gridListPage.open(); | ||
| waitCondition(() -> gridListPage.isOpened()); | ||
| gridListPage.checkOpened(); | ||
| } | ||
|
|
||
| @Test | ||
| public void basicGridListBasicTest() { | ||
| gridListSection.basicGridList.is().displayed(); | ||
| } | ||
| @Test(description = "Test checks dynamic grid list attributes") | ||
| public void dynamicGridListTest() { | ||
| dynamicGridList.shouldBe().displayed(); | ||
| dynamicGridList.show(); | ||
| dynamicGridList.shouldBe().visible(); | ||
|
|
||
| @Test | ||
| public void basicGridListTextTest() { | ||
| gridListSection.basicGridList.get(1).is().text("1"); | ||
| } | ||
| dynamicGridList.has().cols(4) | ||
| .and().rowHeight("100px") | ||
| .and().gutterSize("10px"); | ||
|
|
||
| @Test | ||
| public void basicGridListColorTest() { | ||
| gridListSection.basicGridList.get(1) | ||
| .has().css("background-color", "rgba(" + 173 + ", " + 216 + ", " + 230 + ", 1)"); | ||
| } | ||
| dynamicGridList.getTiles().forEach(e -> e.is().visible()); | ||
|
|
||
| @Test | ||
| public void dynamicGridListBasicTest() { | ||
| gridListSection.dynamicGridList.is().displayed(); | ||
| } | ||
| dynamicGridList.tileByIndex(1) | ||
| .is().text("One") | ||
|
vklonin marked this conversation as resolved.
Outdated
|
||
| .and().colspan(3) | ||
| .and().rowspan(1); | ||
|
|
||
| @Test | ||
| public void dynamicGridListTextTest() { | ||
| gridListSection.dynamicGridList.get(1).is().text("One"); | ||
| } | ||
| dynamicGridList.tileByIndex(2) | ||
| .is().color(AngularColors.fromColor(LIGHT_GREEN_2.value())) | ||
| .and().colspan(1) | ||
| .and().rowspan(2); | ||
|
|
||
| dynamicGridList.tileByIndex(2).content().find(".avatar-img").is() | ||
| .attr("src","https://material.angular.io/assets/img/examples/shiba2.jpg"); | ||
|
|
||
| dynamicGridList.tileByIndex(3) | ||
| .is().colspan(1) | ||
| .and().rowspan(1) | ||
| .and().backgroundColor(LIGHT_PINK.value()) | ||
| .and().backgroundColor(AngularColors.fromColor(LIGHT_PINK.value())) | ||
| .and().color(BLACK_TRANSPARENT_087.value()) | ||
| .and().color(AngularColors.fromColor(BLACK_TRANSPARENT_087.value())) | ||
| .and().footerColor(AngularColors.fromColor(WHITE.value())) | ||
| .and().footerBackgroundColor(WHITE_TRANSPARENT_038.value()) | ||
| .and().headerColor(WHITE.value()) | ||
| .and().headerBackgroundColor(AngularColors.fromColor(WHITE_TRANSPARENT_038.value())) | ||
| .and().text("Mat Grid Header\nThree\nMat Grid Footer") | ||
| .and().footerText("Mat Grid Footer") | ||
| .and().headerText("Mat Grid Header"); | ||
|
|
||
| @Test | ||
| public void dynamicGridListColorTest() { | ||
| gridListSection.dynamicGridList.get(1) | ||
| .has().css("background-color", "rgba(" + 173 + ", " + 216 + ", " + 230 + ", 1)"); | ||
| gridListSection.dynamicGridList.get(2) | ||
| .has().css("background-color", "rgba(" + 144 + ", " + 238 + ", " + 144 + ", 1)"); | ||
| gridListSection.dynamicGridList.get(3) | ||
| .has().css("background-color", "rgba(" + 255 + ", " + 182 + ", " + 193 + ", 1)"); | ||
| gridListSection.dynamicGridList.get(4) | ||
| .has().css("background-color", "rgba(" + 221 + ", " + 189 + ", " + 241 + ", 1)"); | ||
| dynamicGridList.tileByIndex(4) | ||
| .is().text("Four") | ||
| .and().color(AngularColors.fromColor(LIGHT_LILAC.value())) | ||
| .and().colspan(2); | ||
| } | ||
| } | ||
31 changes: 31 additions & 0 deletions
31
...ght-angular/src/main/java/com/epam/jdi/light/angular/asserts/gridlist/GridListAssert.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,31 @@ | ||
| package com.epam.jdi.light.angular.asserts.gridlist; | ||
|
|
||
| import static com.epam.jdi.light.asserts.core.SoftAssert.jdiAssert; | ||
|
|
||
| import com.epam.jdi.light.angular.elements.complex.gridlist.GridList; | ||
| import com.epam.jdi.light.asserts.generic.UISelectAssert; | ||
| import com.epam.jdi.light.common.JDIAction; | ||
| import org.hamcrest.Matchers; | ||
|
|
||
| public class GridListAssert extends UISelectAssert<GridListAssert, GridList> { | ||
|
vklonin marked this conversation as resolved.
|
||
|
|
||
| @JDIAction("Assert that '{name}' has number of columns '{0}'") | ||
|
vklonin marked this conversation as resolved.
Outdated
|
||
| public GridListAssert cols(int expectedCols) { | ||
| jdiAssert(element().cols(), Matchers.is(expectedCols), | ||
| String.format("\nActual number of columns in Grid List: '%s'\n" + | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. стандартное сообщение матчера нормальное, к нему все привыкли |
||
| "is not equal to expected: '%s'", element().cols(), expectedCols)); | ||
| return this; | ||
| } | ||
|
|
||
| @JDIAction("Assert that '{name}' has row's height '{0}'") | ||
| public GridListAssert rowHeight(String expectedRowHeight) { | ||
| jdiAssert(element().rowHeight(), Matchers.is(expectedRowHeight)); | ||
| return this; | ||
| } | ||
|
|
||
| @JDIAction("Assert that '{name}' has gutter size '{0}'") | ||
| public GridListAssert gutterSize(String expectedGutterSize) { | ||
| jdiAssert(element().gutterSize(), Matchers.is(expectedGutterSize)); | ||
| return this; | ||
| } | ||
| } | ||
103 changes: 103 additions & 0 deletions
103
...ght-angular/src/main/java/com/epam/jdi/light/angular/asserts/gridlist/GridTileAssert.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,103 @@ | ||
| package com.epam.jdi.light.angular.asserts.gridlist; | ||
|
|
||
| import com.epam.jdi.light.angular.elements.complex.gridlist.GridTile; | ||
| import com.epam.jdi.light.angular.elements.enums.AngularColors; | ||
| import com.epam.jdi.light.asserts.generic.ColorAssert; | ||
| import com.epam.jdi.light.asserts.generic.UIAssert; | ||
| import com.epam.jdi.light.common.JDIAction; | ||
| import org.hamcrest.Matchers; | ||
|
|
||
| import static com.epam.jdi.light.asserts.core.SoftAssert.jdiAssert; | ||
|
|
||
| public class GridTileAssert extends UIAssert<GridTileAssert, GridTile> implements ColorAssert<GridTileAssert, GridTile> { | ||
|
|
||
| @JDIAction("Assert that '{name}' has number of columns '{0}'") | ||
| public GridTileAssert colspan(int expectedColspan) { | ||
| jdiAssert(element().colspan(), Matchers.is(expectedColspan)); | ||
| return this; | ||
|
vklonin marked this conversation as resolved.
|
||
| } | ||
|
|
||
| @JDIAction("Assert that '{name}' has number of rows '{0}'") | ||
| public GridTileAssert rowspan(int expectedRowspan) { | ||
| jdiAssert(element().rowspan(), Matchers.is(expectedRowspan)); | ||
| return this; | ||
| } | ||
|
|
||
| @JDIAction("Assert that '{name}' has text '{0}'") | ||
| public GridTileAssert text(String expectedText) { | ||
| jdiAssert(element().text(), Matchers.is(expectedText)); | ||
| return this; | ||
| } | ||
|
|
||
| @JDIAction("Assert that '{name}' color is '{0}'") | ||
| public GridTileAssert color(AngularColors expectedColor) { | ||
| jdiAssert(element().angularColor(), Matchers.is(expectedColor)); | ||
| return this; | ||
| } | ||
|
|
||
| @JDIAction("Assert that '{name}' background color is '{0}'") | ||
| public GridTileAssert backgroundColor(AngularColors expectedColor) { | ||
| jdiAssert(element().angularBackgroundColor(), Matchers.is(expectedColor)); | ||
| return this; | ||
| } | ||
|
|
||
| @JDIAction("Assert that '{name}' header color is '{0}'") | ||
| public GridTileAssert headerColor(AngularColors expectedColor) { | ||
| jdiAssert(element().headerAngularColor(), Matchers.is(expectedColor)); | ||
| return this; | ||
| } | ||
|
|
||
| @JDIAction("Assert that '{name}' header color is '{0}'") | ||
| public GridTileAssert headerColor(String expectedColor) { | ||
| jdiAssert(element().headerColor(), Matchers.is(expectedColor)); | ||
| return this; | ||
| } | ||
|
|
||
| @JDIAction("Assert that '{name}' header background color is '{0}'") | ||
| public GridTileAssert headerBackgroundColor(AngularColors expectedColor) { | ||
| jdiAssert(element().headerAngularBackgroundColor(), Matchers.is(expectedColor)); | ||
| return this; | ||
| } | ||
|
|
||
| @JDIAction("Assert that '{name}' header background color is '{0}'") | ||
| public GridTileAssert headerBackgroundColor(String expectedColor) { | ||
| jdiAssert(element().headerBackgroundColor(), Matchers.is(expectedColor)); | ||
| return this; | ||
| } | ||
|
|
||
| @JDIAction("Assert that '{name}' footer color is '{0}'") | ||
| public GridTileAssert footerColor(AngularColors expectedColor) { | ||
| jdiAssert(element().footerAngularColor(), Matchers.is(expectedColor)); | ||
| return this; | ||
| } | ||
|
|
||
| @JDIAction("Assert that '{name}' footer color is '{0}'") | ||
| public GridTileAssert footerColor(String expectedColor) { | ||
| jdiAssert(element().footerColor(), Matchers.is(expectedColor)); | ||
| return this; | ||
| } | ||
|
|
||
| @JDIAction("Assert that '{name}' footer background color is '{0}'") | ||
| public GridTileAssert footerBackgroundColor(AngularColors expectedColor) { | ||
| jdiAssert(element().footerAngularBackgroundColor(), Matchers.is(expectedColor)); | ||
| return this; | ||
| } | ||
|
|
||
| @JDIAction("Assert that '{name}' footer background color is '{0}'") | ||
| public GridTileAssert footerBackgroundColor(String expectedColor) { | ||
| jdiAssert(element().footerBackgroundColor(), Matchers.is(expectedColor)); | ||
| return this; | ||
| } | ||
|
|
||
| @JDIAction("Assert that '{name}' header text is '{0}'") | ||
| public GridTileAssert headerText(String expectedText) { | ||
| jdiAssert(element().headerText(), Matchers.is(expectedText)); | ||
| return this; | ||
| } | ||
|
|
||
| @JDIAction("Assert that '{name}' footer text is '{0}'") | ||
| public GridTileAssert footerText(String expectedText) { | ||
| jdiAssert(element().footerText(), Matchers.is(expectedText)); | ||
| return this; | ||
| } | ||
| } | ||
52 changes: 52 additions & 0 deletions
52
...-angular/src/main/java/com/epam/jdi/light/angular/elements/complex/gridlist/GridList.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,52 @@ | ||
| package com.epam.jdi.light.angular.elements.complex.gridlist; | ||
|
|
||
| import com.epam.jdi.light.angular.asserts.gridlist.GridListAssert; | ||
| import com.epam.jdi.light.common.JDIAction; | ||
| import com.epam.jdi.light.elements.base.UIListBase; | ||
|
|
||
| import java.util.stream.Stream; | ||
|
|
||
| /** | ||
| * To see an example of Grid web element please visit | ||
| * <a href="https://material.angular.io/components/grid-list/overview">Angular Grid list Web Page</a> | ||
| */ | ||
| public class GridList extends UIListBase<GridListAssert> { | ||
|
|
||
| @JDIAction(value = "Get '{name}' number of columns") | ||
| public int cols() { | ||
| return Integer.parseInt(core().getAttribute("cols")); | ||
| } | ||
|
|
||
| @JDIAction(value = "Get '{name}' row's height") | ||
| public String rowHeight() { | ||
| return core().getAttribute("rowheight"); | ||
| } | ||
|
|
||
| @JDIAction(value = "Get '{name}' gutter size") | ||
| public String gutterSize() { | ||
| return core().getAttribute("guttersize"); | ||
| } | ||
|
|
||
| @JDIAction(value = "Get '{name}' tile by index '{0}' (1 based index)") | ||
| public GridTile tileByIndex(int index) { | ||
|
vklonin marked this conversation as resolved.
|
||
| return getTiles() | ||
| .skip(index - 1) | ||
| .findFirst() | ||
| .orElseThrow(() -> new IllegalArgumentException("No tile at index " + index)); | ||
| } | ||
|
|
||
| @Override | ||
| public GridListAssert is() { | ||
| return new GridListAssert().set(this); | ||
| } | ||
|
|
||
| public Stream<GridTile> getTiles() { | ||
| int[] counter = {1}; | ||
| return core().finds(".mat-grid-tile").stream() | ||
| .map(e -> { | ||
| GridTile tile = new GridTile().setCore(GridTile.class, e); | ||
| tile.setName("Grid Tile " + counter[0]++); | ||
| return tile; | ||
| }); | ||
| } | ||
| } | ||
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.