2 * Copyright 2000-2016 Vaadin Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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
16 package com.vaadin.tests.components.grid.basicfeatures.server;
18 import static org.junit.Assert.assertEquals;
19 import static org.junit.Assert.assertTrue;
21 import java.util.List;
23 import org.junit.Test;
24 import org.openqa.selenium.Keys;
25 import org.openqa.selenium.interactions.Actions;
26 import org.openqa.selenium.remote.DesiredCapabilities;
28 import com.vaadin.testbench.elements.GridElement.GridCellElement;
29 import com.vaadin.tests.components.grid.basicfeatures.GridBasicFeaturesTest;
31 public class GridMultiSortingTest extends GridBasicFeaturesTest {
34 public List<DesiredCapabilities> getBrowsersToTest() {
35 return super.getBrowsersSupportingShiftClick();
39 public void testUserMultiColumnSorting() {
42 selectMenuPath("Component", "Columns", "Column 11", "Column 11 Width",
45 GridCellElement cell = getGridElement().getHeaderCell(0, 11);
46 new Actions(driver).moveToElement(cell, 20, 10).click().perform();
47 new Actions(driver).keyDown(Keys.SHIFT).perform();
49 .moveToElement(getGridElement().getHeaderCell(0, 0), 20, 10)
51 new Actions(driver).keyUp(Keys.SHIFT).perform();
53 String prev = getGridElement().getCell(0, 11).getAttribute("innerHTML");
54 for (int i = 1; i <= 6; ++i) {
55 assertEquals("Column 11 should contain same values.", prev,
56 getGridElement().getCell(i, 11).getAttribute("innerHTML"));
59 prev = getGridElement().getCell(0, 0).getText();
60 for (int i = 1; i <= 6; ++i) {
61 assertTrue("Grid is not sorted by column 0.", prev
62 .compareTo(getGridElement().getCell(i, 0).getText()) < 0);