Skip to content

Commit 83aa411

Browse files
committed
Anchor and Button added with associated
1 parent a53a255 commit 83aa411

File tree

3 files changed

+70
-0
lines changed

3 files changed

+70
-0
lines changed

src/Test/TeamControlium/Controlium/Test/ControlTesting/BasicControlTests.java

+34
Original file line numberDiff line numberDiff line change
@@ -301,5 +301,39 @@ void VerifyBasicFindTableCell() {
301301
assertEquals("0.01",cellContents,"Table cell contents correctly read");
302302
}
303303

304+
// Verify we can click a button control
305+
@org.junit.jupiter.api.Test
306+
void VerifyButtonClick() {
307+
seleniumDriver.gotoURL("https://www.maxsys.com.au/");
308+
Button buttonControl=null;
309+
try {
310+
buttonControl = new Button("Sign In");
311+
buttonControl = ControlBase.setControl(seleniumDriver,buttonControl);
312+
buttonControl.click();
313+
}
314+
catch( Exception e) {
315+
Logger.WriteLine(Logger.LogLevels.TestInformation,"Error thrown clicking on Button control: ",e.getMessage());
316+
}
317+
HTMLElement oops = seleniumDriver.findElementOrNull(new ObjectMapping("//*[starts-with(.,'Oops')]","Error message"));
318+
assertNotNull(oops,"Error message shown");
319+
}
320+
321+
// Verify we can click a link (Anchor) control
322+
@org.junit.jupiter.api.Test
323+
void VerifyLinkClick() {
324+
seleniumDriver.gotoURL("https://www.maxsys.com.au/");
325+
Anchor anchorControl=null;
326+
try {
327+
anchorControl = new Anchor("Forgot Password?");
328+
anchorControl = ControlBase.setControl(seleniumDriver,anchorControl);
329+
anchorControl.click();
330+
}
331+
catch( Exception e) {
332+
Logger.WriteLine(Logger.LogLevels.TestInformation,"Error thrown clicking on Anchor control: ",e.getMessage());
333+
}
334+
String pageTitle = seleniumDriver.getPageTitle().trim();
335+
assertEquals("MAXsys | Forgot Password",pageTitle,"Forgot password page shown");
336+
}
337+
304338
}
305339

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package TeamControlium.Controlium.ElementControls;
2+
3+
import TeamControlium.Controlium.ControlBase;
4+
import TeamControlium.Controlium.ObjectMapping;
5+
6+
public class Anchor extends ControlBase {
7+
8+
public Anchor(ObjectMapping mapping) {
9+
setMapping(mapping);
10+
}
11+
12+
public Anchor(String text) { setMapping(new ObjectMapping(String.format(".//a[.='%s']",text)));}
13+
14+
protected void controlBeingSet(boolean isFirstSetting) {
15+
}
16+
17+
18+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package TeamControlium.Controlium.ElementControls;
2+
3+
import TeamControlium.Controlium.ControlBase;
4+
import TeamControlium.Controlium.ObjectMapping;
5+
6+
public class Button extends ControlBase {
7+
8+
public Button(ObjectMapping mapping) {
9+
setMapping(mapping);
10+
}
11+
12+
public Button(String text) { setMapping(new ObjectMapping(String.format(".//button[.='%s']",text)));}
13+
14+
protected void controlBeingSet(boolean isFirstSetting) {
15+
}
16+
17+
18+
}

0 commit comments

Comments
 (0)