Browse Source

Fix unstable tests (#11648)

* Fix unstable tests
tags/8.9.0.beta1
Zhe Sun 4 years ago
parent
commit
d3f784f373
No account linked to committer's email address

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

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


import static org.junit.Assert.assertEquals;

import org.junit.Test; import org.junit.Test;
import org.openqa.selenium.By;


import com.vaadin.testbench.elements.DateFieldElement; import com.vaadin.testbench.elements.DateFieldElement;
import com.vaadin.testbench.elements.TextFieldElement; import com.vaadin.testbench.elements.TextFieldElement;
import com.vaadin.tests.tb3.MultiBrowserTest; import com.vaadin.tests.tb3.MultiBrowserTest;


import static org.junit.Assert.assertEquals;

public class DateFieldFocusTest extends MultiBrowserTest { public class DateFieldFocusTest extends MultiBrowserTest {


@Test @Test
TextFieldElement textField = $(TextFieldElement.class).caption("second") TextFieldElement textField = $(TextFieldElement.class).caption("second")
.first(); .first();


dateField.openPopup();
dateField.openPopup();

dateField.openPopup();
dateField.openPopup();
// open DateField popup
dateField.findElement(By.className("v-datefield-button")).click();
sleep(100);
// close DateField popup
dateField.findElement(By.className("v-datefield-button")).click();
sleep(100);


assertEquals("1. focused", getLogRow(0)); assertEquals("1. focused", getLogRow(0));

textField.focus(); textField.focus();

waitUntil(input -> "2. blurred".equals(getLogRow(0))); waitUntil(input -> "2. blurred".equals(getLogRow(0)));
} }
} }

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



DateTimeFieldElement field = $(DateTimeFieldElement.class).first(); DateTimeFieldElement field = $(DateTimeFieldElement.class).first();


field.openPopup();
field.findElement(By.className("v-datefield-button")).click();


List<WebElement> timeSelects = findElement( List<WebElement> timeSelects = findElement(
By.className("v-datefield-calendarpanel-time")) By.className("v-datefield-calendarpanel-time"))

+ 4
- 3
uitest/src/test/java/com/vaadin/tests/components/grid/GridEditorMultiselectTest.java View File

package com.vaadin.tests.components.grid; package com.vaadin.tests.components.grid;


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

import java.util.List; import java.util.List;


import org.junit.Test; import org.junit.Test;
import com.vaadin.testbench.parallel.TestCategory; import com.vaadin.testbench.parallel.TestCategory;
import com.vaadin.tests.tb3.MultiBrowserTest; import com.vaadin.tests.tb3.MultiBrowserTest;


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

@TestCategory("grid") @TestCategory("grid")
public class GridEditorMultiselectTest extends MultiBrowserTest { public class GridEditorMultiselectTest extends MultiBrowserTest {


openTestURL(); openTestURL();
GridElement grid = openEditor(); GridElement grid = openEditor();
grid.getEditor().cancel(); grid.getEditor().cancel();
sleep(100);
assertCheckboxesEnabled(grid, true); assertCheckboxesEnabled(grid, true);
} }



+ 5
- 4
uitest/src/test/java/com/vaadin/tests/elements/menubar/MenuBarUITest.java View File

package com.vaadin.tests.elements.menubar; package com.vaadin.tests.elements.menubar;


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

import java.util.List; import java.util.List;


import org.junit.Before; import org.junit.Before;
import com.vaadin.testbench.elements.MenuBarElement; import com.vaadin.testbench.elements.MenuBarElement;
import com.vaadin.tests.tb3.MultiBrowserTest; import com.vaadin.tests.tb3.MultiBrowserTest;


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

public class MenuBarUITest extends MultiBrowserTest { public class MenuBarUITest extends MultiBrowserTest {


@Override @Override
// The Edit menu will be opened by moving the mouse over the item (done // The Edit menu will be opened by moving the mouse over the item (done
// by clickItem). The first click then actually closes the menu. // by clickItem). The first click then actually closes the menu.
menuBar.clickItem("Edit"); menuBar.clickItem("Edit");
sleep(100);
menuBar.clickItem("Edit"); menuBar.clickItem("Edit");
assertFalse(isItemVisible("Save As..")); assertFalse(isItemVisible("Save As.."));
assertTrue(isItemVisible("Paste")); assertTrue(isItemVisible("Paste"));

+ 3
- 2
uitest/src/test/java/com/vaadin/tests/elements/notification/NotificationCloseTest.java View File

package com.vaadin.tests.elements.notification; package com.vaadin.tests.elements.notification;


import static org.junit.Assert.assertTrue;

import java.util.List; import java.util.List;


import org.junit.Test; import org.junit.Test;
import com.vaadin.testbench.elements.NotificationElement; import com.vaadin.testbench.elements.NotificationElement;
import com.vaadin.tests.tb3.MultiBrowserTest; import com.vaadin.tests.tb3.MultiBrowserTest;


import static org.junit.Assert.assertTrue;

public class NotificationCloseTest extends MultiBrowserTest { public class NotificationCloseTest extends MultiBrowserTest {


@Override @Override
ButtonElement btn = $(ButtonElement.class).id(id); ButtonElement btn = $(ButtonElement.class).id(id);
// show notification // show notification
btn.click(); btn.click();
sleep(100);
$(NotificationElement.class).get(0).close(); $(NotificationElement.class).get(0).close();
List<NotificationElement> notifications = $(NotificationElement.class) List<NotificationElement> notifications = $(NotificationElement.class)
.all(); .all();

Loading…
Cancel
Save