Source:
<code>private void testPanelsCollapseExpand() { ______TS("Test that 'Collapse Student' button is working"); resultsPage.clickGroupByTeam(); resultsPage.displayByGiverRecipientQuestion(); clickAjaxLoadedPanelAndWaitForExpansion("panelHeading-section-0-1", "ajax_auto"); resultsPage.waitForElementPresence(By.id("collapse-panels-button-team-0")); assertEquals("Collapse Students", resultsPage.instructorPanelCollapseStudentsButton.getText()); resultsPage.clickInstructorPanelCollapseStudentsButton(); resultsPage.waitForInstructorPanelStudentPanelsToCollapse(); assertEquals("Expand Students", resultsPage.instructorPanelCollapseStudentsButton.getText()); resultsPage.verifySpecifiedPanelIdsAreCollapsed(new String[] { "0-2", "0-3", "0-4" }); resultsPage.clickGroupByTeam(); resultsPage.displayByGiverRecipientQuestion(); <START> clickAjaxLoadedPanelAndWaitForExpansion("panelHeading-section-0-1", "ajax_auto"); <END> resultsPage.clickSectionCollapseStudentsButton(); resultsPage.waitForSectionStudentPanelsToCollapse(); resultsPage.displayByQuestion(); ______TS("Typical case: panels expand/collapse"); assertEquals("Expand Questions", resultsPage.collapseExpandButton.getText()); assertEquals("Expand all panels. You can also click on the panel heading to toggle each one individually.", resultsPage.collapseExpandButton.getAttribute("data-original-title")); resultsPage.verifyResultsHidden(); clickCollapseExpandButtonAndWaitForPanelsToRespond(true); assertEquals("Collapse Questions", resultsPage.collapseExpandButton.getText()); assertEquals("Collapse all panels. You can also click on the panel heading to toggle each one individually.", resultsPage.collapseExpandButton.getAttribute("data-original-title")); resultsPage.verifyResultsVisible(); clickCollapseExpandButtonAndWaitForPanelsToRespond(false); assertEquals("Expand Questions", resultsPage.collapseExpandButton.getText()); assertEquals("Expand all panels. You can also click on the panel heading to toggle each one individually.", resultsPage.collapseExpandButton.getAttribute("data-original-title")); resultsPage.verifyResultsHidden(); }</code><technical_language>this method "ajax_auto" "ajax_submit" 2nd parameter. avoid this repetition? a separate PR</technical_language>

Target:
private void testPanelsCollapseExpand() { ______TS("Test that 'Collapse Student' button is working"); resultsPage.clickGroupByTeam(); resultsPage.displayByGiverRecipientQuestion(); clickAjaxLoadedPanelAndWaitForExpansion("panelHeading-section-0-1", "ajax_auto"); resultsPage.waitForElementPresence(By.id("collapse-panels-button-team-0")); assertEquals("Collapse Students", resultsPage.instructorPanelCollapseStudentsButton.getText()); resultsPage.clickInstructorPanelCollapseStudentsButton(); resultsPage.waitForInstructorPanelStudentPanelsToCollapse(); assertEquals("Expand Students", resultsPage.instructorPanelCollapseStudentsButton.getText()); resultsPage.verifySpecifiedPanelIdsAreCollapsed(new String[] { "0-2", "0-3", "0-4" }); resultsPage.clickGroupByTeam(); resultsPage.displayByGiverRecipientQuestion(); clickAjaxLoadedPanelAndWaitForExpansion("panelHeading-section-0-1", "ajax_auto"); resultsPage.clickSectionCollapseStudentsButton(); resultsPage.waitForSectionStudentPanelsToCollapse(); resultsPage.displayByQuestion(); ______TS("Typical case: panels expand/collapse"); assertEquals("Expand Questions", resultsPage.collapseExpandButton.getText()); assertEquals("Expand all panels. You can also click on the panel heading to toggle each one individually.", resultsPage.collapseExpandButton.getAttribute("data-original-title")); resultsPage.verifyResultsHidden(); clickCollapseExpandButtonAndWaitForPanelsToExpand(); assertEquals("Collapse Questions", resultsPage.collapseExpandButton.getText()); assertEquals("Collapse all panels. You can also click on the panel heading to toggle each one individually.", resultsPage.collapseExpandButton.getAttribute("data-original-title")); resultsPage.verifyResultsVisible(); clickCollapseExpandButtonAndWaitForPanelsToCollapse(); assertEquals("Expand Questions", resultsPage.collapseExpandButton.getText()); assertEquals("Expand all panels. You can also click on the panel heading to toggle each one individually.", resultsPage.collapseExpandButton.getAttribute("data-original-title")); resultsPage.verifyResultsHidden(); }