-
Notifications
You must be signed in to change notification settings - Fork 568
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…initialized-elements #617 fix: Changed PageFactory to SelenidePageFactory in ElementsContainer's fields initialization
- Loading branch information
Showing
2 changed files
with
43 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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
41 changes: 41 additions & 0 deletions
41
src/test/java/integration/ElementsContainerWithManuallyInitializedFieldsTest.java
This file contains 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,41 @@ | ||
package integration; | ||
|
||
import com.codeborne.selenide.ElementsCollection; | ||
import com.codeborne.selenide.ElementsContainer; | ||
import com.codeborne.selenide.SelenideElement; | ||
import org.junit.Before; | ||
import org.junit.Test; | ||
import org.openqa.selenium.support.FindBy; | ||
|
||
import static com.codeborne.selenide.CollectionCondition.texts; | ||
import static com.codeborne.selenide.Condition.*; | ||
import static com.codeborne.selenide.Selenide.*; | ||
|
||
public class ElementsContainerWithManuallyInitializedFieldsTest extends IntegrationTest { | ||
|
||
@Before | ||
public void openTestPage() { | ||
openFile("page_with_selects_without_jquery.html"); | ||
} | ||
|
||
@Test | ||
public void canInitializeElementsContainerFieldsWithoutFindByAnnotation() { | ||
MyPage page = page(MyPage.class); | ||
|
||
page.container.getSelf().should(exist, visible); | ||
page.container.headerLink.shouldHave(text("Options with 'apostrophes' and \"quotes\"")); | ||
page.container.options.shouldHave(texts("-- Select your hero --", "John Mc'Lain", "Arnold \"Schwarzenegger\"", | ||
"Mickey \"Rock'n'Roll\" Rourke")); | ||
} | ||
|
||
|
||
private static class MyPage { | ||
@FindBy (css = "#apostrophes-and-quotes") | ||
MyContainer container; | ||
} | ||
|
||
private static class MyContainer extends ElementsContainer { | ||
SelenideElement headerLink = $("h2>a"); | ||
ElementsCollection options = $$("#hero>option"); | ||
} | ||
} |