You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

AddSelectionToRemovedRangeTest.java 2.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /*
  2. * Copyright 2000-2014 Vaadin Ltd.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License"); you may not
  5. * use this file except in compliance with the License. You may obtain a copy of
  6. * the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  12. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  13. * License for the specific language governing permissions and limitations under
  14. * the License.
  15. */
  16. package com.vaadin.tests.components.table;
  17. import java.io.IOException;
  18. import java.util.List;
  19. import org.junit.Assert;
  20. import org.junit.Test;
  21. import org.openqa.selenium.Keys;
  22. import org.openqa.selenium.NoSuchElementException;
  23. import org.openqa.selenium.WebElement;
  24. import org.openqa.selenium.interactions.Actions;
  25. import org.openqa.selenium.remote.DesiredCapabilities;
  26. import com.vaadin.testbench.By;
  27. import com.vaadin.testbench.parallel.Browser;
  28. import com.vaadin.tests.tb3.MultiBrowserTest;
  29. public class AddSelectionToRemovedRangeTest extends MultiBrowserTest {
  30. @Override
  31. protected boolean requireWindowFocusForIE() {
  32. return true;
  33. }
  34. @Override
  35. public List<DesiredCapabilities> getBrowsersToTest() {
  36. return getBrowserCapabilities(Browser.CHROME);
  37. }
  38. @Test
  39. public void addAndRemoveItemToRemovedRange() throws IOException {
  40. openTestURL();
  41. List<WebElement> rows = driver.findElements(By
  42. .className("v-table-cell-wrapper"));
  43. WebElement rangeStart = rows.get(0);
  44. WebElement rangeEnd = rows.get(1);
  45. rangeStart.click();
  46. new Actions(driver).keyDown(Keys.SHIFT).perform();
  47. rangeEnd.click();
  48. new Actions(driver).keyUp(Keys.SHIFT).perform();
  49. driver.findElement(By.className("v-button")).click();
  50. WebElement extraRow = driver.findElements(
  51. By.className("v-table-cell-wrapper")).get(1);
  52. new Actions(driver).keyDown(Keys.CONTROL).click(extraRow)
  53. .click(extraRow).keyUp(Keys.CONTROL).perform();
  54. driver.findElement(By.className("v-button")).click();
  55. try {
  56. driver.findElement(By.vaadin("Root/VNotification[0]"));
  57. Assert.fail("Notification is shown");
  58. } catch (NoSuchElementException e) {
  59. // All is well.
  60. }
  61. }
  62. }