public void AfterEachTest() { // Start the application app = ConfigureApp.Android.StartApp(); // Delete recently created city if still existing // Depending on your test configuration and environment, ConfigureApp.Android.StartApp(); sometimes // deployes a complete new package of the app. In this case, no cleanup work is needed. app.WaitForElement(x => x.Id("textView1")); var city = app.Query(x => x.Text(testCityName)).FirstOrDefault(); if (city != null) { // Delete the recently created city app.Tap(x => x.Text(testCityName)); app.WaitForElement(x => x.Class("OverflowMenuButton")); app.Tap(x => x.Class("OverflowMenuButton")); app.Tap(x => x.Class("TextView").Index(0)); // Edit button app.WaitForElement(x => x.Id("action_delete_city"), "Delete city button never appeared..."); app.Tap(x => x.Id("action_delete_city")); app.Tap(x => x.Id("button1")); // Check if city has been deleted successfully var results = app.Query(x => x.Text(testCityName)); Assert.IsFalse(results.Any()); } }
public void BeforeEachTest() { app = ConfigureApp.Android.StartApp (); Func<AppQuery, AppQuery> menu_button_query = e => e.Id("menu_button"); app.Tap (menu_button_query); Func<AppQuery, AppQuery> search_button = e => e.Text ("Search"); app.Tap (search_button); }
public void ClickingButtonTwiceShouldChangeItsLabel() { Func <AppQuery, AppQuery> MyButton = c => c.Button("myButton"); app.Tap(MyButton); app.Tap(MyButton); AppResult[] results = app.Query(MyButton); app.Screenshot("Button clicked twice."); Assert.AreEqual("2 clicks!", results[0].Text); }
public void Login() { app.Screenshot("Launch"); app.Tap(q => q.Id("login")); app.WaitForElement(q => q.Id("sign_in_button")); app.Screenshot("Sign In"); app.Tap(q => q.Id("sign_in_button")); System.Threading.Thread.Sleep(1000); app.Screenshot("Sign In Dialog"); }
public void ViewSessions() { app.Screenshot("First Screen"); app.Tap(x => x.Text("Not Now")); app.Screenshot("Skip Sign In"); app.Tap(x => x.Class("ImageButton")); app.Screenshot("Open Menu Bar"); app.Tap("Sessions"); app.Screenshot("Tap Sessions"); app.WaitForElement("No Sessions Found"); app.Screenshot("Load Sessions Page"); }
public void XmlBanner() { app.Screenshot("Launch"); app.Tap(q => q.Text("Banner in XML")); app.Screenshot("Tap Xml"); app.WaitForElement(q => q.Class("AdView"), timeout: TimeSpan.FromSeconds(10)); app.Screenshot("Ad"); }
public void SignIn() { app.WaitForElement(q => q.Id("button_sign_in")); app.Screenshot("Launch"); app.Tap(q => q.Id("button_sign_in")); app.WaitForElement(q => q.Id("button_camera")); app.Screenshot("Signed In"); }
public void TestTapOnceOnNextButtonIncrementCounter() { // Tap on 'Next' button app.Tap(c => c.Marked("Button")); // Get the text view var currentText = app.Query(x => x.Id("Switcher").Child(0).Invoke("getText")); // Checks if the text is '1' Assert.NotNull(currentText); Assert.AreEqual(currentText[0], "1"); }
public void Autocomplete() { app.Screenshot("Launch"); app.Tap(q => q.Id("textSearch"));; app.EnterText("the");; app.Screenshot("Enter Text"); app.WaitForElement(q => q.Id("text1")); app.Screenshot("Autocomplete"); }
public void App_error_login() { app.Screenshot("First screen."); app.EnterText("et_login", "Altamir"); app.EnterText("et_pass", "123456"); app.DismissKeyboard(); app.Tap("bt_logar"); app.WaitForElement(c => c.Text("Login ou senha incorreto!"), "Wait msg error ", TimeSpan.FromSeconds(10)); app.Screenshot("Error login"); }
public void NearbyAdvertise() { app.Screenshot("Launch"); var beforeLength = GetDebugTextLength(); app.Tap(q => q.Id("button_advertise")); System.Threading.Thread.Sleep(3000); app.Screenshot("Advertise"); Assert.Greater(GetDebugTextLength(), beforeLength); }
public void SignIn() { app.Tap(x => x.Class("FormsTextView").Text("SIGN IN")); app.Screenshot("Tapped on view FormsTextView with Text: 'SIGN IN'"); app.Tap(x => x.Class("WebView").Id("agentWebView").Css("#cred_userid_inputtext")); app.EnterText(x => x.Class("WebView").Id("agentWebView").Css("#cred_userid_inputtext"), "*****@*****.**"); app.Tap(x => x.Class("WebView").Id("agentWebView").Css("#cred_password_inputtext")); app.EnterText(x => x.Class("WebView").Id("agentWebView").Css("#cred_password_inputtext"), "P@ssword"); app.Screenshot("Username and password entered"); app.Tap(x => x.Class("WebView").Id("agentWebView").Css("#cred_sign_in_button")); app.Screenshot("Tapped on sign in button"); }
public void NewTest() { app.Tap(x => x.Id("onboarding_get_started")); app.Screenshot("Tapped on view with class: AppCompatButton"); app.Tap(x => x.Id("capsule_deals")); app.Screenshot("Tapped on view with class: AppCompatTextView"); app.Tap(x => x.ClassFull("android.support.design.widget.TabLayout$TabView").Index(1)); app.Screenshot("Tapped on view with class: TabLayout$TabView"); app.Tap(x => x.Id("imageview_deals").Index(1)); app.Screenshot("Tapped on view with class: RemoteImageView"); app.Tap(x => x.Id("button_bin_inline")); app.Screenshot("Tapped on view with class: TextImageButton"); app.EnterText(x => x.Id("edit_text_username"), "johndoe"); }
public void TamperedEnabled_CappuccinoTest() { app.Tap(x => x.Marked("DrinkType")); app.Screenshot("Tapped Drink Type"); app.Tap(x => x.Marked("Cappuccino")); app.Screenshot("Tapped on Cappuccino"); app.DismissKeyboard(); app.Screenshot("Dismissed Keyboard"); var result = app.Query("Tamered").First(); Assert.IsTrue(result.Enabled, "Tampered is enabled"); }
public void TapRandomButtonsTest() { var rand = new Random(); for (var i = 0; i < 10; i++) { var buttons = _app.Query(c => c.Button()).ToArray(); if (!buttons.Any()) { break; } try { _app.Tap(c => c.Button().Index(rand.Next(0, buttons.Length - 1))); } catch { // Fail silently, this is probably due to the number of buttons on the page being reduced between // the app.Query() and the app.Tap(). } var word = i == 0 ? "a" : "another"; _app.Screenshot($"Tapped {word} random button"); Thread.Sleep(3000); // This should allow any animations to complete in most cases } }
public void RunBenchmarkHelper(string benchmark) { var assembly = Assembly.GetExecutingAssembly(); using (Stream stream = assembly.GetManifestResourceStream("AndroidAgent.UITests.params.json")) { using (StreamReader reader = new StreamReader(stream)) { dynamic json = JsonConvert.DeserializeObject(reader.ReadToEnd()); string githubAPIKey = json.githubAPIKey; string httpAPITokens = json.httpAPITokens; string machineName = json.machineName; string runSetId = json.runSetId; string configName = json.configName; app.Screenshot("init"); clearAndSetTextField("benchmark", benchmark); clearAndSetTextField("githubAPIKey", githubAPIKey); clearAndSetTextField("httpAPITokens", httpAPITokens); clearAndSetTextField("machineName", machineName); clearAndSetTextField("runSetId", runSetId); clearAndSetTextField("configName", configName); app.Tap(c => c.Marked("myButton")); app.Screenshot("after tap"); app.WaitForNoElement(c => c.Marked("myButton").Text("running"), "Benchmark is taking too long", TimeSpan.FromMinutes(179)); Assert.AreEqual(app.Query(c => c.Marked("myButton")).First().Text, "start"); app.Screenshot("after benchmark"); } } }
public void AppDidLaunch() { app.WaitForElement(c => c.Id("fab")); app.Tap(c => c.Id("fab")); Assert.AreNotEqual("ERROR!", app.Query(c => c.Id("textView1"))[0].Text); app.Screenshot("App launched"); }
public void CatchCrash() { app.WaitForElement(q => q.Id("crashButton")); app.Screenshot("Launch"); app.Tap(q => q.Id("catchCrashCheckBox")); app.Screenshot("Catch Crash"); app.Tap(q => q.Id("crashButton")); app.WaitForElement(q => q.Id("crashButton")); app.Screenshot("Caught Crash"); }
public void VerticalPhrases() { app.Tap(x => x.Class("TextView").Index(1)); app.Tap(x => x.Class("TextView").Index(6)); app.Tap(x => x.Class("TextView").Index(11)); app.Tap(x => x.Class("TextView").Index(16)); app.Screenshot("4 in a column are selected"); app.Tap(x => x.Class("TextView").Index(21)); app.WaitForElement(x => x.Id("alertTitle")); var results = app.Query(x => x.Id("alertTitle")); Assert.AreEqual("You won, congratulations!", results [0].Text); app.Screenshot("A Congratulating dialog should appear"); }
public void TextView_Shows_Up_When_Button_Clicked() { app.Tap(c => c.Id("buttonShow")); app.Screenshot("Button Pressed"); AppResult[] result = app.Query(c => c.Id("textViewShow")); Assert.IsTrue(result.Any(), "TextView not displayed"); }
public void AppLaunches() { app.Repl(); app.Screenshot("First screen."); app.Screenshot(""); //app.Tap() app.Tap("NoResourceEntry-11"); app.Tap("NoResourceEntry-18"); app.EnterText("5541380221"); app.Tap("NoResourceEntry-21"); app.EnterText("drfgdfgdf"); app.Tap("NoResourceEntry-22"); app.Screenshot("First screen."); }
public void BeforeEachTest() { // Start the application app = ConfigureApp.Android.StartApp(); // Create a new city app.WaitForElement(x => x.Id("action_add_city")); app.Tap(x => x.Id("action_add_city")); app.EnterText(x => x.Id("addEditCityName"), testCityName); app.EnterText(x => x.Id("addEditCityZip"), testCityZip); app.Tap(x => x.Id("action_add_city_confirm")); // Check if city has been created successfully var results = app.Query(x => x.Text(testCityName)); Assert.IsTrue(results.Any()); }
public void numberToShort() { app.WaitForElement(invoerveldcardnummer); app.Screenshot("After starting application"); app.EnterText(invoerveldcardnummer, shortnumber); app.WaitForElement(e => e.Text(shortnumber), "number not in textfield"); app.Screenshot("number entred"); app.Tap(validatieknop); app.WaitForElement(errormessageappears, "no error message"); app.Screenshot("After doing the validation"); var toshort = app.Query(textistoshortmessage).SingleOrDefault(); Assert.IsNotNull(toshort); }
public void CollectSymbols() { _app.Tap(q => q.Id("btnUpload")); var totalWaitTimeSeconds = 40 * 60; var retryCounter = 200; var iterationTimeout = TimeSpan.FromSeconds(totalWaitTimeSeconds / retryCounter); while (true) { try { _app.WaitForElement(query => query.Id("done_text"), timeout: iterationTimeout); _app.Screenshot("💯"); break; } catch (Exception e) when(e.InnerException is TimeoutException) { if (--retryCounter == 0) { _app.Screenshot("Timeout"); throw; } // Check if it failed var result = _app.Query(p => p.Id("alertTitle")); if (result?.Any() == true) { _app.Screenshot("Error"); throw new Exception("Error modal found, app errored."); } } } }
public void AppLaunches() { app.Screenshot("First screen."); app.EnterText(c => c.Marked("WeightText"), "70"); app.EnterText(c => c.Marked("HeightText"), "1.8"); app.Tap(c => c.Marked("Calculate")); app.WaitForElement(c => c.Marked("ResultText").Text("21.6")); }
public void Toast_Displayed_If_CallButton_Pressed_With_EmptyTextBox() { app.Screenshot("App Started"); app.Tap(c => c.Id("CallButton")); app.Screenshot("Call Button Pressed"); AppResult[] result = app.Query(c => c.Marked("Please provide number")); Assert.IsTrue(result.Any(), "Toast not displayed"); }
public void CreditCardNumber_TooShort_DisplayErrorMessage() { app.WaitForElement(c => c.Marked("action_bar_title").Text("Enter Credit Card Number")); app.EnterText(c => c.Marked("creditCardNumberText"), new string('9', 15)); app.Tap(c => c.Marked("validateButton")); app.WaitForElement(c => c.Marked("errorMessagesText").Text("Credit card number is too short.")); }
public HomePage GoToHomePage() { for (var i = 0; i < 5; i++) { app.Tap(nextButton); } return(new HomePage(app)); }
public void SpecFlow_VerkenHoofdscherm() { int lengte1 = 0; int lengte2 = 0; app.WaitForElement(c => c.Id("action_bar")); app.Flash(c => c.Id("plusButton")); app.Tap(c => c.Id("plusButton")); app.Tap(c => c.Id("plusButton")); app.Tap(c => c.Id("plusButton")); app.Flash(c => c.Id("minButton")); app.Tap(c => c.Id("minButton")); app.Tap(c => c.Id("minButton")); app.Flash(c => c.Id("route1Button")); app.Tap(c => c.Id("route1Button")); var resultlengte1 = app.Query(c => c.Id("lengte").Invoke("getText")); if (resultlengte1[0].ToString() != null) { lengte1 = Int32.Parse(resultlengte1[0].ToString()); } app.Flash(c => c.Id("route2Button")); app.Tap(c => c.Id("route2Button")); app.Flash(c => c.Id("lengte")); var resultlengte2 = app.Query(c => c.Id("lengte").Invoke("getText")); if (resultlengte2[0].ToString() != null) { lengte2 = Int32.Parse(resultlengte2[0].ToString()); } //bij 11 punten is de lengte soms gelijk Assert.GreaterOrEqual(lengte2, lengte1); }
public void UpdateFirstName() { app.Screenshot("App Started"); app.Tap(x => x.Id("setupDataPartitionPhraseField")); app.EnterText("UseLocalDataSource"); app.Screenshot("Entered data parition phrase"); app.Tap(x => x.Id("setupContinueButton")); app.WaitForElement(x => x.Marked("Armstead, Evan")); Thread.Sleep(3000); // wait a few seconds for list images to fully load app.Screenshot("Display list"); app.Tap(x => x.Marked("Armstead, Evan")); Thread.Sleep(3000); // wait 3 seconds to give map time to fully render app.Screenshot("Detail screen"); app.Tap(x => x.Id("acquaintanceEditButton")); app.Screenshot("Edit screen"); app.ScrollDownTo("First"); app.Tap(x => x.Id("firstNameField")); app.ClearText(); app.Screenshot("Cleared first name field"); app.EnterText("Jonathan"); app.DismissKeyboard(); app.Screenshot("Altered value of first name field"); app.Tap(x => x.Id("acquaintanceSaveButton")); Thread.Sleep(3000); // wait 3 seconds to give map time to fully render app.Screenshot("Saved changes, navigated to detail screen, first name updated"); app.Tap(x => x.Marked("Navigate up")); app.Screenshot("First name updated on list screen"); }
public void AppLaunches() { app.WaitForElement(x => x.Text(("Use my phone number"))); app.Flash(x => x.Text("Use my phone number")); app.Tap(x => x.Text("Use my phone number")); app.Screenshot("Phone Number Field"); app.Tap(x => x.Id("dgts__countryCode")); app.Screenshot("Country Code Field"); app.ScrollDownTo((x => x.Id("text1").Text("United States +1"))); app.Tap(x => x.Id("text1").Text("United States +1")); app.Screenshot("Scrolling down to United States Field"); app.EnterText("4087188819"); app.Screenshot("Phone number Field"); app.Tap((x => x.Text("Continue"))); }
public void Video() { app.Screenshot("Launch"); app.Tap(q => q.Text("Dark Theme")); app.Screenshot("Dark Theme"); app.Tap(q => q.Text("Cats with hats")); app.Screenshot("Cats with hats"); if (app.Query(q => q.Class("MediaRouteButton")).Any()) { app.WaitForElement(q => q.Class("MediaRouteButton")); app.Tap(q => q.Class("MediaRouteButton")); app.WaitForElement(q => q.Id("media_route_list")); app.Screenshot("Connect to device"); app.Back(); app.WaitForNoElement(q => q.Id("media_route_list")); } }
public void AnonymousAuth() { app.WaitForElement(q => q.Text("AnonymousAuthActivity")); app.Screenshot("Launch"); app.Tap(q => q.Text("AnonymousAuthActivity")); app.WaitForElement(q => q.Text("Anonymous Sign In")); app.Tap(q => q.Id("button_anonymous_sign_in")); System.Threading.Thread.Sleep(500); app.WaitForNoElement(q => q.Id("progress")); app.Screenshot("Signed In"); }
public void BeforeEachTest() { app = ConfigureApp.Android.StartApp (); app.Screenshot ("Given the app is loaded"); app.Tap (x => x.Button ("btn_play")); app.WaitForElement (x => x.Id ("tv_bingoItem")); var results = app.Query (x => x.Id ("tv_bingoItem")); Assert.AreEqual (25, results.Length); app.Screenshot ("25 items should be shown"); }
public StartPage(AndroidApp app) : base(app) { app.Tap(GetServices); //Only for emulator app.WaitForElement(JoinButton); }