Search in sources :

Example 1 with RadioButtonGroupElement

use of com.vaadin.flow.component.radiobutton.testbench.RadioButtonGroupElement in project linkki by linkki-framework.

the class TC001AbstractLayoutTest method testRadioButton_HasLabel.

@Test
void testRadioButton_HasLabel() {
    RadioButtonGroupElement field = getTestCaseSection().$(RadioButtonGroupElement.class).id("enumValueRadioButton");
    WebElement label = field.findElement(By.xpath("./label"));
    assertThat(label.getText()).contains("RadioButtons");
}
Also used : WebElement(org.openqa.selenium.WebElement) RadioButtonGroupElement(com.vaadin.flow.component.radiobutton.testbench.RadioButtonGroupElement) Test(org.junit.jupiter.api.Test)

Example 2 with RadioButtonGroupElement

use of com.vaadin.flow.component.radiobutton.testbench.RadioButtonGroupElement in project linkki by linkki-framework.

the class TS001AbstractBasicElementsLayoutTest method testRadioButtons_IsSelectable.

@Order(50)
@Test
void testRadioButtons_IsSelectable() {
    RadioButtonGroupElement radioButtons = // 
    testCaseSection.getContentWrapper().$(RadioButtonGroupElement.class).id("enumValueRadioButton");
    // precondition
    assertThat(radioButtons.getSelectedText()).isNull();
    // action
    radioButtons.selectByText(SampleEnum.VALUE3.getName());
    // postcondition
    assertThat(radioButtons.getSelectedText()).isEqualTo(SampleEnum.VALUE3.getName());
}
Also used : RadioButtonGroupElement(com.vaadin.flow.component.radiobutton.testbench.RadioButtonGroupElement) Order(org.junit.jupiter.api.Order) PlaygroundUiTest(org.linkki.samples.playground.uitestnew.PlaygroundUiTest) Test(org.junit.jupiter.api.Test)

Example 3 with RadioButtonGroupElement

use of com.vaadin.flow.component.radiobutton.testbench.RadioButtonGroupElement in project linkki by linkki-framework.

the class TC010UIButtonTest method testShortcut_InMultiLineInput_WithCrtlEnter.

@Disabled("LIN-2621")
@Test
void testShortcut_InMultiLineInput_WithCrtlEnter() {
    TextAreaElement textArea = getTextArea();
    LinkkiTextElement counter = getCounter();
    RadioButtonGroupElement radioButtonGroup = $(RadioButtonGroupElement.class).id("testBehaviorWithTextArea");
    radioButtonGroup.selectByText(ButtonPmo.TestShortcutBehavior.BUTTON_WITH_CRTL_ENTER.toString());
    assertThat(counter.getText()).isEqualTo("Counter: 0");
    textArea.focus();
    sendKeys(null, "Crtl+Enter!");
    sendKeys(Keys.CONTROL, Keys.ENTER);
    assertThat(textArea.getValue()).describedAs("Crtl+Enter should not add new line").isEqualTo("Crtl+Enter!");
    assertThat(counter.getText()).isEqualTo("Counter: 1");
    assertThat($(DivElement.class).id("contentAsText").getText()).as("Value of the text area should have been sent to server").isEqualTo("Crtl+Enter!");
}
Also used : DivElement(com.vaadin.flow.component.html.testbench.DivElement) TextAreaElement(com.vaadin.flow.component.textfield.testbench.TextAreaElement) LinkkiTextElement(org.linkki.samples.playground.pageobjects.LinkkiTextElement) RadioButtonGroupElement(com.vaadin.flow.component.radiobutton.testbench.RadioButtonGroupElement) PlaygroundUiTest(org.linkki.samples.playground.uitestnew.PlaygroundUiTest) Test(org.junit.jupiter.api.Test) Disabled(org.junit.jupiter.api.Disabled)

Example 4 with RadioButtonGroupElement

use of com.vaadin.flow.component.radiobutton.testbench.RadioButtonGroupElement in project linkki by linkki-framework.

the class TC010UIButtonTest method testShortcutKey_InSingleLineInput_WithEnterIfNotEmpty.

@Test
void testShortcutKey_InSingleLineInput_WithEnterIfNotEmpty() {
    TextFieldElement textField = $(TextFieldElement.class).id("contentAsTextField");
    LinkkiTextElement counter = getCounter();
    RadioButtonGroupElement radioButtonGroup = $(RadioButtonGroupElement.class).id("testBehaviorWithTextArea");
    radioButtonGroup.selectByText(ButtonPmo.TestShortcutBehavior.BUTTON_DISABLED_IF_EMPTY.toString());
    assertThat(counter.getText()).isEqualTo("Counter: 0");
    assertThat($(LinkkiTextElement.class).id("contentAsText").getText()).isEmpty();
    assertThat($(ButtonElement.class).id("buttonWithEnterIfNotEmpty").isEnabled()).isFalse();
    textField.focus();
    sendKeys(null, "Enter!");
    sendKeys(null, Keys.ENTER);
    assertThat(counter.getText()).describedAs("Button shortcut should be triggered").isEqualTo("Counter: 1");
    assertThat($(LinkkiTextElement.class).id("contentAsText").getText()).as("New value of the input should have been sent to server").isEqualTo("Enter!");
}
Also used : TextFieldElement(com.vaadin.flow.component.textfield.testbench.TextFieldElement) LinkkiTextElement(org.linkki.samples.playground.pageobjects.LinkkiTextElement) RadioButtonGroupElement(com.vaadin.flow.component.radiobutton.testbench.RadioButtonGroupElement) PlaygroundUiTest(org.linkki.samples.playground.uitestnew.PlaygroundUiTest) Test(org.junit.jupiter.api.Test)

Aggregations

RadioButtonGroupElement (com.vaadin.flow.component.radiobutton.testbench.RadioButtonGroupElement)4 Test (org.junit.jupiter.api.Test)4 PlaygroundUiTest (org.linkki.samples.playground.uitestnew.PlaygroundUiTest)3 LinkkiTextElement (org.linkki.samples.playground.pageobjects.LinkkiTextElement)2 DivElement (com.vaadin.flow.component.html.testbench.DivElement)1 TextAreaElement (com.vaadin.flow.component.textfield.testbench.TextAreaElement)1 TextFieldElement (com.vaadin.flow.component.textfield.testbench.TextFieldElement)1 Disabled (org.junit.jupiter.api.Disabled)1 Order (org.junit.jupiter.api.Order)1 WebElement (org.openqa.selenium.WebElement)1