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.

HorizontalScrollAfterResizeTest.java 2.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*
  2. * Copyright 2000-2016 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.grid;
  17. import org.junit.Assert;
  18. import org.junit.Test;
  19. import org.openqa.selenium.Dimension;
  20. import org.openqa.selenium.Point;
  21. import com.vaadin.testbench.elements.GridElement;
  22. import com.vaadin.v7.tests.components.grid.basicfeatures.GridBasicFeaturesTest;
  23. /**
  24. * @author Vaadin Ltd
  25. *
  26. */
  27. public class HorizontalScrollAfterResizeTest extends GridBasicFeaturesTest {
  28. /**
  29. * The behavior without the fix differs across different browsers but
  30. * scenario should work everywhere.
  31. */
  32. @Test
  33. public void scrollAfterResize() {
  34. getDriver().manage().window().setSize(new Dimension(600, 400));
  35. openTestURL();
  36. getDriver().manage().window().setSize(new Dimension(200, 400));
  37. // First scroll to the right
  38. scrollGridHorizontallyTo(600);
  39. Point locationAfterFirstScroll = $(GridElement.class).first()
  40. .getCell(0, 9).getLocation();
  41. // resize back
  42. getDriver().manage().window().setSize(new Dimension(600, 400));
  43. // shrink again
  44. getDriver().manage().window().setSize(new Dimension(200, 400));
  45. // second scroll to the right
  46. scrollGridHorizontallyTo(600);
  47. Point lolocationAfterSecondScrollcation = $(GridElement.class).first()
  48. .getCell(0, 9).getLocation();
  49. // With the bug scrolling doesn't happen. Location should be the same as
  50. // first time
  51. Assert.assertEquals(locationAfterFirstScroll,
  52. lolocationAfterSecondScrollcation);
  53. }
  54. @Override
  55. protected Class<?> getUIClass() {
  56. return HorizontalScrollAfterResize.class;
  57. }
  58. }