|
7 | 7 | import org.junit.experimental.categories.Category; |
8 | 8 | import org.labkey.remoteapi.Connection; |
9 | 9 | import org.labkey.test.BaseWebDriverTest; |
| 10 | +import org.labkey.test.Locator; |
10 | 11 | import org.labkey.test.WebTestHelper; |
11 | 12 | import org.labkey.test.categories.Daily; |
12 | 13 | import org.labkey.test.pages.admin.ShortUrlAdminPage; |
@@ -186,20 +187,36 @@ public void testShortUrlPermissions() |
186 | 187 | adminPage.submitShortUrl(shortUrl_a, targetUrl2); |
187 | 188 |
|
188 | 189 | // Issue #52485 "App admins can create and edit shorturls but can't view them" (but now they can!) |
189 | | - verifyShortUrlsInGrid(shortUrl_a, targetUrl2, shortUrl_b); |
| 190 | + verifyShortUrlsInGrid(Map.of(shortUrl_a, targetUrl2, shortUrl_b, targetUrl2)); |
| 191 | + |
| 192 | + // Edit an existing row, setting it back to the original target |
| 193 | + DataRegionTable table = new DataRegionTable("ShortURL", getDriver()); |
| 194 | + table.setFilter("ShortURL", "Equals", shortUrl_a); |
| 195 | + table.clickEditRow(0); |
| 196 | + setFormElement(Locator.name("fullURL"), targetUrl1); |
| 197 | + clickButton("Update"); |
| 198 | + |
| 199 | + // Issue #52485 "App admins can create and edit shorturls but can't view them" (but now they can!) |
| 200 | + verifyShortUrlsInGrid(Map.of(shortUrl_a, targetUrl1, shortUrl_b, targetUrl2)); |
| 201 | + |
| 202 | + // Delete an existing row |
| 203 | + table = new DataRegionTable("ShortURL", getDriver()); |
| 204 | + table.setFilter("ShortURL", "Equals", shortUrl_a); |
| 205 | + table.checkCheckbox(0); |
| 206 | + table.deleteSelectedRows(); |
| 207 | + assertTextNotPresent(targetUrl1); |
190 | 208 | }); |
191 | 209 |
|
192 | | - verifyShortUrlsInGrid(shortUrl_a, targetUrl2, shortUrl_b); |
| 210 | + // Double-verify the single entry to reuse the same validation method |
| 211 | + verifyShortUrlsInGrid(Map.of(shortUrl_b, targetUrl2)); |
193 | 212 | } |
194 | 213 |
|
195 | | - private void verifyShortUrlsInGrid(String shortUrl_a, String targetUrl2, String shortUrl_b) |
| 214 | + /** Map of short URL to target URLs to expect */ |
| 215 | + private void verifyShortUrlsInGrid(Map<String, String> urlMap) |
196 | 216 | { |
197 | 217 | Assertions.assertThat(ShortUrlAdminPage.beginAt(this).getUrlsFromGrid()) |
198 | 218 | .as("short URLs") |
199 | | - .containsAllEntriesOf(Map.of( |
200 | | - shortUrl_a, targetUrl2, |
201 | | - shortUrl_b, targetUrl2 |
202 | | - )); |
| 219 | + .containsAllEntriesOf(urlMap); |
203 | 220 | } |
204 | 221 |
|
205 | 222 | private String nextUrlKey() |
|
0 commit comments