Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test Automation for Date-only and Time-only Fields #1836

Merged
merged 40 commits into from
Mar 18, 2024
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
f367b9e
Add date and time types to FieldDefinition.
labkey-danield Feb 6, 2024
0be3b4f
Merge branch 'develop' into fb_dateAndTimeAutomation
labkey-danield Feb 6, 2024
943b685
Merge branch 'develop' into fb_dateAndTimeAutomation
labkey-danield Feb 14, 2024
19d30d6
Merge from develop.
labkey-danield Feb 14, 2024
dee0c41
Consolidate LookAndFeelSettingsPage and ProjectSettingsPage.
labkey-danield Feb 14, 2024
875bbb4
Clean up tests validating checking site settings vs project settings.
labkey-danield Feb 15, 2024
98134ba
Merge branch 'develop' into fb_dateAndTimeAutomation
labkey-danield Feb 15, 2024
9b70169
Merge branch 'develop' into fb_dateAndTimeAutomation
labkey-danield Feb 16, 2024
95a6e08
Use a date object and a date formatter for the expected data checks.
labkey-danield Feb 16, 2024
f33fa34
Merge branch 'develop' into fb_dateAndTimeAutomation
labkey-danield Feb 19, 2024
d430de2
Merge branch 'develop' into fb_dateAndTimeAutomation
labkey-danield Feb 20, 2024
451c56a
Cleaned up the ListTest to some degree.
labkey-danield Feb 21, 2024
953224f
Merge branch 'develop' into fb_dateAndTimeAutomation
labkey-danield Feb 21, 2024
cefc8af
Breaking the daet-only and time-only tests out of the older ListTest.…
labkey-danield Feb 23, 2024
b9362c0
Add more comments.
labkey-danield Feb 23, 2024
122565c
Add a method to DomainFieldRow that returns the dialog. This is used …
labkey-danield Feb 23, 2024
777575d
Change test to expect 00:00:00 if a date is given for a time-only field.
labkey-danield Feb 23, 2024
b2e2663
Merge branch 'develop' into fb_dateAndTimeAutomation
labkey-danield Feb 27, 2024
3e38995
Merge branch 'develop' into fb_dateAndTimeAutomation
labkey-danield Feb 29, 2024
c6bef5d
Merge branch 'develop' into fb_dateAndTimeAutomation
labkey-danield Mar 1, 2024
80243ed
Test for site-wide vs project specific import formats.
labkey-danield Mar 2, 2024
b1f28a9
Merge branch 'develop' into fb_dateAndTimeAutomation
labkey-danield Mar 4, 2024
20b2f7d
Date-only and Time-only Tests for Assays
labkey-danield Mar 5, 2024
8335273
DataClass tests for date-only and time-only fields.
labkey-danield Mar 6, 2024
adafea1
Remove unused / unneeded code.
labkey-danield Mar 7, 2024
618e3ba
Merge branch 'develop' into fb_dateAndTimeAutomation
labkey-danield Mar 7, 2024
ed88035
Merge branch 'develop' into fb_dateAndTimeAutomation
labkey-danield Mar 8, 2024
c1bb451
Add test to validate date-only and time-only fields in assay run fields.
labkey-danield Mar 9, 2024
d402d57
Merge branch 'develop' into fb_dateAndTimeAutomation
labkey-danield Mar 11, 2024
06fc497
Remove check from VarListDefinition.
labkey-danield Mar 11, 2024
9d64c83
Fix setting the date in the future.
labkey-danield Mar 12, 2024
942999a
Adding a couple of comments.
labkey-danield Mar 12, 2024
ccc1260
Remove unused import.
labkey-danield Mar 12, 2024
811f04b
Merge branch 'develop' into fb_dateAndTimeAutomation
labkey-danield Mar 13, 2024
63dd712
Added test that converts date, time and dateTime fields that are in a…
labkey-danield Mar 14, 2024
c86162e
Merge branch 'develop' into fb_dateAndTimeAutomation
labkey-danield Mar 14, 2024
4b2d459
Yet more code review feedback.
labkey-danield Mar 14, 2024
4c9ccbf
Merge branch 'develop' into fb_dateAndTimeAutomation
labkey-danield Mar 18, 2024
d8ba9de
Make sure project settings are reset before test.
labkey-danield Mar 18, 2024
105aaa4
Take into account different sort order between MSSQL and postgres for…
labkey-danield Mar 18, 2024
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
Binary file modified data/DateParsing/BulkImportDateParsing.xlsx
Binary file not shown.
Binary file added data/DateParsing/BulkImportDateParsing_Text.xlsx
Binary file not shown.
Binary file modified data/DateParsing/StudyForDateParsing.zip
Binary file not shown.
Binary file modified data/GPAT/trial01.xls
Binary file not shown.
Binary file modified data/GPAT/trial01a.xlsx
Binary file not shown.
404 changes: 202 additions & 202 deletions data/GPAT/trial02.tsv

Large diffs are not rendered by default.

