Skip to content
Merged
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
15 changes: 11 additions & 4 deletions LDK/resources/web/LDK/ux/DateTimeField.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ Ext4.define('Ext.ux.form.field.DateTime', {

me.dateField = Ext4.create('Ext.form.field.Date', Ext4.apply({
format:me.dateFormat,
bubbleEvents: ['change'],
flex:1,
isFormField:false, //exclude from field query's
submitValue:false,
Expand Down Expand Up @@ -114,6 +113,8 @@ Ext4.define('Ext.ux.form.field.DateTime', {
this.timeField.setValue(val);
}
}

this.checkChange();
}
},
getErrors: function(value){
Expand All @@ -132,7 +133,6 @@ Ext4.define('Ext.ux.form.field.DateTime', {

me.timeField = Ext4.create('Ext.form.field.Time', Ext4.apply({
format:me.timeFormat,
bubbleEvents: ['change'],
flex:1,
isFormField:false, //exclude from field query's
submitValue:false,
Expand All @@ -153,6 +153,8 @@ Ext4.define('Ext.ux.form.field.DateTime', {
if (date && !this.dateField.getValue()){
this.dateField.setValue(date);
}

this.checkChange();
}
},
getErrors: function(value){
Expand Down Expand Up @@ -191,6 +193,8 @@ Ext4.define('Ext.ux.form.field.DateTime', {

me.callParent();
me.initField();
// Compare later changes against the parsed Date, not a configured string
me.originalValue = me.lastValue = me.getValue();
},

getDefaultDate: function(){
Expand Down Expand Up @@ -258,8 +262,11 @@ Ext4.define('Ext.ux.form.field.DateTime', {
}
}
}
this.dateField.setValue(value);
this.timeField.setValue(value);
var me = this;
me.batchChanges(function(){
me.dateField.setValue(value);
me.timeField.setValue(value);
});
},

getFormat: function(){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
import org.labkey.test.util.ext4cmp.Ext4ComboRef;
import org.labkey.test.util.ext4cmp.Ext4FieldRef;
import org.labkey.test.util.external.labModules.LabModuleHelper;
import org.openqa.selenium.WebElement;

import java.io.File;
import java.io.UnsupportedEncodingException;
Expand Down Expand Up @@ -857,37 +858,28 @@ private void dataSourcesTest() throws Exception
waitAndClickAndWait(_helper.toolIcon("Settings"));
waitAndClickAndWait(Locator.linkContainingText("Manage Data and Demographics Sources"));
waitForText("Below are the extra data and sample sources registered for this folder"); //proxy for data loading
waitForElementToDisappear(Locator.xpath("//div[contains(text(), 'Loading...')]"), WAIT_FOR_JAVASCRIPT);
waitForElementToDisappear(LabModuleHelper.LOADING, WAIT_FOR_JAVASCRIPT);

//precaution mainly important to resuming a test in the middle
cleanupDataSources();

//add data source
Ext4CmpRef addDataSourceBtn = _ext4Helper.queryOne("#" + manageDataSources + " button[text='Add Default Sources']", Ext4CmpRef.class);
waitAndClick(Locator.id(addDataSourceBtn.getId()));
waitAndClick(Ext4Helper.Locators.menuItem(DATA_SOURCE + " (\"/home\".core.Users)"));
selectDefaultSource(manageDataSources, DATA_SOURCE + " (\"/home\".core.Users)");
new Window.WindowFinder(getDriver()).withTitle("Success").waitFor();
click(Ext4Helper.Locators.ext4Button("OK"));
waitForRemoveBtnCount(manageDataSources, 1);

addDataSourceBtn = _ext4Helper.queryOne("#" + manageDataSources + " button[text='Add Default Sources']", Ext4CmpRef.class);
waitAndClick(Locator.id(addDataSourceBtn.getId()));
waitAndClick(Ext4Helper.Locators.menuItem(GROUP_SOURCE + " (core.Groups)"));
selectDefaultSource(manageDataSources, GROUP_SOURCE + " (core.Groups)");
new Window.WindowFinder(getDriver()).withTitle("Success").waitFor();
click(Ext4Helper.Locators.ext4Button("OK"));

waitForText("Item Type");
assertEquals("Incorrect number of remove buttons", 2, getRemoveBtns(manageDataSources).size());
waitForRemoveBtnCount(manageDataSources, 2);

//add demographics source
Ext4CmpRef addDemographicsSourceBtn = _ext4Helper.queryOne("#" + manageDemographicsSources + " button[text='Add Default Sources']", Ext4CmpRef.class);
waitAndClick(Locator.id(addDemographicsSourceBtn.getId()));
waitAndClick(Ext4Helper.Locators.menuItem(SUBJECT_LIST + " (laboratory.subjects)"));
selectDefaultSource(manageDemographicsSources, SUBJECT_LIST + " (laboratory.subjects)");
new Window.WindowFinder(getDriver()).withTitle("Success").waitFor();
click(Ext4Helper.Locators.ext4Button("OK"));

waitForText("Table Name");
waitForRemoveBtnCount(manageDemographicsSources, 1);
waitForText("New Data Sources");
assertEquals("Incorrect number of remove buttons", 1, getRemoveBtns(manageDemographicsSources).size());

//query to make sure columns added:
Connection cn = WebTestHelper.getRemoteApiConnection();
Expand Down Expand Up @@ -987,6 +979,27 @@ private List<Ext4CmpRef> getRemoveBtns(String parentItemId)
return _ext4Helper.componentQuery("#" + parentItemId + " button[text='Remove']", Ext4CmpRef.class);
}

private void selectDefaultSource(String panelItemId, String sourceText)
{
Locator menuItem = Ext4Helper.Locators.menuItem(sourceText);
// A click on the menu button can be lost while the panel finishes reloading after the previous save
waitFor(() -> {
Ext4CmpRef addSourceBtn = _ext4Helper.queryOne("#" + panelItemId + " button[text='Add Default Sources']", Ext4CmpRef.class);
click(Locator.id(addSourceBtn.getId()));
return waitFor(() -> menuItem.findOptionalElement(getDriver()).filter(WebElement::isDisplayed).isPresent(), 2_000);
}, "'Add Default Sources' menu did not show " + sourceText, WAIT_FOR_JAVASCRIPT);
click(menuItem);
}

// Saving a source reloads the panel asynchronously, which also rebuilds its 'Add Default Sources' menu
private void waitForRemoveBtnCount(String parentItemId, int expectedCount)
{
waitForEquals("Incorrect number of remove buttons", () -> expectedCount, () -> {
List<Ext4CmpRef> btns = getRemoveBtns(parentItemId);
return btns == null ? 0 : btns.size();
}, WAIT_FOR_JAVASCRIPT);
}

private String replaceNonVisibleChars(String value)
{
//the DB might not store unicode chars correctly, so we just eliminate them here
Expand All @@ -1008,7 +1021,7 @@ private void deleteSourceByLabel(String label, String parentItemId)
click(Ext4Helper.Locators.ext4Button("OK"));

waitForText("Loading...");
waitForElementToDisappear(Locator.xpath("//div[" + Locator.NOT_HIDDEN + " and contains(text(), 'Loading...')]"), WAIT_FOR_JAVASCRIPT);
waitForElementToDisappear(LabModuleHelper.LOADING.notHidden(), WAIT_FOR_JAVASCRIPT);
}

private void settingsTest()
Expand Down Expand Up @@ -1790,7 +1803,7 @@ private void searchPanelTest()
{
_helper.goToLabHome();
_helper.clickNavPanelItem("DNA_Oligos:", "Search");
waitForTextToDisappear("Loading...");
waitForElementToDisappear(LabModuleHelper.LOADING);
waitForElement(Locator.name("name"));
sleep(50);
_helper.setFormField("name", "TestPrimer");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ public class LabModuleHelper
public static final String IMPORT_DATA_TEXT = "Import Data";
public static final String UPLOAD_RESULTS_TEXT = "Upload Results";
public static final String LAB_HOME_TEXT = "Types of Data:";
// The header product menu's collapsed dropdown always holds a "Loading..." placeholder
public static final Locator.XPathLocator LOADING = Locator.xpath("//div[contains(text(), 'Loading...')][not(ancestor::*[@id='headerProductDropdown'])]");

public static final String POS_COLOR = "rgb(255, 192, 203)";
public static final String UNKNOWN_COLOR = "rgb(0, 0, 255)";
Expand Down Expand Up @@ -324,7 +326,7 @@ public void addDataSource(String type, String label, String reportCategory, Stri
_test.waitAndClick(Locator.id(addBtn.getId()));
_test.waitForElement(Ext4Helper.Locators.window("Add Data Source"));

_test.waitForElementToDisappear(Locator.xpath("//div[contains(text(), 'Loading...')]"), BaseWebDriverTest.WAIT_FOR_JAVASCRIPT);
_test.waitForElementToDisappear(LOADING, BaseWebDriverTest.WAIT_FOR_JAVASCRIPT);
waitForField("Item Type");
Ext4FieldRef.getForLabel(_test, "Item Type").setValue(type);
Ext4FieldRef.getForLabel(_test, "Label").setValue(label);
Expand All @@ -333,13 +335,13 @@ public void addDataSource(String type, String label, String reportCategory, Stri
{
Ext4ComboRef combo = new Ext4ComboRef(Ext4FieldRef.getForLabel(_test, "Container (optional)"), _test);
combo.setComboByDisplayValue(containerPath);
_test.waitForElementToDisappear(Locator.xpath("//div[contains(text(), 'Loading...')]"), BaseWebDriverTest.WAIT_FOR_JAVASCRIPT);
_test.waitForElementToDisappear(LOADING, BaseWebDriverTest.WAIT_FOR_JAVASCRIPT);
}

Ext4FieldRef schemaField = Ext4FieldRef.getForLabel(_test, "Schema");
schemaField.waitForEnabled();
schemaField.setValue(schema);
_test.waitForElementToDisappear(Locator.tagWithText("div", "Loading..."), BaseWebDriverTest.WAIT_FOR_JAVASCRIPT * 3);
_test.waitForElementToDisappear(LOADING, BaseWebDriverTest.WAIT_FOR_JAVASCRIPT * 3);

Ext4FieldRef queryField = Ext4FieldRef.getForLabel(_test, "Query");
queryField.waitForEnabled();
Expand All @@ -361,22 +363,22 @@ public void addDemographicsSource(String label, String containerPath, String sch
_test.waitAndClick(Locator.id(addBtn.getId()));
_test.waitForElement(Ext4Helper.Locators.window("Add Demographics Source"));

_test.waitForElementToDisappear(Locator.xpath("//div[contains(text(), 'Loading...')]"), BaseWebDriverTest.WAIT_FOR_JAVASCRIPT);
_test.waitForElementToDisappear(LOADING, BaseWebDriverTest.WAIT_FOR_JAVASCRIPT);
waitForField("Label");
Ext4FieldRef.getForLabel(_test, "Label").setValue(label);

if (containerPath != null)
{
Ext4ComboRef combo = new Ext4ComboRef(Ext4FieldRef.getForLabel(_test, "Container (optional)"), _test);
combo.setComboByDisplayValue(containerPath);
_test.waitForElementToDisappear(Locator.xpath("//div[contains(text(), 'Loading...')]"), BaseWebDriverTest.WAIT_FOR_JAVASCRIPT);
_test.waitForElementToDisappear(LOADING, BaseWebDriverTest.WAIT_FOR_JAVASCRIPT);
}

Ext4FieldRef.getForLabel(_test, "Schema").setValue(schema);
_test.waitForElementToDisappear(Locator.xpath("//div[contains(text(), 'Loading...')]"), BaseWebDriverTest.WAIT_FOR_JAVASCRIPT * 3);
_test.waitForElementToDisappear(LOADING, BaseWebDriverTest.WAIT_FOR_JAVASCRIPT * 3);

Ext4FieldRef.getForLabel(_test, "Query").setValue(query);
_test.waitForElementToDisappear(Locator.xpath("//div[contains(text(), 'Loading...')]"), BaseWebDriverTest.WAIT_FOR_JAVASCRIPT);
_test.waitForElementToDisappear(LOADING, BaseWebDriverTest.WAIT_FOR_JAVASCRIPT);

if (targetColumn != null)
Ext4FieldRef.getForLabel(_test, "Target Column").setValue(targetColumn);
Expand Down
Loading