-
Notifications
You must be signed in to change notification settings - Fork 9
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
Changes from 36 commits
f367b9e
0be3b4f
943b685
19d30d6
dee0c41
875bbb4
98134ba
9b70169
95a6e08
f33fa34
d430de2
451c56a
953224f
cefc8af
b9362c0
122565c
777575d
b2e2663
3e38995
c6bef5d
80243ed
b1f28a9
20b2f7d
8335273
adafea1
618e3ba
ed88035
c1bb451
d402d57
06fc497
9d64c83
942999a
ccc1260
811f04b
63dd712
c86162e
4b2d459
4c9ccbf
d8ba9de
105aaa4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
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> | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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); | ||||||
} | ||||||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move this to a static method in
BaseSettingsPage
to be shared with test.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.