Skip to content

Commit

Permalink
update tests after refactoring Selenide Users page
Browse files Browse the repository at this point in the history
  • Loading branch information
asolntsev committed Dec 14, 2024
1 parent 847f1fb commit 3983e93
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
10 changes: 8 additions & 2 deletions src/test/java/org/selenide/bs/AnnotatedPageObjectTest.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package org.selenide.bs;

import com.codeborne.selenide.ElementsCollection;
import com.codeborne.selenide.SelenideElement;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.openqa.selenium.support.FindBy;

import static com.codeborne.selenide.CollectionCondition.sizeGreaterThan;
import static com.codeborne.selenide.CollectionCondition.sizeLessThan;
import static com.codeborne.selenide.CollectionCondition.*;
import static com.codeborne.selenide.Selenide.open;
import static com.codeborne.selenide.Selenide.page;

Expand All @@ -19,6 +19,9 @@ void setUp() {
@Test
void showsAllKnownSelenideUsers() {
SelenideUsersPage page = page();
page.users.shouldHave(size(1));

page.showAll.click();
page.users.shouldHave(sizeGreaterThan(40));
}

Expand All @@ -33,6 +36,9 @@ private static class SelenideUsersPage {
@FindBy(css = "#selenide-users .user:not(.hidden)")
ElementsCollection users;

@FindBy(css = "#user-tags .reset-filter")
SelenideElement showAll;

@FindBy(css = "#user-tags .tag")
ElementsCollection userTags;

Expand Down
6 changes: 4 additions & 2 deletions src/test/java/org/selenide/bs/SimplePageObjectTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import static com.codeborne.selenide.CollectionCondition.sizeGreaterThan;
import static com.codeborne.selenide.CollectionCondition.sizeLessThan;
import static com.codeborne.selenide.CollectionCondition.*;
import static com.codeborne.selenide.Selectors.byText;
import static com.codeborne.selenide.Selenide.*;

Expand All @@ -18,6 +17,9 @@ void setUp() {
@Test
void showsAllKnownSelenideUsers() {
SelenideUsersPage page = new SelenideUsersPage();
page.users().shouldHave(size(1));

page.filterByTag("all");
page.users().shouldHave(sizeGreaterThan(40));
}

Expand Down
6 changes: 4 additions & 2 deletions src/test/java/org/selenide/bs/SimpleTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

import org.junit.jupiter.api.Test;

import static com.codeborne.selenide.CollectionCondition.sizeGreaterThan;
import static com.codeborne.selenide.CollectionCondition.sizeLessThan;
import static com.codeborne.selenide.CollectionCondition.*;
import static com.codeborne.selenide.Selectors.byTagAndText;
import static com.codeborne.selenide.Selectors.byText;
import static com.codeborne.selenide.Selenide.*;
Expand All @@ -15,6 +14,9 @@ void search() {
$(".main-menu-pages").find(byText("Users")).click();

$$("#user-tags .tag").shouldHave(sizeGreaterThan(8));
$$("#selenide-users .user:not(.hidden)").shouldHave(size(1));

$("#user-tags").find(byTagAndText("a", "all")).click();
$$("#selenide-users .user:not(.hidden)").shouldHave(sizeGreaterThan(80));

$("#user-tags").find(byTagAndText("a", "ukraine")).click();
Expand Down

0 comments on commit 3983e93

Please sign in to comment.