Search in sources :

Example 1 with LinkkiTextElement

use of org.linkki.samples.playground.pageobjects.LinkkiTextElement in project linkki by linkki-framework.

the class TC001UILabelTest method testLabel_NotHtmlContent.

@Test
void testLabel_NotHtmlContent() {
    LinkkiTextElement label = $(LinkkiTextElement.class).id("notHtmlContentLabel");
    assertThat(label.getText()).isEqualTo("<b>NOT</b> HTML Content");
    assertThat(label.findElements(By.tagName("b"))).isEmpty();
    assertThat(label.getHTMLContent()).isEqualTo("&lt;b&gt;NOT&lt;/b&gt; HTML Content");
}
Also used : LinkkiTextElement(org.linkki.samples.playground.pageobjects.LinkkiTextElement) Test(org.junit.jupiter.api.Test) PlaygroundUiTest(org.linkki.samples.playground.uitestnew.PlaygroundUiTest)

Example 2 with LinkkiTextElement

use of org.linkki.samples.playground.pageobjects.LinkkiTextElement in project linkki by linkki-framework.

the class TC001UILabelTest method testLabel_WithCustomStyle.

@Test
void testLabel_WithCustomStyle() {
    LinkkiTextElement label = $(LinkkiTextElement.class).id("styledLabel");
    assertThat(label.getCssValue("color")).isEqualTo("rgba(0, 128, 0, 1)");
}
Also used : LinkkiTextElement(org.linkki.samples.playground.pageobjects.LinkkiTextElement) Test(org.junit.jupiter.api.Test) PlaygroundUiTest(org.linkki.samples.playground.uitestnew.PlaygroundUiTest)

Example 3 with LinkkiTextElement

use of org.linkki.samples.playground.pageobjects.LinkkiTextElement in project linkki by linkki-framework.

the class TC010UIButtonTest method testShortcutKey_InSingleLineInput_WithEnter.

@Test
void testShortcutKey_InSingleLineInput_WithEnter() {
    TextFieldElement textField = $(TextFieldElement.class).id("contentAsTextField");
    LinkkiTextElement counter = getCounter();
    assertThat(counter.getText()).isEqualTo("Counter: 0");
    assertThat($(LinkkiTextElement.class).id("contentAsText").getText()).isEmpty();
    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) PlaygroundUiTest(org.linkki.samples.playground.uitestnew.PlaygroundUiTest) Test(org.junit.jupiter.api.Test)

Example 4 with LinkkiTextElement

use of org.linkki.samples.playground.pageobjects.LinkkiTextElement in project linkki by linkki-framework.

the class TC010UIButtonTest method testOnClick.

@Test
void testOnClick() {
    LinkkiTextElement counter = getCounter();
    ButtonElement increaseCounterButton = $(ButtonElement.class).id("increaseCounter");
    assertThat(counter.getText()).isEqualTo("Counter: 0");
    IntStream.range(0, 10).forEach(i -> increaseCounterButton.click());
    assertThat(counter.getText()).isEqualTo("Counter: 10");
}
Also used : ButtonElement(com.vaadin.flow.component.button.testbench.ButtonElement) LinkkiTextElement(org.linkki.samples.playground.pageobjects.LinkkiTextElement) PlaygroundUiTest(org.linkki.samples.playground.uitestnew.PlaygroundUiTest) Test(org.junit.jupiter.api.Test)

Example 5 with LinkkiTextElement

use of org.linkki.samples.playground.pageobjects.LinkkiTextElement in project linkki by linkki-framework.

the class TC010UIButtonTest method testShortcutKey_FocusOnShortcutButton.

@Disabled("LIN-2620")
@Test
void testShortcutKey_FocusOnShortcutButton() {
    LinkkiTextElement counter = getCounter();
    assertThat(counter.getText()).isEqualTo("Counter: 0");
    ButtonElement increaseCounterButton = $(ButtonElement.class).id("buttonWithEnter");
    increaseCounterButton.focus();
    sendKeys(null, Keys.ENTER);
    assertThat(counter.getText()).as("Button should not be triggered twice if the shortcut is triggered while focusing the button").isEqualTo("Counter: 1");
}
Also used : ButtonElement(com.vaadin.flow.component.button.testbench.ButtonElement) LinkkiTextElement(org.linkki.samples.playground.pageobjects.LinkkiTextElement) PlaygroundUiTest(org.linkki.samples.playground.uitestnew.PlaygroundUiTest) Test(org.junit.jupiter.api.Test) Disabled(org.junit.jupiter.api.Disabled)

Aggregations

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