Skip to content

Commit 7a70b6e

Browse files
Issue 52485: App admins can't edit shorturls
1 parent a56522e commit 7a70b6e

File tree

1 file changed

+24
-7
lines changed

1 file changed

+24
-7
lines changed

src/org/labkey/test/tests/core/admin/ShortUrlTest.java

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import org.junit.experimental.categories.Category;
88
import org.labkey.remoteapi.Connection;
99
import org.labkey.test.BaseWebDriverTest;
10+
import org.labkey.test.Locator;
1011
import org.labkey.test.WebTestHelper;
1112
import org.labkey.test.categories.Daily;
1213
import org.labkey.test.pages.admin.ShortUrlAdminPage;
@@ -186,20 +187,36 @@ public void testShortUrlPermissions()
186187
adminPage.submitShortUrl(shortUrl_a, targetUrl2);
187188

188189
// 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);
190208
});
191209

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));
193212
}
194213

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)
196216
{
197217
Assertions.assertThat(ShortUrlAdminPage.beginAt(this).getUrlsFromGrid())
198218
.as("short URLs")
199-
.containsAllEntriesOf(Map.of(
200-
shortUrl_a, targetUrl2,
201-
shortUrl_b, targetUrl2
202-
));
219+
.containsAllEntriesOf(urlMap);
203220
}
204221

205222
private String nextUrlKey()

0 commit comments

Comments
 (0)