Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions src/org/labkey/test/pages/query/SourceQueryPage.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
package org.labkey.test.pages.query;

import org.labkey.test.Locator;
import org.labkey.test.Locators;
import org.labkey.test.WebDriverWrapper;
import org.labkey.test.WebTestHelper;
import org.labkey.test.pages.LabKeyPage;
import org.labkey.test.util.DataRegion;
import org.labkey.test.util.DataRegionTable;
import org.labkey.test.util.Ext4Helper;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.WebDriverWait;

import java.time.Duration;
Expand Down Expand Up @@ -88,7 +90,7 @@ public String getMetadataXml()

public SourceQueryPage clickSave()
{
Ext4Helper.Locators.ext4Button("Save").findElement(getDriver()).click();
elementCache().saveButton.click();
waitForElement(Locator.id("status").withText("Saved"), WAIT_FOR_JAVASCRIPT);
waitForElementToDisappear(Locator.id("status").withText("Saved"), WAIT_FOR_JAVASCRIPT);

Expand All @@ -97,16 +99,24 @@ public SourceQueryPage clickSave()

public ExecuteQueryPage clickSaveAndFinish()
{
clickAndWait(Ext4Helper.Locators.ext4Button("Save & Finish").findElement(getDriver()));
clickAndWait(elementCache().saveAndFinishButton);
assertNoLabKeyErrors();
return new ExecuteQueryPage(getDriver());
}

public String clickSaveExpectingError()
{
Ext4Helper.Locators.ext4Button("Save").findElement(getDriver()).click();
elementCache().saveButton.click();
return waitForElement(Locator.tagWithId("div","status")).getText();
}

public String clickSaveAndFinishExpectingError()
{
clickAndWait(elementCache().saveAndFinishButton);
clearCache();
return waitForElement(Locators.labkeyError).getText();
}

@Override
protected ElementCache newElementCache()
{
Expand All @@ -115,5 +125,7 @@ protected ElementCache newElementCache()

protected class ElementCache extends LabKeyPage<?>.ElementCache
{
private final WebElement saveButton = Ext4Helper.Locators.ext4Button("Save").findWhenNeeded(this);
private final WebElement saveAndFinishButton = Ext4Helper.Locators.ext4Button("Save & Finish").findWhenNeeded(this);
}
}
2 changes: 1 addition & 1 deletion src/org/labkey/test/tests/PivotQueryTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ SELECT ParticipantId, SequenceNum, MAX([F1]) AS I1Max FROM study.[D2]
createQueryPage.setName(queryName);
var sourceQueryPage = createQueryPage.clickCreate();
sourceQueryPage.setSource(queryText);
sourceQueryPage.clickSaveAndFinish();
sourceQueryPage.clickSaveAndFinishExpectingError();

// expect query error
waitForText("Query 'Q1' has errors", "Error on line 3: Can not find pivot column:");
Expand Down
Loading