Skip to content

Commit f98c98c

Browse files
committed
Wait for participant report "Save" button to be enabled
1 parent a56522e commit f98c98c

1 file changed

Lines changed: 14 additions & 8 deletions

File tree

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

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import org.labkey.test.categories.Reports;
2323
import org.labkey.test.components.ext4.Window;
2424
import org.labkey.test.components.html.BootstrapMenu;
25+
import org.labkey.test.util.Ext4Helper;
2526
import org.labkey.test.util.LogMethod;
2627
import org.openqa.selenium.By;
2728
import org.openqa.selenium.WebElement;
@@ -262,25 +263,30 @@ private void doParticipantReportTest()
262263
waitForElementToDisappear(Locator.xpath("id('participant-report-panel-1-body')/div[contains(@style, 'display: none')]"), WAIT_FOR_JAVASCRIPT);
263264
click(Locator.xpath("//img[@data-qtip = 'Delete']")); // Delete 'Severity Grade' column.
264265
clickButton("Save As", 0);
265-
_extHelper.waitForExtDialog("Save As");
266+
Window<?> saveAsDialog = new Window.WindowFinder(getDriver()).withTitle("Save As").waitFor();
266267
_extHelper.setExtFormElementByLabel("Save As", "Report Name", PARTICIPANT_REPORT2_NAME);
267268
_extHelper.setExtFormElementByLabel("Save As", "Report Description", PARTICIPANT_REPORT2_DESCRIPTION);
268-
clickButtonByIndex("Save", 1, 0);
269+
Ext4Helper.Locators.ext4Button("Save").withoutAttributeContaining("class", "disabled")
270+
.waitForElement(saveAsDialog, 2_000).click();
271+
saveAsDialog.waitForClose();
269272
_ext4Helper.waitForComponentNotDirty("participant-report-panel-1");
270273
waitForTextToDisappear("Severity Grade");
271274

272275
// Verify saving with existing report name.
273276
click(Locator.xpath("//a[./span[@title = 'Edit']]"));
274277
waitForElementToDisappear(Locator.xpath("id('participant-report-panel-1-body')/div[contains(@style, 'display: none')]"), WAIT_FOR_JAVASCRIPT);
275278
clickButton("Save As", 0);
276-
_extHelper.waitForExtDialog("Save As");
279+
saveAsDialog = new Window.WindowFinder(getDriver()).withTitle("Save As").waitFor();
277280
_extHelper.setExtFormElementByLabel("Save As", "Report Name", PARTICIPANT_REPORT_NAME);
278281
_extHelper.setExtFormElementByLabel("Save As", "Report Description", PARTICIPANT_REPORT2_DESCRIPTION);
279-
clickButtonByIndex("Save", 1, 0);
280-
_extHelper.waitForExtDialog("Failure");
282+
Ext4Helper.Locators.ext4Button("Save").withoutAttributeContaining("class", "disabled")
283+
.waitForElement(saveAsDialog, 2_000).click();
284+
Window<?> failureDialog = new Window.WindowFinder(getDriver()).withTitle("Failure").waitFor();
281285
assertTextPresent("Another report with the same name already exists.");
282286
clickButton("OK", 0);
287+
failureDialog.waitForClose();
283288
clickButton("Cancel", 0); // Verify cancel button.
289+
saveAsDialog.waitForClose();
284290
waitForElement(Locator.xpath("id('participant-report-panel-1-body')/div[contains(@style, 'display: none')]"), WAIT_FOR_JAVASCRIPT); // Edit panel should be hidden
285291

286292

@@ -350,12 +356,12 @@ private void doParticipantReportTest()
350356
{
351357
assertTextPresent(ptid);
352358

353-
String base = "//td//a[text()='" + ptid + "']/../../..//td[contains(text(), 'Groups:')]/following-sibling::td[contains(normalize-space(), '";
354-
waitForElement(Locator.xpath(base + PARTICIPANT_GROUP_ONE + "')]"));
359+
Locator.XPathLocator base = Locator.xpath("//td//a[text()='" + ptid + "']/../../..//td[contains(text(), 'Groups:')]/following-sibling::td");
360+
waitForElement(base.containing(PARTICIPANT_GROUP_ONE));
355361

356362
if (ptid_list2.contains(ptid))
357363
{
358-
assertElementPresent(Locator.xpath(base + PARTICIPANT_GROUP_TWO + "')]"));
364+
assertElementPresent(base.containing(PARTICIPANT_GROUP_TWO));
359365
}
360366

361367
}

0 commit comments

Comments
 (0)