Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

WindowShadowTest.java 2.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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.window;
  17. import java.awt.AWTException;
  18. import java.io.IOException;
  19. import java.util.List;
  20. import org.junit.Test;
  21. import org.openqa.selenium.By;
  22. import org.openqa.selenium.Point;
  23. import org.openqa.selenium.WebElement;
  24. import org.openqa.selenium.interactions.HasInputDevices;
  25. import org.openqa.selenium.interactions.Mouse;
  26. import org.openqa.selenium.interactions.internal.Coordinates;
  27. import org.openqa.selenium.internal.Locatable;
  28. import org.openqa.selenium.remote.DesiredCapabilities;
  29. import com.vaadin.tests.tb3.MultiBrowserTest;
  30. public class WindowShadowTest extends MultiBrowserTest {
  31. @Test
  32. public void dragBackgroundWindow() throws AWTException, IOException,
  33. InterruptedException {
  34. openTestURL();
  35. WebElement wnd = getDriver().findElement(By.id("topwindow"));
  36. // There is some bug in Selenium. Can't move window using header
  37. // need use footer instead.
  38. WebElement wnd1Footer = wnd
  39. .findElement(By.className("v-window-footer"));
  40. Point startLoc = wnd.getLocation();
  41. Coordinates footerCoordinates = ((Locatable) wnd1Footer)
  42. .getCoordinates();
  43. Mouse mouse = ((HasInputDevices) getDriver()).getMouse();
  44. mouse.mouseDown(footerCoordinates);
  45. mouse.mouseMove(footerCoordinates, 200, 200);
  46. mouse.mouseUp(footerCoordinates);
  47. Point endLoc = wnd.getLocation();
  48. // don't compare to specific coordinate, because in IE9 and IE11
  49. // the window position is random.
  50. // So, checkt that the window was moved
  51. org.junit.Assert.assertNotEquals(startLoc, endLoc);
  52. }
  53. // IE8 doesn't support shadow-box css rule
  54. // ignore this browser in testing
  55. @Override
  56. public List<DesiredCapabilities> getBrowsersToTest() {
  57. return getBrowsersExcludingIE8();
  58. }
  59. }