public void AppLaunches() { app.Flash(x => x.Id("txt")); app.Tap(x => x.Id("txt")); app.Tap(x => x.Text("Technology")); Thread.Sleep(TimeSpan.FromSeconds(4)); app.Screenshot("Flashed and Tapped 'All' button, then Tapped 'Technology' button"); app.Flash(x => x.Id("ab_refresh")); app.Tap(x => x.Id("ab_refresh")); app.Screenshot("Flashed and Tapped refresh button"); app.Flash(x => x.Id("ab_search")); app.Tap(x => x.Id("ab_search")); app.EnterText("Microsoft"); app.Screenshot("Entered Microsoft"); Thread.Sleep(TimeSpan.FromSeconds(2)); app.PressEnter(); app.Screenshot("Searched for 'Microsoft' in the Search Bar"); app.ScrollDown(); Thread.Sleep(TimeSpan.FromSeconds(1)); app.ScrollDown(); Thread.Sleep(TimeSpan.FromSeconds(1)); app.Screenshot("Swiped down a few times"); app.WaitForElement(x => x.Marked("Facebook, Microsoft to Run Mega-Cable From Va. to Spain")); app.Flash(x => x.Marked("Facebook, Microsoft to Run Mega-Cable From Va. to Spain")); app.Screenshot("Flashed Microsoft News Article"); Thread.Sleep(TimeSpan.FromSeconds(2)); app.Tap(x => x.Marked("Facebook, Microsoft to Run Mega-Cable From Va. to Spain")); app.Screenshot("Tapped on Microsoft and Facebook Article'"); }
public void AddItem() { app.Tap(c => c.Id("fab_button")); app.EnterText(c => c.Id("edit_text_name"), "test"); app.PressEnter(); app.EnterText(c => c.Marked("edit_text_amount"), "23.30"); app.Tap(c => c.Id("fab_button_goal_edit")); }
// [Test] public void TestFeed() { try { var randomArtist = (new Random()).Next(); Console.Out.WriteLine("Key : " + randomArtist); var model = new Model(); // LoginAsUser("*****@*****.**", "b"); app.Tap(c => c.Marked("el_btn_email_login")); app.Tap(c => c.Marked("el_input_email")); app.EnterText("*****@*****.**"); app.Tap(c => c.Marked("el_input_password")); app.EnterText("b"); app.PressEnter(); app.Tap(c => c.Marked("el_btn_email_login")); app.WaitForElement(c => c.Marked("follow_artist_list")); var name = "Miss Destiny Rogahn"; QQ qq = model.FollowArtistButton(name); app.Tap(qq); this.all(); } catch { this.all(); throw; } }
public void UserLendsOutAnItemAndSeesGemStoneRankChange() { app.Tap(x => x.Marked("Sign-in")); app.WaitForElement("Tapped on view with class: UIButton marked: Sign-in"); app.WaitForElement("Tapped on view with class: UIWebView"); app.EnterText(x => x.Class("UIWebView").Css("INPUT._56bg._4u9z._5ruq"), "*****@*****.**"); app.WaitForElement("Tapped on view with class: UIWebView"); app.EnterText(x => x.Class("UIWebView").Css("INPUT#u_0_2"), "Imperial09!"); app.WaitForElement("Tapped on view with class: UIWebView"); app.Tap(x => x.Id("*****@*****.**")); app.WaitForElement("Tapped on view with class: UITabBarSwappableImageView"); app.Tap(x => x.Marked("Enter Category")); app.WaitForElement("Tapped on view with class: UITextFieldLabel marked: Enter Category"); app.Tap(x => x.Marked("Book")); app.WaitForElement("Tapped on view with class: UILabel marked: Book"); app.Tap(x => x.Marked("Done")); app.WaitForElement("Tapped on view with class: UIToolbarTextButton marked: Done"); app.Tap(x => x.Marked("Enter Name")); app.WaitForElement("Tapped on view with class: UITextFieldLabel marked: Enter Name"); app.EnterText(x => x.Class("UITextField").Index(1), "Of Mice and Men"); app.Tap(x => x.Text("Enter Description")); app.WaitForElement("Tapped on view with class: UITextView"); app.Tap(x => x.Marked("Done")); app.WaitForElement("Tapped on view with class: UIToolbarTextButton marked: Done"); app.Tap(x => x.Marked("Enter Number of Days Willing to Lend")); app.WaitForElement("Tapped on view with class: UITextFieldLabel marked: Enter Number of Days Willing to Lend"); app.EnterText(x => x.Class("UITextField").Index(2), "12"); app.WaitForElement("Tapped on view with class: Xamarin_Forms_Platform_iOS_Platform_DefaultRenderer"); app.Tap(x => x.Marked("Enter Location")); app.WaitForElement("Tapped on view with class: UITextFieldLabel marked: Enter Location"); app.EnterText(x => x.Class("UITextField").Index(3), "London"); app.PressEnter(); app.WaitForElement("Tapped on view with class: UIButtonLabel marked: Add Item"); app.Tap(x => x.Marked("Ok")); app.WaitForElement("Tapped on view with class: _UIAlertControllerActionView marked: Ok"); app.Tap(x => x.Id("Gender Neutral [email protected]")); app.WaitForElement("Tapped on view with class: UITabBarSwappableImageView"); app.Tap(x => x.Text("Rank Table")); app.WaitForElement("Tapped on view with class: UIButtonLabel marked: Rank Table"); app.Tap(x => x.Text("Back")); app.WaitForElement("Tapped on view with class: UIButtonLabel marked: Back"); }
//------ Helper functions ------- private void enterText(string target, string text) { app.EnterText(target, text); app.PressEnter(); app.PressUserAction(); }
// [TestCase] public void NewTest() { app.Tap(x => x.Class("EntryEditText")); app.Screenshot("Tapped on view with class: EntryEditText"); // step 2 app.EnterText(x => x.Class("EntryEditText"), "sandy"); app.PressEnter(); app.Tap(x => x.Class("EntryEditText").Index(1)); app.EnterText(x => x.Class("EntryEditText").Index(1), "engg"); app.PressEnter(); app.Tap(x => x.Class("EntryEditText").Index(2)); app.EnterText(x => x.Class("EntryEditText").Index(2), "public"); app.Tap(x => x.Class("EntryEditText").Index(3)); app.EnterText(x => x.Class("EntryEditText").Index(3), "*****@*****.**"); app.Tap(x => x.Class("EntryEditText").Index(4)); app.EnterText(x => x.Class("EntryEditText").Index(4), "1234567890"); app.PressEnter(); app.Screenshot("Pressed enter key"); // step 3 app.Tap(x => x.Text("GET STARTED")); app.Screenshot("Tapped on view with class: Button with text: GET STARTED"); // step 4 app.Tap(x => x.Text("NEW PROJECT")); app.WaitForElement(x => x.Marked("SiteName")); app.Screenshot("Tapped on view with class: FormsTextView with text: Copy project settings from\nanother project"); // step 5 app.Tap(x => x.Marked("siteName")); app.EnterText(x => x.Marked("siteName"), "first"); app.PressEnter(); app.Tap(x => x.Marked("EntrySiteLoc")); app.EnterText(x => x.Marked("EntrySiteLoc"), "germany"); app.PressEnter(); app.Tap(x => x.Text("Project Type").Index(1)); app.TouchAndHold(x => x.Text("Commercial")); app.Screenshot("Long press on view with class: Platform_DefaultRenderer"); // step 6 app.TouchAndHold(x => x.Text("Advanced Settings")); app.Screenshot("Entered text: D"); // step 7 app.Tap(x => x.Text("02")); app.Screenshot("Entered text: 02"); // step 8 for (int i = 0; i < 2; i++) { app.ScrollDown(); if ((app.Query(x => x.Marked("Panel Languages"))).Length > 0) { break; } } app.Screenshot("Scrolled for the Panel Language"); // step 9 app.Tap(x => x.Class("EditText").Index(2)); app.Screenshot("Tapped on view with class: EditText"); // step 10 app.Tap(x => x.Id("button1")); app.Screenshot("Tapped on OK"); // step 11 for (int i = 0; i < 2; i++) { app.ScrollDown(); if ((app.Query(x => x.Marked("No of repeaters"))).Length > 0) { break; } } // step 12 app.Tap(x => x.Text("+").Index(1)); app.Tap(x => x.Text("+").Index(1)); app.Tap(x => x.Text("+").Index(1)); app.Tap(x => x.Text("+").Index(1)); app.Tap(x => x.Text("+").Index(1)); //app.Tap(x => x.Text("+").Index(2)); //app.Tap(x => x.Text("+").Index(2)); //app.Tap(x => x.Text("+").Index(2)); //app.Tap(x => x.Text("+").Index(2)); //app.Tap(x => x.Text("+").Index(2)); app.Screenshot("Tapped on view with class: Button with text: +"); // step app.Back(); app.Tap(x => x.Text("CREATE")); app.Screenshot("Tapped on view with class: Button with text: CREATE"); //for (int i = 0; i < 6; i++) //{ // app.Back(); // if ((app.Query(x => x.Marked("Do you really want to exit?"))).Length > 0) // { // break; // } // for (i = 0; i < 2000; i++) // { // ; // } //} //app.Screenshot("about to exit"); //app.Tap(x => x.Id("button1")); //app.Screenshot("app closed"); //BeforeEachTest(); //app.Screenshot("reopen"); // step app.TouchAndHold(x => x.Text("first")); app.Screenshot("Long press on view with class: Platform_DefaultRenderer"); // step app.Tap(x => x.Text("NEW PANEL")); app.Screenshot("Tapped on view with class: Button with text: NEW PANEL"); // step app.Tap(x => x.Class("EntryEditText")); app.EnterText(x => x.Class("EntryEditText"), "dxc"); app.PressEnter(); app.Screenshot("dxc"); // step app.Tap(x => x.Class("EntryEditText").Index(1)); app.EnterText(x => x.Class("EntryEditText").Index(1), "first floor"); app.PressEnter(); app.Screenshot("Pressed enter key"); // step app.Tap(x => x.Text("CREATE")); app.Screenshot("Tapped on view with class: Button with text: CREATE"); // step app.TouchAndHold(x => x.Text("dxc")); app.Screenshot("pressed DXC"); // step app.TouchAndHold(x => x.Text("Devices")); app.Screenshot("Long press on view with class: FormsImageView"); // step app.TouchAndHold(x => x.Text("Zones")); app.Screenshot("Long press on view with class: FormsTextView with text: Zones"); // step app.TouchAndHold(x => x.Text("Logics")); app.Screenshot("Long press on view with class: LOGICS"); // step app.TouchAndHold(x => x.Text("Events")); app.Screenshot("Long press on view with class: FormsTextView with text: Events"); // step app.Tap(x => x.Text("All")); app.Screenshot("press All"); // step app.ScrollDown(); app.Screenshot("press Fault"); // step app.Tap(x => x.Id("button1")); app.Screenshot("Long press on view with class: FormsImageView"); // step app.Back(); app.Screenshot("goto prev screen"); // step app.Tap(x => x.Text("QUICK CONFIGURE")); app.Screenshot("Tapped on view with class: Button with text: QUICK CONFIGURE"); // step app.Tap(x => x.Text("CONTINUE")); app.Screenshot("Tapped on view with class: Button with text: CONTINUE"); // step app.Tap(x => x.Class("EntryEditText")); app.EnterText(x => x.Class("EntryEditText"), "two"); app.PressEnter(); app.Tap(x => x.Class("EntryEditText").Index(1)); app.EnterText(x => x.Class("EntryEditText").Index(1), "second floor"); app.PressEnter(); app.Tap(x => x.Text("04")); app.Screenshot("filled the page and tap on CONTINUE"); // step app.Tap(x => x.Text("CONTINUE")); app.Screenshot("Tapped on view with class: Button with text: CONTINUE"); // step app.Tap(x => x.Text("Loop 1")); app.Screenshot("Long press on view with class: LOOP 1"); // step app.Tap(x => x.Class("EntryEditText")); app.EnterText(x => x.Class("EntryEditText"), "20"); app.PressEnter(); app.Tap(x => x.Class("EntryEditText").Index(1)); app.EnterText(x => x.Class("EntryEditText").Index(1), "0"); app.PressEnter(); app.Screenshot("added sensor and modules"); // step app.Tap(x => x.Text("DONE")); app.Screenshot("Tapped on view with class: Button with text: DONE"); // step app.Tap(x => x.Text("CONTINUE")); app.Screenshot("Tapped on view with class: Button with text: CONTINUE"); // step app.Tap(x => x.Text("SKIP")); app.Screenshot("Tapped on view with class: Button with text: SKIP"); // step app.Tap(x => x.Class("RadioButton")); app.Tap(x => x.Class("RadioButton").Index(2)); app.Tap(x => x.Class("RadioButton").Index(1)); app.Screenshot("Tapped on view with class: RadioButton"); // step app.Tap(x => x.Text("ASSIGN")); app.Screenshot("Tapped on view with class: Button with text: ASSIGN"); // step app.Tap(x => x.Class("RadioButton")); app.Tap(x => x.Class("RadioButton").Index(1)); app.Screenshot("Long press on view with class: RadioButton"); // step app.Tap(x => x.Text("DONE")); app.Screenshot("Long press on view with class: Button with text: DONE"); // step app.Tap(x => x.Text("DONE")); app.Screenshot("Tapped on view with class: Button with text: DONE"); app.Back(); app.Screenshot("panels list"); for (int i = 0; i < 6; i++) { app.Back(); if ((app.Query(x => x.Marked("Do you really want to exit?"))).Length > 0) { break; } else { continue; } } app.Screenshot("about to exit"); app.Tap(x => x.Id("button1")); app.Screenshot("app closed"); BeforeEachTest(); app.Screenshot("reopen"); app.Flash("first"); app.Screenshot("first flash"); Assert.AreEqual(app.Query(e => e.Class("FormsTextView").Index(1))[0].Text, "first"); app.Screenshot("assertion 1"); Assert.AreEqual(app.Query(e => e.Class("FormsTextView").Index(2))[0].Text, "germany"); app.Screenshot("assertion 2"); Assert.AreEqual(app.Query(e => e.Class("FormsTextView").Index(6))[0].Text, "Commercial"); app.Screenshot("assertion 3"); app.TouchAndHold(x => x.Text("first")); app.Screenshot("Long press on view with class: Platform_DefaultRenderer"); for (int i = 0; i < 20000; i++) { ; } Assert.AreEqual(app.Query(e => e.Class("FormsTextView").Index(2))[0].Text, "two"); app.Screenshot("assertion 4"); Assert.AreEqual(app.Query(e => e.Class("FormsTextView").Index(3))[0].Text, "second floor"); app.Screenshot("assertion 5"); Assert.AreEqual(app.Query(e => e.Class("FormsTextView").Index(5))[0].Text, "4"); app.Screenshot("assertion 6"); Assert.AreEqual(app.Query(e => e.Class("FormsTextView").Index(7))[0].Text, "20"); app.Screenshot("assertion 7"); Assert.AreEqual(app.Query(e => e.Class("FormsTextView").Index(12))[0].Text, "dxc"); app.Screenshot("assertion 8"); Assert.AreEqual(app.Query(e => e.Class("FormsTextView").Index(13))[0].Text, "first floor"); app.Screenshot("assertion 9"); Assert.AreEqual(app.Query(e => e.Class("FormsTextView").Index(15))[0].Text, "2"); app.Screenshot("assertion 10"); }