Browse Source

Add Delay to unstable tests (#11638)

* Add Delay to unstable tests

* Add sleep time
tags/8.9.0.alpha1
Zhe Sun 4 years ago
parent
commit
4c4d0375c1

+ 1
- 0
uitest/src/test/java/com/vaadin/tests/components/datefield/DateTimeFieldEventOrderTest.java View File

new Select(timeSelects.get(0)).selectByValue("09"); new Select(timeSelects.get(0)).selectByValue("09");


findElement(By.id("test-button")).click(); findElement(By.id("test-button")).click();
sleep(100);


assertEquals("The button click event should come second.", assertEquals("The button click event should come second.",
"2. Button Click Event", getLogRow(0)); "2. Button Click Event", getLogRow(0));

+ 9
- 4
uitest/src/test/java/com/vaadin/tests/components/datefield/DateTimeFieldWeekDaysTest.java View File

package com.vaadin.tests.components.datefield; package com.vaadin.tests.components.datefield;


import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

import org.junit.Test; import org.junit.Test;
import org.openqa.selenium.WebElement; import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.ExpectedConditions;
import com.vaadin.testbench.elements.DateTimeFieldElement; import com.vaadin.testbench.elements.DateTimeFieldElement;
import com.vaadin.tests.tb3.SingleBrowserTest; import com.vaadin.tests.tb3.SingleBrowserTest;


import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

public class DateTimeFieldWeekDaysTest extends SingleBrowserTest { public class DateTimeFieldWeekDaysTest extends SingleBrowserTest {


@Test @Test


openPopupAndValidateNoWeeknumbers(); openPopupAndValidateNoWeeknumbers();



$(ButtonElement.class).id("finnish").click(); $(ButtonElement.class).id("finnish").click();


openPopupAndValidateWeekNumbers(); openPopupAndValidateWeekNumbers();
.findElement(By.className("v-datefield-button")); .findElement(By.className("v-datefield-button"));
// Open date popup // Open date popup
popupButton.click(); popupButton.click();

sleep(100);
waitUntil(ExpectedConditions.visibilityOfElementLocated( waitUntil(ExpectedConditions.visibilityOfElementLocated(
org.openqa.selenium.By.className("v-datefield-popup"))); org.openqa.selenium.By.className("v-datefield-popup")));


.isEmpty()); .isEmpty());
// Close popup // Close popup
popupButton.click(); popupButton.click();
sleep(100);
} }


private void openPopupAndValidateNoWeeknumbers() { private void openPopupAndValidateNoWeeknumbers() {
.findElement(By.className("v-datefield-button")); .findElement(By.className("v-datefield-button"));
// Open date popup // Open date popup
popupButton.click(); popupButton.click();
sleep(100);


waitUntil(ExpectedConditions.visibilityOfElementLocated( waitUntil(ExpectedConditions.visibilityOfElementLocated(
org.openqa.selenium.By.className("v-datefield-popup"))); org.openqa.selenium.By.className("v-datefield-popup")));
.isEmpty()); .isEmpty());
// Close popup // Close popup
popupButton.click(); popupButton.click();
sleep(100);
} }
} }

+ 2
- 1
uitest/src/test/java/com/vaadin/tests/components/ui/TextAreaEventPropagationTest.java View File

builder2.click(textField); builder2.click(textField);


builder2.sendKeys("third line"); builder2.sendKeys("third line");
sleep(100);
builder2.sendKeys(Keys.ENTER); builder2.sendKeys(Keys.ENTER);
sleep(100);
builder2.sendKeys(Keys.ESCAPE); builder2.sendKeys(Keys.ESCAPE);

builder2.perform(); builder2.perform();


assertEquals("1. Enter button pressed", getLogRow(1)); assertEquals("1. Enter button pressed", getLogRow(1));

Loading…
Cancel
Save