private void _GenericTestShiftKeyUp(string pBrowserString, string pAppletID) { using (IJavaSelenium javaSelenium = _GetJavaSelenium(pBrowserString, URL, pAppletID)) { _OpenPage(javaSelenium); JavaAction action = new JavaAction(javaSelenium); Button button = new Button("clickme").Value("b"); Assert.AreEqual(action, action.Focus(button).Click()); Assert.AreEqual(action, action.ShiftKeyUp(button)); } }
private void _GenericTestType(string pBrowserString, string pAppletID) { using (IJavaSelenium javaSelenium = _GetJavaSelenium(pBrowserString, URL, pAppletID)) { _OpenPage(javaSelenium); JavaAction action = new JavaAction(javaSelenium); ComboBox box = new ComboBox("pattern").Value("Feb"); Assert.AreEqual(action, action.Focus(box).Click()); Assert.AreEqual(action, action.Type(box)); } }
private void _GenericTestSelect(string pBrowserString) { using (IJavaSelenium javaSelenium = new JavaSelenium.JavaSelenium(HOST, PORT, pBrowserString, URL)) { javaSelenium.ObjectID = COMBO_APPLET_ID; _OpenPage(javaSelenium); JavaAction action = new JavaAction(javaSelenium); ComboBox box = new ComboBox("pattern").AddItem("dd.MM.yy"); Assert.AreEqual(action, action.Select(box)); javaSelenium.ObjectID = TABLE_APPLET_ID; action = new JavaAction(javaSelenium); // Alternative syntax for prespecifying selection items. //Table table = new Table("table").AddItems(new Cell(0, 0), new Cell(0,1), new Cell(0,2), new Cell(0,3), new Cell(0,4)); Table table = new Table("table"); Assert.AreEqual(action, action.Focus(table) .Select<Table>(new Cell(0,0)) // .Select<Table>(new Cell(0,1)) // this cell is avoided to prevent the popup dialog from hanging the test. .Select<Table>(new Cell(0,2)) .Select<Table>(new Cell(0,3)) .Select<Table>(new Cell(0,4)) ); } _GenericTestDialogFocus(pBrowserString); }
// WARNING: Broken private void _GenericTestSelectPopUp(string pBrowserString) { using (IJavaSelenium javaSelenium = new JavaSelenium.JavaSelenium(HOST, PORT, pBrowserString, URL)) { _OpenPage(javaSelenium); javaSelenium.ObjectID = POPUP_APPLET_ID; JavaAction action = new JavaAction(javaSelenium); TextBox text = new TextBox("text"); //MenuItem item1 = new MenuItem("item1"); //MenuItem item2 = new MenuItem("item2"); action.ScrollBrowserWindowToBottom(); // WARNING: Must RightClick before the SelectPopup can be called. // This functionality is broken at the moment. There currently // is no way in FEST to specify a JPopupMenu directly Assert.AreEqual(action, action.Focus(text).RightClick().SelectPopUp()); //.RightClick().Select<MenuItem>(item1).Select<MenuItem>(item2) } }
private void _GenericTestFocus(string pBrowserString) { using (IJavaSelenium javaSelenium = new JavaSelenium.JavaSelenium(HOST, PORT, pBrowserString, URL)) { javaSelenium.ObjectID = TEST_APPLET_ID; _OpenPage(javaSelenium); JavaAction action = new JavaAction(javaSelenium); Assert.AreEqual(action, action.Focus()); javaSelenium.ObjectID = TABLE_APPLET_ID; action = new JavaAction(javaSelenium); Assert.AreEqual(action, action.Focus()); javaSelenium.ObjectID = TREE_APPLET_ID; action = new JavaAction(javaSelenium); Assert.AreEqual(action, action.Focus()); javaSelenium.ObjectID = COMBO_APPLET_ID; action = new JavaAction(javaSelenium); Assert.AreEqual(action, action.Focus()); javaSelenium.ObjectID = TAB_APPLET_ID; action = new JavaAction(javaSelenium); Assert.AreEqual(action, action.Focus()); javaSelenium.ObjectID = SPINNER_APPLET_ID; action = new JavaAction(javaSelenium); Assert.AreEqual(action, action.Focus()); javaSelenium.ObjectID = LIST_APPLET_ID; action = new JavaAction(javaSelenium); Assert.AreEqual(action, action.ScrollBrowserWindowToBottom()); Assert.AreEqual(action, action.Focus()); Button hire = new Button("hire"); Button fire = new Button("fire"); List employees = new List("employees"); TextBox employeeName = new TextBox("employeeName"); // WARNING : An illegal state exception will be thrown when attempting to focus on a disabled component //Assert.AreEqual(action, action.Focus(hire)); Assert.AreEqual(action, action.Focus(fire)); Assert.AreEqual(action, action.Focus(employees)); // Enter something in the employeeName text field to enable the hire button Assert.AreEqual(action, action.Focus(employeeName).Click().Type<TextBox>("New Guy")); Assert.AreEqual("New Guy", action.Focus(hire).Click().GetSelectedValue(employees)); Assert.AreEqual(1, action.GetSelectedValues(employees).Count); } }
// WARNING: This test runs extremely slow private void _GenericTestDialogFocus(string pBrowserString) { using (IJavaSelenium javaSelenium = new JavaSelenium.JavaSelenium(HOST, PORT, pBrowserString, URL)) { _OpenPage(javaSelenium); javaSelenium.ObjectID = TABLE_APPLET_ID; JavaAction action = new JavaAction(javaSelenium); Table table = new Table("table"); Dialog dialog = new Dialog("dialog"); TabbedPane pane = new TabbedPane("ColorChooser.tabPane"); //System.Diagnostics.Debugger.Break(); Assert.AreEqual(action, action.Focus(table) .Select<Table>(new Cell(0, 1)) .Focus(dialog) // focuses on the actual dialog component .SetRootComponent(dialog) .Focus(pane) .Select<TabbedPane>("Swatches").Click() // subsequent calls inherit the RootComponent .Select<TabbedPane>("HSB").Click() .Select<TabbedPane>("RGB").Click() ); } }
private void _GenericTestClick(string pBrowserString) { using (IJavaSelenium javaSelenium = new JavaSelenium.JavaSelenium(HOST, PORT, pBrowserString, URL)) { javaSelenium.ObjectID = TEST_APPLET_ID; _OpenPage(javaSelenium); JavaAction action = new JavaAction(javaSelenium); Button button = new Button("clickme"); Assert.AreEqual(action, action.Click(button)); javaSelenium.ObjectID = TREE_APPLET_ID; Tree tree = new Tree("tree"); action = new JavaAction(javaSelenium); Assert.AreEqual(action, action.Focus(tree).Select<Tree>("root").Click() .Select<Tree>("root/attribute1").Click() .Select<Tree>("root/attribute1/attribute1.1").Click() .Select<Tree>("root/attribute1/attribute1.3/leaf1.3.1").Click() .Select<Tree>("root/attribute1/attribute1.3/leaf1.3.2").Click() .Select<Tree>("root/attribute1/attribute1.3/leaf1.3.3").Click() .Select<Tree>("root/attribute2").Click() .Select<Tree>("root/attribute3").Click() ); javaSelenium.ObjectID = COMBO_APPLET_ID; ComboBox pattern = new ComboBox("pattern"); action = new JavaAction(javaSelenium); Assert.AreEqual(action, action.Focus(pattern) .Select<ComboBox>("yyyy.MMMMM.dd GGG hh:mm aaa") .Select<ComboBox>("K:mm a,z") .Select<ComboBox>("H:mm:ss:SSS") .Select<ComboBox>("h:mm a") .Select<ComboBox>("EEE, MMM d, ''yy") .Select<ComboBox>("yyy.MM.dd G 'at' hh:mm:ss z") .Select<ComboBox>("MM/dd/yy") ); javaSelenium.ObjectID = TAB_APPLET_ID; TabbedPane pane = new TabbedPane("pane"); action = new JavaAction(javaSelenium); Assert.AreEqual(action, action.Focus(pane) .Select<TabbedPane>("Tab 1").Click() .Select<TabbedPane>("Tab 2").Click() .Select<TabbedPane>("Tab 3").Click() .Select<TabbedPane>("Tab 4").Click() ); javaSelenium.ObjectID = SPINNER_APPLET_ID; Spinner month = new Spinner("month"); Spinner year = new Spinner("year"); Spinner date = new Spinner("date"); Assert.AreEqual(action, action .Focus(month).Click() .Focus(year).Click() .Focus(date).Click() ); } }
private void _GenericTestAltKeyDown(string pBrowserString, string pAppletID) { using (IJavaSelenium javaSelenium = _GetJavaSelenium(pBrowserString, URL, pAppletID)) { _OpenPage(javaSelenium); JavaAction action = new JavaAction(javaSelenium); Button button = new Button("clickme").Value("a"); // Require focus before keypress Assert.AreEqual(action, action.Focus(button).Click()); Assert.AreEqual(action, action.AltKeyDown(button)); } }
private void _GenericTestAddSelection(string pBrowserString, string pAppletID) { using (IJavaSelenium javaSelenium = _GetJavaSelenium(pBrowserString, URL, pAppletID)) { _OpenPage(javaSelenium); JavaAction action = new JavaAction(javaSelenium); // applet must be visible to be able to run tests against. action.ScrollBrowserWindowToBottom(); List list = new List("employees").AddItems("Debbie Scott", "Scott Hommel"); Assert.AreEqual(action, action.Focus(list).Click()); Assert.AreEqual(action, action.AddSelection(list)); Assert.AreEqual(2, action.GetSelectedValues(list).Count); Assert.AreEqual("Debbie Scott", action.GetSelectedValues()[0]); Assert.AreEqual("Scott Hommel", action.GetSelectedValues()[1]); } }