Binary file added data/lists/Bad_Date_And_Time_Values.xlsx
Binary file not shown.
Binary file added data/lists/Date_And_Time_Format.xlsx
Binary file not shown.
14 changes: 14 additions & 0 deletions src/org/labkey/test/components/domain/DomainFieldRow.java
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,20 @@ public DomainFieldRow setType(FieldDefinition.ColumnType columnType, boolean con
return this;
}

/**
* Selects the field data type and returns the 'are you sure' dialog.
*/
public ModalDialog setTypeWithDialog(FieldDefinition.ColumnType columnType)
{
elementCache().fieldTypeSelectInput.selectByVisibleText(columnType.getLabel());

ModalDialog confirmDialog = new ModalDialog.ModalDialogFinder(getDriver())
.withTitle("Confirm Data Type Change").timeout(1000).waitFor();

return confirmDialog;

}

public boolean getRequiredField()
{
return elementCache().fieldRequiredCheckbox.get();
Expand Down
303 changes: 303 additions & 0 deletions src/org/labkey/test/pages/core/admin/BaseSettingsPage.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,303 @@
package org.labkey.test.pages.core.admin;

import org.labkey.test.Locator;
import org.labkey.test.components.html.RadioButton;
import org.labkey.test.pages.LabKeyPage;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;

public class BaseSettingsPage extends LabKeyPage<LabKeyPage<?>.ElementCache>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you change how this is declared, you won't have to override elementCache below.

Suggested change
public class BaseSettingsPage extends LabKeyPage<LabKeyPage<?>.ElementCache>
public class BaseSettingsPage extends LabKeyPage<BaseSettingsPage.ElementCache>

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed.

{

public BaseSettingsPage(WebDriver driver)
{
super(driver);
waitForPage();
}

@Override
protected void waitForPage()
{
Locator.waitForAnyElement(shortWait(), Locator.tagWithText("span","Save"), Locator.tagWithText("span","Done"));
}

public String getSystemDescription()
{
return getFormElement(elementCache().systemDescription);
}

public void setSystemDescription(String description)
{
setFormElement(elementCache().systemDescription, description);
}

public String getHeaderShortName()
{
return getFormElement(elementCache().headerShortName);
}

public void setHeaderShortName(String shortName)
{
setFormElement(elementCache().headerShortName, shortName);
}

public String getTheme()
{
return getSelectedOptionText(elementCache().theme);
}

public void setTheme(String theme)
{
selectOptionByText(elementCache().theme, theme);
}

public boolean isShowNavAlwaysChecked()
{
return new RadioButton(elementCache().showNavAlways).isChecked();
}

public void checkShowNavAlways()
{
new RadioButton(elementCache().showNavAlways).check();
}

public boolean isShowNavAdminChecked()
{
return new RadioButton(elementCache().showNavForAdmin).isChecked();
}

public void checkShowNavAdmin()
{
new RadioButton(elementCache().showNavForAdmin).check();
}

public boolean isShowAppNavAlwaysChecked()
{
return new RadioButton(elementCache().showAppNavAlways).isChecked();
}

public void checkShowAppNavAlways()
{
new RadioButton(elementCache().showAppNavAlways).check();
}

public boolean isShowAppNavAdminChecked()
{
return new RadioButton(elementCache().showAppNavForAdmin).isChecked();
}

public void checkShowAppNavAdmin()
{
new RadioButton(elementCache().showAppNavForAdmin).check();
}

public boolean getHelpMenu()
{
return elementCache().helpMenuEnabledChk.isSelected();
}

public void setHelpMenu(boolean enable)
{
if (enable)
checkCheckbox(elementCache().helpMenuEnabledChk);
else
uncheckCheckbox(elementCache().helpMenuEnabledChk);
}

public boolean getObjectLevelDiscussions()
{
return elementCache().discussionEnabledChk.isEnabled();
}

public void setObjectLevelDiscussions(boolean enable)
{
if (enable)
checkCheckbox(elementCache().discussionEnabledChk);
else
uncheckCheckbox(elementCache().discussionEnabledChk);
}

public String getLogoLink()
{
return getFormElement(elementCache().logoLinkTxt);
}

public void setLogoLink(String link)
{
setFormElement(elementCache().logoLinkTxt,link);
}

public String getSupportLink()
{
return getFormElement(elementCache().supportLinkTxt);
}

public void setSupportLink(String link)
{
setFormElement(elementCache().supportLinkTxt, link);
}

public String getSupportEmail()
{
return getFormElement(elementCache().supportEmailTxt);
}

public void setSupportEmail(String email)
{
setFormElement(elementCache().supportEmailTxt, email);
}

public String getSystemEmail()
{
return getFormElement(elementCache().systemEmailTxt);
}

public void setSystemEmail(String email)
{
setFormElement(elementCache().systemEmailTxt, email);
}

public String getOrgName()
{
return getFormElement(elementCache().organizationNameTxt);
}

public void setOrgName(String name)
{
setFormElement(elementCache().organizationNameTxt, name);
}

public String getDefaultDateDisplay()
{
return getFormElement(elementCache().defaultDateFormat);
}

public void setDefaultDateDisplay(String displayFormat)
{
setFormElement(elementCache().defaultDateFormat, displayFormat);
}

public String getDefaultDateTimeDisplay()
{
return getFormElement(elementCache().defaultDateTimeFormat);
}

public void setDefaultDateTimeDisplay(String displayFormat)
{
setFormElement(elementCache().defaultDateTimeFormat, displayFormat);
}

public String getDefaultTimeDisplay()
{
return getFormElement(elementCache().defaultTimeFormat);
}

public void setDefaultTimeDisplay(String displayFormat)
{
setFormElement(elementCache().defaultTimeFormat, displayFormat);
}

public String getDefaultNumberDisplay()
{
return getFormElement(elementCache().defaultNumberFormat);
}

public void setDefaultNumberDisplay(String numberFormat)
{
setFormElement(elementCache().defaultNumberFormat, numberFormat);
}

public String getAdditionalParsingPatternDates()
{
return getFormElement(elementCache().additionalParsingPatternDates);
}

public void setAdditionalParsingPatternDates(String pattern)
{
setFormElement(elementCache().additionalParsingPatternDates, pattern);
}

public String getAdditionalParsingPatternDateAndTime()
{
return getFormElement(elementCache().additionalParsingPatternDateAndTime);
}

public void setAdditionalParsingPatternDateAndTime(String pattern)
{
setFormElement(elementCache().additionalParsingPatternDateAndTime, pattern);
}

public String getAdditionalParsingPatternTimes()
{
return getFormElement(elementCache().additionalParsingPatternTimes);
}

public void setAdditionalParsingPatternTimes(String pattern)
{
setFormElement(elementCache().additionalParsingPatternTimes, pattern);
}

public void setRestrictChartingCols(boolean restrict)
{
if (restrict)
checkCheckbox(elementCache().restrictChartingColsChk);
else
uncheckCheckbox(elementCache().restrictChartingColsChk);
}

public boolean getRestrictChartingCols()
{
return elementCache().restrictChartingColsChk.isSelected();
}

public void save()
{
clickAndWait(elementCache().saveBtn);
}

public void reset()
{
elementCache().resetBtn.click();
acceptAlert();
}

@Override
protected ElementCache elementCache()
{
return (ElementCache) super.elementCache();
}

@Override
protected ElementCache newElementCache()
{
return new ElementCache();
}

protected class ElementCache extends LabKeyPage<?>.ElementCache
{
WebElement systemDescription = Locator.name("systemDescription").findWhenNeeded(this);
WebElement headerShortName = Locator.name("systemShortName").findWhenNeeded(this);
WebElement theme = Locator.name("themeName").findWhenNeeded(this);
WebElement showNavAlways = Locator.xpath("//input[@name='folderDisplayMode' and @value='ALWAYS']").findWhenNeeded(this);
WebElement showNavForAdmin = Locator.xpath("//input[@name='folderDisplayMode' and @value='ADMIN']").findWhenNeeded(this);
WebElement showAppNavAlways = Locator.xpath("//input[@name='applicationMenuDisplayMode' and @value='ALWAYS']").findWhenNeeded(this);
WebElement showAppNavForAdmin = Locator.xpath("//input[@name='applicationMenuDisplayMode' and @value='ADMIN']").findWhenNeeded(this);
WebElement helpMenuEnabledChk = Locator.name("helpMenuEnabled").findWhenNeeded(this);
WebElement discussionEnabledChk = Locator.name("discussionEnabled").findWhenNeeded(this);
WebElement logoLinkTxt = Locator.inputByNameContaining("logoHref").findWhenNeeded(this);
WebElement supportLinkTxt = Locator.inputByNameContaining("reportAProblemPath").findWhenNeeded(this);
WebElement supportEmailTxt = Locator.inputByNameContaining("supportEmail").findWhenNeeded(this);
WebElement systemEmailTxt = Locator.inputByNameContaining("systemEmailAddress").findWhenNeeded(this);
WebElement organizationNameTxt = Locator.inputByNameContaining("companyName").findWhenNeeded(this);
WebElement defaultDateFormat = Locator.inputByNameContaining("defaultDateFormat").findWhenNeeded(this);
WebElement defaultTimeFormat = Locator.inputByNameContaining("defaultTimeFormat").findWhenNeeded(this);
WebElement defaultDateTimeFormat = Locator.inputByNameContaining("defaultDateTimeFormat").findWhenNeeded(this);
WebElement defaultNumberFormat = Locator.inputByNameContaining("defaultNumberFormat").findWhenNeeded(this);
WebElement additionalParsingPatternDates = Locator.inputByNameContaining("extraDateParsingPattern").findElement(this);
WebElement additionalParsingPatternTimes = Locator.inputByNameContaining("extraTimeParsingPattern").findElement(this);
WebElement additionalParsingPatternDateAndTime = Locator.inputByNameContaining("extraDateTimeParsingPattern").findElement(this);
WebElement restrictChartingColsChk = Locator.checkboxByName("restrictedColumnsEnabled").findWhenNeeded(this);
WebElement saveBtn = Locator.lkButton("Save").findWhenNeeded(this);
WebElement resetBtn = Locator.lkButton("Reset").findWhenNeeded(this);
}
}
Loading