com.codeborne.selenide.CollectionCondition Java Examples

The following examples show how to use com.codeborne.selenide.CollectionCondition. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: InputSelectTreeAT.java    From n2o-framework with Apache License 2.0 5 votes vote down vote up
@Test
public void readFromQueryTest() {
    builder.sources(new CompileInfo("net/n2oapp/framework/autotest/control/select_tree/nodes/index.page.xml"),
            new CompileInfo("net/n2oapp/framework/autotest/control/select_tree/nodes/test.query.xml"));
    SimplePage page = open(SimplePage.class);
    page.shouldExists();

    InputSelectTree inputSelectTree = page.single().widget(FormWidget.class).fields().field("InputSelectTree")
            .control(InputSelectTree.class);

    inputSelectTree.shouldBeUnselected();
    inputSelectTree.expandOptions();
    inputSelectTree.shouldDisplayedOptions(CollectionCondition.size(2));
    inputSelectTree.expandParentOptions(0);
    inputSelectTree.shouldDisplayedOptions(CollectionCondition.size(4));

    inputSelectTree.selectOption(0);
    inputSelectTree.selectOption(2);
    inputSelectTree.selectOption(1);

    inputSelectTree.shouldBeSelected(0, "one");
    inputSelectTree.shouldBeSelected(1, "message");
    inputSelectTree.shouldBeSelected(2, "long message");
    // проверяем, что длина названий ограничена 15 символами
    inputSelectTree.shouldBeSelected(3, "very long messa...");

    inputSelectTree.removeAllOptions();
    inputSelectTree.shouldBeUnselected();
}
 
Example #2
Source File: InputSelectTreeAT.java    From n2o-framework with Apache License 2.0 5 votes vote down vote up
@Test
public void inputSelectTreeTest() {
    builder.sources(new CompileInfo("net/n2oapp/framework/autotest/control/select_tree/simple/index.page.xml"));
    SimplePage page = open(SimplePage.class);
    page.shouldExists();

    InputSelectTree inputSelectTree = page.single().widget(FormWidget.class).fields().field("InputSelectTree")
            .control(InputSelectTree.class);
    inputSelectTree.shouldHavePlaceholder("SelectOption");
    inputSelectTree.shouldBeUnselected();
    inputSelectTree.expandOptions();
    inputSelectTree.shouldDisplayedOptions(CollectionCondition.size(4));
    inputSelectTree.setFilter("three");

    inputSelectTree.selectOption(0);
    inputSelectTree.selectOption(3);
    inputSelectTree.selectOption(1);

    inputSelectTree.expandOptions();

    inputSelectTree.shouldBeSelected(0, "one");
    inputSelectTree.shouldBeSelected(1, "two");
    // проверяем, что длина названий ограничена 10 символами (по умолчанию)
    inputSelectTree.shouldBeSelected(2, "long messa...");

    inputSelectTree.removeOption(1);

    inputSelectTree.shouldBeSelected(0, "one");
    inputSelectTree.shouldBeSelected(1, "long messa...");

    inputSelectTree.removeAllOptions();
    inputSelectTree.shouldBeUnselected();
}
 
Example #3
Source File: N2oTableWidget.java    From n2o-framework with Apache License 2.0 5 votes vote down vote up
@Override
public void columnShouldHaveTexts(int index, List<String> texts) {
    if (texts == null || texts.isEmpty())
        element().$$(".n2o-table-row td:nth-child(" + (++index) + ")").shouldHave(CollectionCondition.empty);
    else
        element().$$(".n2o-table-row td:nth-child(" + (++index) + ")").shouldHave(CollectionCondition.texts(texts));
}
 
Example #4
Source File: N2oSelect.java    From n2o-framework with Apache License 2.0 5 votes vote down vote up
@Override
public void selectMulti(int... indexes) {
    if (element().$(".n2o-popup-control.isExpanded").is(Condition.not(Condition.exist)))
        expandPopUpOptions();
    for (int index : indexes)
        selectPopUp().$$(".n2o-input").shouldBe(CollectionCondition.sizeGreaterThan(index)).get(index).click();
}
 
Example #5
Source File: N2oInputSelect.java    From n2o-framework with Apache License 2.0 5 votes vote down vote up
@Override
public void shouldSelectedMulti(String... values) {
    ElementsCollection selectedItems = element().$$(".n2o-input-select-selected-list .selected-item");
    selectedItems.shouldHaveSize(values.length);
    if (values.length != 0)
        selectedItems.shouldHave(CollectionCondition.textsInAnyOrder(values));
}
 
Example #6
Source File: N2oAutoComplete.java    From n2o-framework with Apache License 2.0 4 votes vote down vote up
@Override
public void shouldHaveDropdownOptions(String... values) {
    element().parent().$$(".n2o-dropdown-control .text-cropped").shouldHave(CollectionCondition.texts(values));
}
 
