|
17 | 17 | package org.labkey.test.tests; |
18 | 18 |
|
19 | 19 | import org.apache.commons.lang3.tuple.Pair; |
| 20 | +import org.assertj.core.api.Assertions; |
20 | 21 | import org.junit.Test; |
21 | 22 | import org.junit.experimental.categories.Category; |
22 | 23 | import org.labkey.test.BaseWebDriverTest; |
23 | 24 | import org.labkey.test.Locator; |
24 | 25 | import org.labkey.test.categories.Daily; |
25 | 26 | import org.labkey.test.categories.Data; |
| 27 | +import org.labkey.test.components.ChartTypeDialog; |
26 | 28 | import org.labkey.test.params.FieldDefinition; |
27 | 29 | import org.labkey.test.params.FieldDefinition.ColumnType; |
28 | 30 | import org.labkey.test.util.DataRegionExportHelper; |
29 | 31 | import org.labkey.test.util.DataRegionTable; |
30 | 32 | import org.labkey.test.util.EscapeUtil; |
| 33 | +import org.labkey.test.util.selenium.WebDriverUtils; |
31 | 34 | import org.openqa.selenium.NoSuchElementException; |
32 | 35 | import org.openqa.selenium.WebElement; |
| 36 | +import org.openqa.selenium.interactions.Actions; |
33 | 37 |
|
34 | 38 | import java.net.MalformedURLException; |
35 | 39 | import java.net.URL; |
@@ -141,12 +145,34 @@ public void testSteps() throws Exception |
141 | 145 | clickAndWait(Locator.linkWithText(LIST_NAME)); |
142 | 146 | URL url = getURL(); |
143 | 147 | dataRegionTest(url, INJECT_CHARS_1); |
144 | | - dataRegionTest(url, INJECT_CHARS_2); |
| 148 | + DataRegionTable dataRegionTable = dataRegionTest(url, INJECT_CHARS_2); |
| 149 | + testOpenMenuItemInNewTab(dataRegionTable); |
145 | 150 | exportLoggingTest(); |
146 | 151 |
|
147 | 152 | testQWPDemoPage(); |
148 | 153 | } |
149 | 154 |
|
| 155 | + /** |
| 156 | + * Regression coverage for Issue 53629: NavMenu doesn't open in new tab correctly |
| 157 | + */ |
| 158 | + private void testOpenMenuItemInNewTab(DataRegionTable dataRegionTable) |
| 159 | + { |
| 160 | + WebElement createChartMenuItem = dataRegionTable |
| 161 | + .getReportMenu() |
| 162 | + .openMenuTo("Create Chart"); |
| 163 | + doAndWaitForNewWindow(() -> |
| 164 | + new Actions(getDriver()) |
| 165 | + .keyDown(WebDriverUtils.MODIFIER_KEY) |
| 166 | + .click(createChartMenuItem) |
| 167 | + .perform()); |
| 168 | + ChartTypeDialog chartTypeDialog = new ChartTypeDialog(getDriver()); |
| 169 | + Assertions.assertThat(chartTypeDialog.getColumnList()) |
| 170 | + .as("List should be pre-selected for chart") |
| 171 | + .containsExactlyInAnyOrder(LIST_KEY_NAME, NAME_COLUMN.getName(), HEX_COLUMN.getName()); |
| 172 | + getDriver().close(); |
| 173 | + switchToMainWindow(); |
| 174 | + } |
| 175 | + |
150 | 176 | @Override |
151 | 177 | protected List<Pair<String, String>> getTabSignalsPairs() |
152 | 178 | { |
@@ -188,7 +214,7 @@ private void createList() |
188 | 214 | _listHelper.uploadData(LIST_DATA); |
189 | 215 | } |
190 | 216 |
|
191 | | - private void dataRegionTest(URL url, String dataRegionName) throws MalformedURLException |
| 217 | + private DataRegionTable dataRegionTest(URL url, String dataRegionName) throws MalformedURLException |
192 | 218 | { |
193 | 219 | log("** Beginning test for dataRegionName: " + dataRegionName); |
194 | 220 |
|
@@ -281,6 +307,8 @@ private void dataRegionTest(URL url, String dataRegionName) throws MalformedURLE |
281 | 307 |
|
282 | 308 | table.rowSelector().showAll(); |
283 | 309 | assertEquals(15, table.getDataRowCount()); |
| 310 | + |
| 311 | + return table; |
284 | 312 | } |
285 | 313 |
|
286 | 314 | private void enableComplianceIfInstalled() |
|
0 commit comments