Skip to content

Commit dbc978d

Browse files
committed
coverage for Issue 52171
1 parent 8a3fd54 commit dbc978d

1 file changed

Lines changed: 59 additions & 2 deletions

File tree

src/org/labkey/test/tests/MenuBarTest.java

Lines changed: 59 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
*/
1616
package org.labkey.test.tests;
1717

18+
import org.assertj.core.api.Assertions;
19+
import org.junit.BeforeClass;
1820
import org.junit.Test;
1921
import org.junit.experimental.categories.Category;
2022
import org.labkey.test.BaseWebDriverTest;
@@ -44,6 +46,19 @@ public class MenuBarTest extends BaseWebDriverTest
4446
private static final String DEM_STUDY_FOLDER = "DemStudyFolder";
4547
private static final String STUDY_FOLDER = "StudyFolder";
4648

49+
@BeforeClass
50+
public static void setupProject() throws Exception
51+
{
52+
MenuBarTest initTest = getCurrentTest();
53+
initTest.doSetup();
54+
}
55+
56+
protected void doSetup()
57+
{
58+
log("Open new project");
59+
_containerHelper.createProject(PROJECT_NAME, "Collaboration");
60+
}
61+
4762
@Override
4863
public List<String> getAssociatedModules()
4964
{
@@ -67,8 +82,7 @@ public void testSteps()
6782
PortalHelper portalHelper = new PortalHelper(this);
6883
WikiHelper wikiHelper = new WikiHelper(this);
6984

70-
log("Open new project");
71-
_containerHelper.createProject(PROJECT_NAME, "Collaboration");
85+
goToProjectHome();
7286
goToProjectSettings();
7387
clickAndWait(Locator.linkWithText("Menu Bar"));
7488

@@ -211,6 +225,49 @@ public void testSteps()
211225
openMenu("Folders");
212226
}
213227

228+
// Issue 52171: All menus that link to absolute URLs are broken
229+
@Test
230+
public void testDocumentationMenuLinks()
231+
{
232+
goToProjectHome();
233+
clickUserMenuItem(false,"LabKey Documentation"); // expect documentation to pop in another window
234+
switchToWindow(1);
235+
checker().withScreenshot("unexpected_destination")
236+
.wrapAssertion(()-> Assertions.assertThat(getURL().toString())
237+
.as("expect navigation to labkey.org /documentation")
238+
.contains("labkey.org/Documentation"));
239+
switchToMainWindow();
240+
closeExtraWindows();
241+
242+
goToProjectHome();
243+
clickUserMenuItem(true,"Support");
244+
checker().withScreenshot("unexpected_destination")
245+
.wrapAssertion(()-> Assertions.assertThat(getURL().toString())
246+
.as("expect navigation to localhost/home/support")
247+
.contains("localhost", "/home/support"));
248+
249+
goToProjectHome();
250+
clickAdminMenuItem("Developer Links", "JavaScript API Reference");
251+
checker().withScreenshot("unexpected_destination")
252+
.wrapAssertion(()-> Assertions.assertThat(getURL().toString())
253+
.as("expect navigation to labkey.org /download/clientapi_docs")
254+
.endsWith("labkey.org/download/clientapi_docs/javascript-api/"));
255+
256+
goToProjectHome();
257+
clickAdminMenuItem("Developer Links", "SQL Reference");
258+
checker().withScreenshot("unexpected_destination")
259+
.wrapAssertion(()-> Assertions.assertThat(getURL().toString())
260+
.as("expect navigation to labkey.org /documentation")
261+
.contains("labkey.org/Documentation"));
262+
263+
goToProjectHome();
264+
clickAdminMenuItem("Developer Links", "XML Schema Reference");
265+
checker().withScreenshot("unexpected_destination")
266+
.wrapAssertion(()-> Assertions.assertThat(getURL().toString())
267+
.as("expect navigation to labkey.org schema docs")
268+
.endsWith("labkey.org/download/schema-docs/xml-schemas/"));
269+
}
270+
214271
protected WebElement openMenu(String menuText)
215272
{
216273
WebElement menu = menuBarItem(menuText).findElement(getDriver());

0 commit comments

Comments
 (0)