|
17 | 17 | import org.openqa.selenium.WebElement; |
18 | 18 | import org.openqa.selenium.support.ui.ExpectedConditions; |
19 | 19 |
|
| 20 | +import java.net.URLDecoder; |
| 21 | +import java.nio.charset.StandardCharsets; |
20 | 22 | import java.util.Map; |
21 | | -import java.util.Objects; |
22 | 23 | import java.util.Optional; |
23 | 24 |
|
24 | 25 | import static org.labkey.test.components.ext4.Checkbox.Ext4Checkbox; |
@@ -89,12 +90,25 @@ public String saveReport(String name, boolean isSaveAs, int wait) |
89 | 90 | { |
90 | 91 | saveReportWithName(name, isSaveAs); |
91 | 92 | } |
92 | | - return Objects.requireNonNullElse(getReportId(), reportIdBeforeSave); |
| 93 | + String reportIdAfterSave = getReportId(); |
| 94 | + return reportIdAfterSave == null ? reportIdBeforeSave : reportIdAfterSave; |
93 | 95 | } |
94 | 96 |
|
95 | 97 | public String getReportId() |
96 | 98 | { |
97 | | - return getUrlParam("reportId", true); |
| 99 | + String paramName = "reportId"; |
| 100 | + |
| 101 | + Map<String, String> params = WebTestHelper.parseUrlQuery(getURL()); |
| 102 | + String paramValue = params.get(paramName); |
| 103 | + |
| 104 | + if (paramValue == null) |
| 105 | + { |
| 106 | + paramValue = params.entrySet().stream() |
| 107 | + .filter(entry -> entry.getKey().endsWith("." + paramName)) |
| 108 | + .map(Map.Entry::getValue).findFirst().orElse(null); |
| 109 | + } |
| 110 | + |
| 111 | + return paramValue == null ? null : URLDecoder.decode(paramValue, StandardCharsets.UTF_8); |
98 | 112 | } |
99 | 113 |
|
100 | 114 | /** |
|
0 commit comments