Example #7
Source File: Spectators.java    From akita with Apache License 2.0 4 votes vote down vote up
private static CollectionCondition conditionToConditionCollection(Condition selenideCondition) {
    if (selenideCondition.equals(Condition.visible)) {
        return CollectionCondition.sizeGreaterThan(0);
    }
    return null;
}
 
Example #8
Source File: N2oTableWidget.java    From n2o-framework with Apache License 2.0 4 votes vote down vote up
@Override
public void shouldNotHaveRows() {
    element().$$(".n2o-advanced-table-tbody .n2o-table-row").shouldBe(CollectionCondition.empty);
}
 
Example #9
Source File: N2oTabsRegion.java    From n2o-framework with Apache License 2.0 4 votes vote down vote up
@Override
public TabItem tab(int index) {
    return new N2oTabItem(element().$$(".nav-item").shouldBe(CollectionCondition.sizeGreaterThan(index)).get(index));
}
 
Example #10
Source File: N2oInputSelect.java    From n2o-framework with Apache License 2.0 4 votes vote down vote up
@Override
public void selectMulti(int... indexes) {
    expandPopUpOptions();
    IntStream.of(indexes).forEach(i -> popUpButtons().shouldBe(CollectionCondition.sizeGreaterThan(i)).get(i).click());
}
 
Example #11
Source File: N2oInputSelect.java    From n2o-framework with Apache License 2.0 4 votes vote down vote up
@Override
public void select(int index) {
    expandPopUpOptions();
    popUpButtons().shouldBe(CollectionCondition.sizeGreaterThan(index)).get(index).click();
}
 
Example #12
Source File: N2oInputSelect.java    From n2o-framework with Apache License 2.0 4 votes vote down vote up
@Override
public void shouldHaveOptions(String... options) {
    expandPopUpOptions();
    selectPopUp().$$("button .text-cropped,.custom-control-label").shouldHave(CollectionCondition.exactTexts(options));
}
 
Example #13
Source File: N2oInputSelectTree.java    From n2o-framework with Apache License 2.0 4 votes vote down vote up
@Override
public void shouldDisplayedOptions(CollectionCondition condition) {
    element().$$(".n2o-select-tree-dropdown .n2o-select-tree-tree-treenode-switcher-close").shouldHave(condition);
}
 
Example #14
Source File: N2oSelect.java    From n2o-framework with Apache License 2.0 4 votes vote down vote up
@Override
public void shouldNotBeCleanable() {
    element().$$(".n2o-input-clear").shouldHave(CollectionCondition.size(0));
}
 
Example #15
Source File: N2oSelect.java    From n2o-framework with Apache License 2.0 4 votes vote down vote up
@Override
public void shouldBeCleanable() {
    element().$$(".n2o-input-clear").shouldHave(CollectionCondition.sizeGreaterThan(0));
}
 
Example #16
Source File: N2oSelect.java    From n2o-framework with Apache License 2.0 4 votes vote down vote up
@Override
public void shouldNotBeChecked(int... indexes) {
    for (int index : indexes)
        selectPopUp().$$(".n2o-input").shouldBe(CollectionCondition.sizeGreaterThan(index))
                .get(index).shouldNotBe(Condition.checked);
}
 
Example #17
Source File: N2oSelect.java    From n2o-framework with Apache License 2.0 4 votes vote down vote up
@Override
public void shouldBeChecked(int... indexes) {
    for (int index : indexes)
        selectPopUp().$$(".n2o-input").shouldBe(CollectionCondition.sizeGreaterThan(index))
                .get(index).shouldBe(Condition.checked);
}
 
Example #18
Source File: N2oSelect.java    From n2o-framework with Apache License 2.0 4 votes vote down vote up
@Override
public void select(int index) {
    expandPopUpOptions();
    selectPopUp().$$("button").shouldBe(CollectionCondition.sizeGreaterThan(index)).get(index).click();
}
 
Example #19
Source File: N2oSelect.java    From n2o-framework with Apache License 2.0 4 votes vote down vote up
@Override
public void shouldHaveOptions(String... options) {
    expandPopUpOptions();
    selectPopUp().$$("button .text-cropped,.custom-control-label").shouldHave(CollectionCondition.exactTexts(options));
}
 
Example #20
Source File: N2oComponentsCollection.java    From n2o-framework with Apache License 2.0 4 votes vote down vote up
@Override
public void shouldBeEmpty() {
    elements().shouldBe(CollectionCondition.empty);
}
 
Example #21
Source File: N2oComponentsCollection.java    From n2o-framework with Apache License 2.0 4 votes vote down vote up
@Override
public void shouldHaveSize(int size) {
    elements().shouldHave(CollectionCondition.size(size));
}
 
Example #22
Source File: InputSelectTree.java    From n2o-framework with Apache License 2.0 votes vote down vote up
void shouldDisplayedOptions(CollectionCondition condition);