Пример #1
0
        public void DripCoffeeTest()
        {
            app.Screenshot("When I run the app");

            app.ClearText("SubTotal");
            app.Screenshot("When I clear text");

            app.EnterText("SubTotal", "4.00");
            app.Screenshot("And Enter $4.00");

            var total = app.Query("Total").First();
            var tip   = app.Query("TipAmount").First();

            Assert.AreEqual(total.Text, "Total: $4.50");
            Assert.AreEqual(tip.Text, "Tip: $0.50");


            app.Screenshot("Total is $4.50 with $0.50 tip");
        }
Пример #2
0
        public void TestEditDataEntry()
        {
            AddDataEntry(0, "MyEditTest");

            AppResult[] res = app.Query(x => x.Class("AppCompatButton"));
            app.TapCoordinates(res[0].Rect.CenterX, res[0].Rect.CenterY);
            app.TapCoordinates(0, 0);

            app.Tap("nameEntry_Container"); // tap name entry container
            app.ClearText();                // clear text input
            app.EnterText("NewEditTest");   // input new title
            app.Back();                     // close keyboard

            TapUpperRightButton();

            // Verify edit has been made
            Assert.AreEqual((app.Query(c => c.Class("FormsTextView")))[0].Text, "NewEditTest");
            Assert.AreEqual((app.Query(c => c.Class("FormsTextView")))[1].Text, "Point");
        }
Пример #3
0
        public static void NavigateTo(this IApp app, string text, string visual)
        {
            app.WaitForElement("SearchBar");
            app.ClearText(q => q.Raw("* marked:'SearchBar'"));
            app.EnterText(q => q.Raw("* marked:'SearchBar'"), text);
            app.DismissKeyboard();

            if (!String.IsNullOrWhiteSpace(visual))
            {
                app.ActivateContextMenu($"{text}AutomationId");
                app.Tap("Select Visual");
                app.Tap("Material");
            }
            else
            {
                app.Tap(q => q.Raw(goToTestButtonQuery));
            }

            app.WaitForNoElement(o => o.Raw(goToTestButtonQuery), "Timed out waiting for Go To Test button to disappear", TimeSpan.FromMinutes(1));
        }
Пример #4
0
        public void WeatherTest()
        {
            app.Screenshot("On the Main Page");

            app.ClearText("LocationEntry");

            app.EnterText("LocationEntry", "Toronto");
            app.Screenshot("Entering Toronto as our Location");

            app.Screenshot("Pressing Get Weather button");

            app.Tap("GetWeatherBtn");

            app.WaitForElement(x => x.Marked("ConditionLabel"), "Timed out waiting for weather data to return");

            app.Screenshot("Retreieved weather data");

            app.Tap("Forecast");

            app.Screenshot("Viewing Forecast");
        }
Пример #5
0
        public void CreateNewUserAndLogin()
        {
            app.Screenshot("Application Start");
            CreateNewUser();

            app.WaitFor(x => x.Marked("usernameEntry"));
            app.ClearText("usernameEntry");

            app.WaitThenEnterText(x => x.Marked("usernameEntry"), username, "Enter username: "******"passwordEntry"), password, "Enter password: "******"loginButton"), "Pressed 'Log In' Button");

            Assert.AreEqual(0, app.Query(x => x.Marked("loginPage")).Length);
        }
Пример #6
0
        public static void performLogin(IApp app, String Username, String Password, string testname)
        {
            app.ClearText(x => x.Marked(Core.OR["UserNameTextBox"]));
            app.Tap(x => x.Marked(Core.OR["UserNameTextBox"]));
            app.EnterText(x => x.Marked(Core.OR["UserNameTextBox"]), Username);

            app.WaitForElement(x => x.Text("Log in to My Vodacom"), timeout: TimeSpan.FromSeconds(30));

            app.WaitForElement(x => x.Text(Core.OR["Username"]));
            app.WaitForElement(x => x.Text(Core.OR["Password"]));
            app.Tap(x => x.Marked(Core.OR["PasswordTextBox"]).Index(1));
            // app.DoubleTapCoordinates(274, 930);
            // app.EnterText(Password);
            app.EnterText(x => x.Marked(Core.OR["PasswordTextBox"]).Index(1), Password);
            app.DismissKeyboard();

            Core.TakeScreenShot(app, "Login Details", testname);
            try
            {
                app.Tap(x => x.Marked(Core.OR["LoginButton"]));
            }
            catch
            {
                app.Tap(x => x.Text("Log in"));
            }
            try
            {
                app.ScrollDown();
                app.WaitForElement(x => x.Marked(Core.OR["Proceed"]), timeout: TimeSpan.FromSeconds(30));
                app.Tap(x => x.Marked(Core.OR["Proceed"]));


                app.WaitForElement(x => x.Text("Proceed to My Vodacom"), timeout: TimeSpan.FromSeconds(30));
                app.Tap(x => x.Text("Proceed to My Vodacom"));
            }
            catch
            {
            }
            app.WaitForElement(x => x.Marked("Quick buy Button"), timeout: TimeSpan.FromSeconds(30));
        }
Пример #7
0
        public void UsernameSavedAfterRestart()
        {
            _app = AppInitializer.StartApp(_platform);

            _app.WaitForElement("UsernameEntry", "Failed to start app", TimeSpan.FromSeconds(10));

            _app.ClearText("UsernameEntry");

            var randomUsername = Guid.NewGuid().ToString();

            _app.EnterText(randomUsername);

            _app.DismissKeyboard();

            // Restart app
            _app = AppInitializer.StartApp(_platform, AppDataMode.DoNotClear);

            _app.WaitForElement("UsernameEntry", "Failed to start app second time", TimeSpan.FromSeconds(10));

            _app.WaitForElement(e => e.Marked("UsernameEntry").Text(randomUsername), "Didn't find correct username",
                                TimeSpan.FromSeconds(1));
        }
Пример #8
0
        public void Register(string email, string firstName)
        {
            app.Screenshot("When the app launches");
            app.WaitForElement("emailEntry");
            app.EnterText("emailEntry", email);

            app.Screenshot("and I enter my email address");
            app.DismissKeyboard();

            app.ClearText("firstNameEntry");
            app.EnterText("firstNameEntry", firstName);
            app.DismissKeyboard();

            app.Screenshot("and I enter my first name");
            app.Tap("continueButton");

            app.Screenshot("and I wait for data to load");
            Thread.Sleep(10000);

            app.WaitForNoElement("loadingMessage");
            app.Screenshot("I will see the dashboard");
        }
Пример #9
0
        public void Search_Book_Results()
        {
            //app.Repl();
            string searchEntryId  = "QueryText";
            string searchButtonId = "SearchButton";

            //AppResult[] results = app.WaitForElement(c => c.Marked("Search"));
            //Search Label
            app.WaitForElement(c => c.Marked("SearchLabel"));
            app.Screenshot("Home Screen");

            //QueryEntry
            app.ClearText(c => c.Marked(searchEntryId));
            app.EnterText(c => c.Marked(searchEntryId), "cats");
            app.Screenshot("Search Query Text Typed");

            //Book Results
            app.Tap(c => c.Marked(searchButtonId));
            app.WaitForElement(c => c.Text("Title: Cats"));
            app.Screenshot("Books Result");
            //Assert.IsTrue(results.Any());
        }
Пример #10
0
        public void TestDecksPageAndDeckEdit()
        {
            app.Tap(x => x.Marked("DecksPage"));
            app.Screenshot("Decks Page");

            app.Tap(x => x.Marked("New Deck"));
            app.Screenshot("New Deck Faction Select");

            app.Tap(x => x.Text("ECLIPSE"));
            app.Screenshot("New Eclipse Deck Edit");

            app.ClearText(x => x.Class("EntryEditText").Text("New ECLIPSE Deck"));
            app.EnterText(x => x.Class("EntryEditText"), "Test Cloud Deck");
            app.Tap(x => x.Marked("Done"));
            app.Screenshot("New Eclipse Deck Saved");

            app.Tap(x => x.Marked("Edit Deck"));
            app.Screenshot("Deck Card Edit");

            app.Tap(x => x.Text("+"));
            app.Screenshot("Champion added");

            app.Back();
            app.Screenshot("Deck detail with champion");

            app.Tap(x => x.Marked("Undo"));
            app.Screenshot("Deck Undo Prompt");

            app.Tap(x => x.Id("button1"));
            app.Screenshot("Deck Undo - Champion Removed");

            app.Back();
            app.Tap(x => x.Marked("DeckContextMenu"));
            app.Screenshot("Deck Context Menu");

            app.Tap(x => x.Id("text1"));
            app.Screenshot("Deck Deleted");
        }
Пример #11
0
 public void AddingRoomBox()
 {
     app.Tap(x => x.Text("Menu"));
     app.Tap(x => x.Text("Create a Room"));
     app.SwipeRightToLeft();
     app.SwipeRightToLeft();
     app.SwipeRightToLeft();
     app.Tap(x => x.Class("EntryEditText").Index(4));
     app.EnterText(x => x.Class("EntryEditText").Index(4), "room one");
     app.PressEnter();
     app.ScrollDownTo("Add Room");
     app.Tap(x => x.Text("Add Room"));
     app.SwipeLeftToRight();
     app.SwipeLeftToRight();
     app.Tap(x => x.Class("EntryEditText").Index(4));
     app.EnterText(x => x.Class("EntryEditText").Index(4), "box n");
     app.PressEnter();
     app.ScrollDownTo("Add Box");
     app.Tap(x => x.Text("Add Box"));
     app.Tap(x => x.Class("EntryEditText").Index(6));
     app.EnterText(x => x.Class("EntryEditText").Index(6), "room one");
     app.PressEnter();
     app.Tap(x => x.Text("Add Box"));
     app.Tap(x => x.Text("Add an Item (Optional)"));
     app.Tap(x => x.Class("ListView"));
     app.ScrollUp();
     app.Tap(x => x.Class("EntryEditText").Index(5));
     app.EnterText(x => x.Class("EntryEditText").Index(5), "ant");
     app.PressEnter();
     app.ScrollDownTo("room one");
     app.ScrollDownTo("Add Box");
     app.Tap(x => x.Text("Add Box"));
     app.Tap(x => x.Text("room one"));
     app.ClearText(x => x.Class("EntryEditText").Text("room one"));
     app.EnterText(x => x.Class("EntryEditText").Text("room one"), "room1");
     app.PressEnter();
     app.Tap(x => x.Text("Add Box"));
 }
        public void EditorDemoPage_Test()
        {
            var mainPage = new MainPageObject(app);

            mainPage.TapTableTextCellByName("Editor (multiple lines)");

            var marked = "EditorDemoPage.Editor";

            //EnterText
            var longText =
                @"abcdefg
hijk
lmn
opq
rstu
vwxyz";

            app.EnterText(x => x.Marked(marked), longText);
            app.DismissKeyboard();

            //ClearText
            app.ClearText(x => x.Marked(marked));
            app.DismissKeyboard();
        }
    public void CoverageTest()
    {
        String testname = MethodBase.GetCurrentMethod().Name;

        Core.EnvPicker(app, testname);
        Core.SoftwareUpdate(app, testname);
        Core.OTPBypass(app, testname);
        try
        {
            Console.WriteLine(testname);
            Core.performLogin(app, Core.dictProfiles["nxtlvlusername"], Core.dictProfiles["GlobalPassword"], testname);
            Core.WaitForLoadingScreen(app);
            Core.Menu(app, testname);

            Thread.Sleep(900);

            app.WaitForElement(x => x.Marked("Help"), timeout: TimeSpan.FromSeconds(5));
            app.Tap(x => x.Marked("Help"));

            try
            {
                app.WaitForElement(x => x.Marked("Coverage Maps"), timeout: TimeSpan.FromSeconds(5));
                app.Tap(x => x.Marked("Coverage Maps"));

                var i = app.Query(c => c.WebView());

                Console.WriteLine(i);
                //interacting with Webview
                app.Tap(x => x.XPath("//*[@id=\"txtSearch1\"]"));
                app.ClearText();
                app.EnterText("Midrand");
                Thread.Sleep(5000);
                Core.TakeScreenShot(app, "Searched midrand", testname);

                //tap on an empty spot
                app.TapCoordinates(365, 874);

                Thread.Sleep(500);

                //tap search button
                app.TapCoordinates(304, 454);

                //tap midrand from search results
                Core.TakeScreenShot(app, "Midrand Pin", testname);
                try
                {
                    app.Tap(x => x.XPath("//*[@id=\"searchResultsDiv\"]/div[1]"));
                }
                catch { }
                //Logout
                Core.Logout(app, testname);
            }
            catch
            {
                //For IOS no  coverage map
                app.Tap(x => x.Text(Core.OR["help"]));
                Core.TakeScreenShot(app, "Help logout", testname);

                app.Tap(x => x.Text(Core.OR["Logout"]));
            }
        }
        finally
        {
            Core.TakeScreenShot(app, "Last Screenshot", testname);
        }
    }
        public void TableViewDemoPage_Test()
        {
            var mainPage = new MainPageObject(app);

            mainPage.TapTableTextCellByName("TableView for a form");


            // TextCell
            var textCellText   = app.Query(x => x.Marked("Text Cell"));
            var textCellDetail = app.Query(x => x.Marked("With Detail Text"));


            // Entry Cell

            // Enter text.
            var inputText = "This is text for test.";

            if (platform == Platform.Android)
            {
                app.EnterText(x => x.Class("EntryCellView").Child(1), inputText);
                app.EnterText(x => x.Class("EntryCellView").Child("EntryCellEditText"), inputText);

                app.DismissKeyboard();
            }
            else if (platform == Platform.iOS)
            {
                app.EnterText(x => x.Class("Xamarin_Forms_Platform_iOS_EntryCellRenderer_EntryCellTableViewCell").Child(0).Child(0), inputText);
                app.EnterText(x => x.Class("Xamarin_Forms_Platform_iOS_EntryCellRenderer_EntryCellTableViewCell").Child("UITableViewCellContentView").Child("UITextField"), inputText);
                app.DismissKeyboard();
            }

            System.Threading.Thread.Sleep(3000);


            // Clear text.
            if (platform == Platform.Android)
            {
                app.ClearText(x => x.Class("EntryCellView").Child(1));
            }
            else if (platform == Platform.iOS)
            {
                app.ClearText(x => x.Class("Xamarin_Forms_Platform_iOS_EntryCellRenderer_EntryCellTableViewCell").Child(0).Child(0));
            }

            // SwitchCell
            if (platform == Platform.Android)
            {
                app.Query(x => x.Class("SwitchCellView").Class("Switch").Invoke("setChecked", true));
            }
            else if (platform == Platform.iOS)
            {
                app.Query(x => x.Class("Xamarin_Forms_Platform_iOS_CellTableViewCell").Class("UISwitch").Invoke("setOn:animated", true));
            }

            System.Threading.Thread.Sleep(3000);


            // ImageCell
            if (platform == Platform.Android)
            {
                app.Query(x => x.Class("TextCellRenderer_TextCellView").Class("ImageView"));
            }
            else if (platform == Platform.iOS)
            {
                app.Query(x => x.Class("Xamarin_Forms_Platform_iOS_CellTableViewCell").Child("UITableViewCellContentView").Class("UIImageView"));
            }
        }
Пример #15
0
 public void EmptyProfile()
 {
     EditProfilePage();
     app.ClearText("First");
     app.ClearText("Last");
     app.ClearText("EmailId");
     app.ClearText("Phone");
     app.ClearText("AddressId");
     app.ScrollDownTo("AboutMe");
     app.ClearText("ProfileImage");
     app.ClearText("ZipId");
     app.ScrollDownTo("Submit");
     app.TapCoordinates(551, 2200);//Removes the keyboard
     app.ScrollTo("Submit");
     app.Tap("Submit");
     app.WaitForElement("Username", "TestUser1");
 }
Пример #16
0
        public void AddNewItem()
        {
            app.Tap("Add");
            app.ClearText("NewItemPage.Title");
            app.EnterText("NewItemPage.Title", "ジョギングをする");

            // Picker
            var         date  = DateTime.Now.AddDays(15);
            CultureInfo enus  = new CultureInfo("en-US");
            var         month = enus.DateTimeFormat.GetMonthName(date.Month);

            var mark = "NewItemPage.DatePicker";

            if (platform == Platform.Android)
            {
                app.Tap(x => x.Marked(mark));

                //Wait for DatePicker animation to completed
                app.WaitForElement(x => x.Class("DatePicker"));

                //Invoke updateDate() method on displayed DatePicker
                app.Query(x => x.Class("DatePicker").Invoke("updateDate", date.Year, date.Month - 1, date.Day));

                //Tap the ok button to close the DatePicker dialogue
                app.Tap(x => x.Id("button1")); //Ok Button in DatePicker Dialogue
            }
            else if (platform == Platform.iOS)
            {
                //Activate the DatePicker
                app.Tap(x => x.Id(mark));

                // Wait for DatePicker animation to completed
                app.WaitForElement(x => x.Class("UIPickerView"));

                // Scroll DatePicker items
                string iOSTableViewClass = "UIPickerTableView";
                app.ScrollDownTo(z => z.Marked(month), x => x.Class(iOSTableViewClass).Index(0), strategy: ScrollStrategy.Auto);
                app.Tap(x => x.Text(month));

                app.ScrollDownTo(z => z.Marked(date.Day.ToString()), x => x.Class(iOSTableViewClass).Index(3), strategy: ScrollStrategy.Auto);
                app.Tap(x => x.Text(date.Day.ToString()));

                app.ScrollDownTo(z => z.Marked(date.Year.ToString()), x => x.Class(iOSTableViewClass).Index(6), strategy: ScrollStrategy.Auto);
                app.Tap(x => x.Text(date.Year.ToString()));

                app.Tap(x => x.Marked("Done")); // Tap button marked with "Done".
            }

            // Description
            app.ClearText("NewItemPage.Description");
            app.EnterText("NewItemPage.Description", "10km 走ること");

            // Dismiss keyboard
            app.DismissKeyboard();

            // Tap SAVE button
            app.Tap("Save");

            // Assertion
            app.WaitForElement(x => x.Marked("ItemsPage.TodoList"), timeout: TimeSpan.FromSeconds(10));
            app.ScrollDownTo(x => x.Marked("Item.Title").Text("ジョギングをする"), x => x.Marked("ItemsPage.TodoList"), timeout: TimeSpan.FromSeconds(10), strategy: ScrollStrategy.Auto);
            app.Screenshot("Add New Item");
        }
Пример #17
0
 public static void EnterText(Query textEntryQuery, string text, IApp app)
 {
     app.ClearText(textEntryQuery);
     app.EnterText(textEntryQuery, text);
     app.DismissKeyboard();
 }
Пример #18
0
 public void WhenIEnterZipCode(string zipCode)
 {
     app.ClearText(homeScreen.enterPostCode);
     app.EnterText(homeScreen.enterPostCode, zipCode);
 }
Пример #19
0
        public void AppLaunches()
        {
            AppResult[] result;

            #region 登入頁面
            result = app.WaitForElement((x => x.Marked("btnLoginCommand")));
            Assert.IsTrue(result.Any(), "無法進入到登入頁面");
            app.Screenshot("登入頁面");

            // 輸入錯誤的帳號與密碼
            app.EnterText(c => c.Marked("enyAccount"), "Vulcan");
            app.EnterText(c => c.Marked("enyPassword"), "Password123");
            app.Tap(c => c.Marked("btnLoginCommand"));
            result = app.WaitForElement((x => x.Marked("帳號與密碼輸入錯誤")));
            Assert.IsTrue(result.Any(), "無法看到對話窗 帳號與密碼輸入錯誤");
            app.Screenshot("帳號與密碼輸入錯誤");
            app.Tap(c => c.Marked("確定"));
            result = app.WaitForElement((x => x.Marked("btnLoginCommand")));
            Assert.IsTrue(result.Any(), "無法回到登入頁面");

            // 清除原先輸入的帳密
            app.ClearText(c => c.Marked("enyAccount"));
            app.ClearText(c => c.Marked("enyPassword"));

            // 輸入正確的帳密
            app.EnterText(c => c.Marked("enyAccount"), "1");
            app.EnterText(c => c.Marked("enyPassword"), "1");
            app.Tap(c => c.Marked("btnLoginCommand"));
            #endregion

            #region 搜尋高雄市的資料
            result = app.WaitForElement((x => x.Marked("創業空間清單")));
            Assert.IsTrue(result.Any(), "無法進入到應用程式首頁");
            app.Screenshot("首頁頁面");
            #endregion

            #region 搜尋高雄市的資料
            app.Tap("搜尋");
            result = app.WaitForElement((x => x.Marked("請選擇要篩選的縣市")));
            app.Screenshot("搜尋清單");
            app.Tap("高雄市");
            result = app.WaitForElement((x => x.Marked("高雄市")));
            Assert.IsTrue(result.Any(), "無法顯示縣市過濾清單");
            app.Screenshot("高雄市");
            #endregion

            #region 查看某筆資料明細
            app.Tap("大瀚放空間 Fun space");
            result = app.WaitForElement((x => x.Marked("所屬單位")));
            Assert.IsTrue(result.Any(), "無法顯示 大瀚高雄會議中心明細資料");
            app.Screenshot("資料明細頁面");
            app.Back();
            #endregion

            #region 捲動選取基隆市
            app.Tap("搜尋");
            app.WaitForElement((x => x.Marked("請選擇要篩選的縣市")));
            app.ScrollDownTo("嘉義縣", "臺北市", ScrollStrategy.Auto, 1, 1000, true, null);
            app.Tap("基隆市");
            app.WaitForElement((x => x.Marked("基隆市")));
            Assert.IsTrue(result.Any(), "無法顯示 過濾後的資料 for 基隆市");
            app.Screenshot("搜尋基隆市結果");
            #endregion

            #region 回到台北市
            app.Tap("搜尋");
            app.WaitForElement((x => x.Marked("請選擇要篩選的縣市")));
            app.Tap("臺北市");
            app.Screenshot("搜尋台北市結果");
            #endregion
        }
Пример #20
0
        public void JoinLeagueAndChallenge()
        {
            Func <AppQuery, AppQuery> menuButton = e => e.Marked("ic_more_vert_white");

            if (platform == Platform.Android)
            {
                menuButton = e => e.Marked("NoResourceEntry-0").Index(app.Query(ee => ee.Marked("NoResourceEntry-0")).Length - 1);
            }

            app.WaitForElement("authButton");
            app.Tap("When the app starts", "authButton");

            app.WaitForElement(e => e.Css("#Email"));
            app.EnterText(e => e.Css("#Email"), Keys.TestEmail, "And I enter my email address");
            app.DismissKeyboard();

            if (app.Query(e => e.Css("#next")).Length > 0)
            {
                Thread.Sleep(2000);                 //Can't wait for element because it will show but is disabled
                app.Tap(e => e.Css("#next"));
            }

            if (TestEnvironment.IsTestCloud)
            {
                Thread.Sleep(10000);                 //Need to wait for form fields to animate over
            }
            app.Tap(e => e.Css("#Passwd"));
            app.EnterText(e => e.Css("#Passwd"), Keys.TestPassword, "And I enter my super secret password");
            app.DismissKeyboard();

            app.Tap("And I click the Sign In button", e => e.Css("#signIn"));

            Thread.Sleep(2000);             //Can't wait here because the dialog is conditional
            if (app.Query(e => e.Button("Remember")).Length > 0)
            {
                app.Back();
            }

            Thread.Sleep(5000);
            if (app.Query(e => e.Css("#grant_heading")).Length > 0)
            {
                app.ScrollDownTo(e => e.Css("#submit_approve_access"));
                app.Tap("And I accept the terms", e => e.Css("#submit_approve_access"));
            }

            app.WaitForElement(e => e.Marked("aliasText"));
            app.ClearText(e => e.Marked("aliasText"));
            app.EnterText(e => e.Marked("aliasText"), "XTC Tester", "And I enter my alias");
            app.DismissKeyboard();

            app.Tap("And I save my profile", e => e.Marked("saveButton"));

            Thread.Sleep(3000);
            app.WaitForElement("continueButton");
            app.Tap("Continue button", e => e.Marked("continueButton"));

            app.WaitForElement(e => e.Marked("leagueRow"));
            app.Screenshot("Now I should see a list of leagues I have joined");

            //Available leagues
//			Helpers.OnAndroid("NoResourceEntry-0".Tap);
//			Helpers.OniOS("ic_add_white".Tap);

            if (platform == Platform.Android)
            {
                app.Tap("NoResourceEntry-0");
            }
            else if (platform == Platform.iOS)
            {
                app.Tap("ic_add_white");
            }

            //Thread.Sleep(5000);
            app.WaitForElement(e => e.Marked("leagueRow"));

            if (TestEnvironment.IsTestCloud)
            {
                Thread.Sleep(10000);                 //Need to wait for list images to load
            }
            app.Screenshot("Then I should see a list of leagues to join");

            Thread.Sleep(1000);
            app.Tap("leagueRow");

            app.WaitForElement("leaderboardButton");
            app.Screenshot("Then I should see a league I can join");

            app.Back(platform);
            app.Tap("Done");

            app.Screenshot("Athlete leagues listview");
            app.ScrollDownTo("Coin Flip");
            app.Tap("Coin Flip");

            app.WaitForElement("leaguePhoto");
            app.Screenshot("Then I should see the league details");
            app.ScrollDownTo("leaderboardButton");
            app.Tap("leaderboardButton");

            app.WaitForElement("memberItemRoot");
            app.Screenshot("Leaderboard listview");

            app.ScrollDownTo(e => e.Text("Rob TestCloud"));

            Thread.Sleep(1000);             //Let scrolling settle

            var result = app.Query(e => e.Text("Rob TestCloud"))[0];

            app.TapCoordinates(result.Rect.X, result.Rect.Y - 100);             //Select player above self
            app.WaitForElement("memberDetailsRoot");
            app.Screenshot("Member details page");

            app.ScrollDownTo("pastButton");
            app.Tap("Bottom of member details page", e => e.Marked("pastButton"));

            app.WaitForElement("challengeItemRoot");
            app.Screenshot("Challenge history page");

            if (TestEnvironment.IsTestCloud)
            {
                Thread.Sleep(10000);                 //Need to wait for list to load
            }
            if (app.Query("resultItemRoot").Length > 0)
            {
                app.Tap("resultItemRoot");
                app.WaitForElement("challengeRoot");
                app.Screenshot("Challenge result page");

                app.ScrollDownTo("winningLabel");
                app.Screenshot("Challenge result page bottom");
                app.Back(platform);
                app.Tap("Done");
            }
            else
            {
                app.Tap("Done");
            }

            app.Tap("challengeButton");
            app.Screenshot("Challenge date page");

            app.Tap("datePicker");
            app.Screenshot("Challenge date picker");

            DismissPicker();
            app.Screenshot("End");

            app.Tap("timePicker");
            app.Screenshot("Challenge time picker");

            DismissPicker();
            app.Tap("Cancel");

            app.Back(platform);
            app.Back(platform);

            app.Tap("challengeButton");
            app.Screenshot("Challenge date page");

            app.Tap("datePicker");
            app.Screenshot("Challenge date picker");
            DismissPicker();
            app.Screenshot("End");

            app.Tap("timePicker");
            app.Screenshot("Challenge time picker");
            DismissPicker();
            app.Tap("Cancel");

            app.Screenshot("Back");

            app.Tap(menuButton);
            app.Tap("Cowardly Abandon League");

            app.Screenshot("Confirm");
            app.Tap("No");

            app.Back(platform);
            app.Screenshot("End");

            app.Tap(menuButton);
            app.Screenshot("More options menu");
            app.Tap(e => e.Marked("About"), "About page");

            app.WaitForElement("aboutPage");
            app.ScrollDownTo("sourceButton", "aboutScroll");
            app.Screenshot("Bottom of About page");

            app.Tap("Done");

            app.Tap(menuButton);
            app.Tap(e => e.Marked("My Profile"), "Profile page");
            app.ScrollTo("saveButton");
            app.Tap("Saving profile", e => e.Marked("saveButton"));

            app.WaitForElement(e => e.Marked("leagueRow"));
            app.Screenshot("End of test");
        }
Пример #21
0
        public void AppLaunches()
        {
            string text_report = "TestReportStart/**************************/" + "\n" + "Step Name" + "\t" + "Parameter" + "\t" + "Action" + "\t" + "Locator type" + "\t" + "Locator" + "\t" + "Expected" + "\t" + "Observed" + "\n";
            string Path        = @"D:\Jayanth Frameworks\Xamarin_Framework\Framework_Xamarin\Sampleappforxamarinapp\Testreport.txt";

            File.WriteAllText(Path, String.Empty);
            File.AppendAllText(Path, text_report);

            string[] Testdata = File.ReadAllLines(@"D:\Jayanth Frameworks\Xamarin_Framework\Framework_Xamarin\Sampleappforxamarinapp\Testdata.txt");

            for (int i = 1; i <= Testdata.Length; i++)
            {
                string[] Sample      = Testdata[i].Split('\t');
                string   Stepname    = Sample[0].ToString();
                string   Parameter   = Sample[1].ToString();
                string   Action      = Sample[2].ToString();
                string   LocatorType = Sample[3].ToString();
                string   Locator     = Sample[4].ToString();
                string   EXpected    = Sample[5].ToString();
                string   Index       = Sample[6].ToString();
                string   obs_val     = "";
                string   stepdata    = "";

                try
                {
                    switch (Action)
                    {
                    case "Tap":

                        if (LocatorType == "Text")
                        {
                            int index = Int32.Parse(Index);

                            app.Screenshot(Stepname);
                            app.Tap(x => x.Text(Locator).Index(index));
                        }
                        if (LocatorType == "ID")
                        {
                            int index = Int32.Parse(Index);

                            app.Screenshot(Stepname);
                            app.Tap(x => x.Id(Locator).Index(index));
                        }
                        if (LocatorType == "Class")
                        {
                            int index = Int32.Parse(Index);

                            app.Screenshot(Stepname);
                            app.Tap(x => x.Class(Locator).Index(index));
                        }
                        if (LocatorType == "css")
                        {
                            int index = Int32.Parse(Index);

                            app.Screenshot(Stepname);
                            app.Tap(x => x.Css(Locator).Index(index));
                        }
                        if (LocatorType == "Xpath")
                        {
                            int index = Int32.Parse(Index);

                            app.Screenshot(Stepname);
                            app.Tap(x => x.XPath(Locator).Index(index));
                        }

                        obs_val  = "Tapped";
                        stepdata = stepdata + Stepname + "\t" + Parameter + "\t" + Action + "\t" + LocatorType + "\t" + Locator + "\t" + EXpected + "\t" + obs_val + "\n";
                        File.AppendAllText(Path, stepdata);

                        break;

                    case "Scrolldown":
                        app.ScrollDown();
                        app.Screenshot(Stepname);
                        obs_val  = "Scrolled";
                        stepdata = stepdata + Stepname + "\t" + Parameter + "\t" + Action + "\t" + LocatorType + "\t" + Locator + "\t" + EXpected + "\t" + obs_val + "\n";
                        File.AppendAllText(Path, stepdata);
                        break;

                    case "Scrolluntil":

                        if (LocatorType == "Text")
                        {
                            int index = Int32.Parse(Index);
                            app.ScrollDownTo(x => x.Text(Locator).Index(index));
                            app.Screenshot(Stepname);
                        }
                        if (LocatorType == "ID")
                        {
                            int index = Int32.Parse(Index);
                            app.ScrollDownTo(x => x.Id(Locator).Index(index));
                            app.Screenshot(Stepname);
                        }
                        if (LocatorType == "Class")
                        {
                            int index = Int32.Parse(Index);
                            app.ScrollDownTo(x => x.Class(Locator).Index(index));
                            app.Screenshot(Stepname);
                        }
                        if (LocatorType == "css")
                        {
                            int index = Int32.Parse(Index);
                            app.ScrollDownTo(x => x.Css(Locator).Index(index));
                            app.Screenshot(Stepname);
                        }
                        if (LocatorType == "Xpath")
                        {
                            int index = Int32.Parse(Index);
                            app.ScrollDownTo(x => x.XPath(LocatorType).Index(index));
                            app.Screenshot(Stepname);
                        }
                        obs_val  = "ScrollUntilSuccess";
                        stepdata = stepdata + Stepname + "\t" + Parameter + "\t" + Action + "\t" + LocatorType + "\t" + Locator + "\t" + EXpected + "\t" + obs_val + "\n";
                        File.AppendAllText(Path, stepdata);
                        break;

                    case "Sendkeys":
                        if (LocatorType == "Text")
                        {
                            int index = Int32.Parse(Index);
                            app.WaitForElement(x => x.Text(Locator).Index(index), "Did not see the element.", new TimeSpan(0, 0, 0, 20, 0));

                            app.EnterText(x => x.Text(Locator).Index(index), EXpected);
                            app.ClearText();
                            app.EnterText(x => x.Text(Locator).Index(index), EXpected);
                            app.Screenshot(Stepname);
                            app.DismissKeyboard();
                        }
                        if (LocatorType == "ID")
                        {
                            int index = Int32.Parse(Index);
                            app.WaitForElement(x => x.Id(Locator).Index(index), "Did not see the element.", new TimeSpan(0, 0, 0, 20, 0));
                            app.EnterText(x => x.Id(Locator).Index(index), EXpected);
                            app.ClearText();
                            app.EnterText(x => x.Id(Locator).Index(index), EXpected);
                            app.Screenshot(Stepname);
                            app.DismissKeyboard();
                        }
                        if (LocatorType == "Class")
                        {
                            int index = Int32.Parse(Index);
                            app.WaitForElement(x => x.Class(Locator).Index(index), "Did not see the element.", new TimeSpan(0, 0, 0, 20, 0));
                            app.EnterText(x => x.Class(Locator).Index(index), EXpected);
                            app.ClearText();
                            app.EnterText(x => x.Class(Locator).Index(index), EXpected);
                            app.Screenshot(Stepname);
                            app.DismissKeyboard();
                        }
                        if (LocatorType == "css")
                        {
                            int index = Int32.Parse(Index);
                            app.WaitForElement(x => x.Css(Locator).Index(index), "Did not see the element.", new TimeSpan(0, 0, 0, 20, 0));
                            app.EnterText(x => x.Css(Locator).Index(index), EXpected);
                            app.ClearText();
                            app.EnterText(x => x.Css(Locator).Index(index), EXpected);
                            app.Screenshot(Stepname);
                            app.DismissKeyboard();
                        }
                        if (LocatorType == "Xpath")
                        {
                            int index = Int32.Parse(Index);
                            app.WaitForElement(x => x.XPath(Locator).Index(index), "Did not see the element.", new TimeSpan(0, 0, 0, 20, 0));
                            app.EnterText(x => x.XPath(Locator).Index(index), EXpected);
                            app.ClearText();
                            app.EnterText(x => x.XPath(Locator).Index(index), EXpected);
                            app.Screenshot(Stepname);
                            app.DismissKeyboard();
                        }
                        obs_val  = "SendKeysSuccess";
                        stepdata = stepdata + Stepname + "\t" + Parameter + "\t" + Action + "\t" + LocatorType + "\t" + Locator + "\t" + EXpected + "\t" + obs_val + "\n";
                        File.AppendAllText(Path, stepdata);
                        break;

                    case "ReadText":
                        string Textread = "";
                        if (LocatorType == "Text")
                        {
                            int index = Int32.Parse(Index);
                            Textread = app.Query(x => x.Text(Locator).Index(index))[0].Text;
                            app.Screenshot(Stepname);
                        }
                        if (LocatorType == "ID")
                        {
                            int index = Int32.Parse(Index);
                            Textread = app.Query(x => x.Id(Locator).Index(index))[0].Text;
                            app.Screenshot(Stepname);
                        }
                        if (LocatorType == "Class")
                        {
                            int index = Int32.Parse(Index);
                            Textread = app.Query(x => x.Class(Locator).Index(index))[0].Text;
                            app.Screenshot(Stepname);
                        }

                        obs_val  = Textread;
                        stepdata = stepdata + Stepname + "\t" + Parameter + "\t" + Action + "\t" + LocatorType + "\t" + Locator + "\t" + EXpected + "\t" + obs_val;
                        File.AppendAllText(Path, stepdata);
                        break;

                    case "Screenshot":
                        app.Screenshot(Stepname);

                        obs_val  = "ScreenShotCaptured";
                        stepdata = stepdata + Stepname + "\t" + Parameter + "\t" + Action + "\t" + LocatorType + "\t" + Locator + "\t" + EXpected + "\t" + obs_val;
                        File.AppendAllText(Path, stepdata);
                        break;

                    case "Waitforelement":

                        if (LocatorType == "Text")
                        {
                            int index = Int32.Parse(Index);
                            app.WaitForElement(x => x.Text(Locator).Index(index), "Did not see the element.", new TimeSpan(0, 0, 0, 60, 0));
                        }
                        if (LocatorType == "ID")
                        {
                            int index = Int32.Parse(Index);
                            app.WaitForElement(x => x.Id(Locator).Index(index), "Did not see the element.", new TimeSpan(0, 0, 0, 60, 0));
                        }
                        if (LocatorType == "Class")
                        {
                            int index = Int32.Parse(Index);
                            app.WaitForElement(x => x.Class(Locator).Index(index), "Did not see the element.", new TimeSpan(0, 0, 0, 60, 0));
                        }
                        if (LocatorType == "css")
                        {
                            int index = Int32.Parse(Index);
                            app.WaitForElement(x => x.Css(Locator).Index(index), "Did not see the element.", new TimeSpan(0, 0, 0, 60, 0));
                        }
                        if (LocatorType == "Xpath")
                        {
                            int index = Int32.Parse(Index);
                            app.WaitForElement(x => x.XPath(Locator).Index(index), "Did not see the element.", new TimeSpan(0, 0, 0, 60, 0));
                        }
                        obs_val  = "ElementFound";
                        stepdata = stepdata + Stepname + "\t" + Parameter + "\t" + Action + "\t" + LocatorType + "\t" + Locator + "\t" + EXpected + "\t" + obs_val + "\n";
                        File.AppendAllText(Path, stepdata);
                        break;

                    case "Locatoracess":
                        app.Repl();
                        obs_val  = "ReplLaunched";
                        stepdata = stepdata + Stepname + "\t" + Parameter + "\t" + Action + "\t" + LocatorType + "\t" + Locator + "\t" + EXpected + "\t" + obs_val + "\n";
                        File.AppendAllText(Path, stepdata);
                        break;

                    case "Delay":

                        int Time = Int32.Parse(EXpected);
                        Thread.Sleep(Time);
                        obs_val  = "waitsuccess";
                        stepdata = stepdata + Stepname + "\t" + Parameter + "\t" + Action + "\t" + LocatorType + "\t" + Locator + "\t" + EXpected + "\t" + obs_val + "\n";
                        File.AppendAllText(Path, stepdata);
                        break;

                    case "Wifienable":
                        System.Diagnostics.Process          process   = new System.Diagnostics.Process();
                        System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
                        startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
                        startInfo.FileName    = "cmd.exe";
                        startInfo.Arguments   = "/C adb shell svc wifi enable";


                        process.StartInfo = startInfo;
                        process.Start();
                        obs_val  = "Wifi_enabled";
                        stepdata = stepdata + Stepname + "\t" + Parameter + "\t" + Action + "\t" + LocatorType + "\t" + Locator + "\t" + EXpected + "\t" + obs_val + "\n";
                        File.AppendAllText(Path, stepdata);

                        break;

                    case "Wifidisable":
                        System.Diagnostics.Process          testprocess  = new System.Diagnostics.Process();
                        System.Diagnostics.ProcessStartInfo cmdstartInfo = new System.Diagnostics.ProcessStartInfo();
                        cmdstartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
                        cmdstartInfo.FileName    = "cmd.exe";

                        cmdstartInfo.Arguments = "/C adb shell svc wifi disable";
                        testprocess.StartInfo  = cmdstartInfo;
                        testprocess.Start();
                        obs_val  = "Wifi_disabled";
                        stepdata = stepdata + Stepname + "\t" + Parameter + "\t" + Action + "\t" + LocatorType + "\t" + Locator + "\t" + EXpected + "\t" + obs_val + "\n";
                        File.AppendAllText(Path, stepdata);

                        break;

                    case "Bluetoothenable":

                        System.Diagnostics.Process          testprocessblu  = new System.Diagnostics.Process();
                        System.Diagnostics.ProcessStartInfo cmdstartInfoblu = new System.Diagnostics.ProcessStartInfo();
                        cmdstartInfoblu.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
                        cmdstartInfoblu.FileName    = "cmd.exe";
                        cmdstartInfoblu.Arguments   = "/C adb shell service call bluetooth_manager 6";
                        testprocessblu.StartInfo    = cmdstartInfoblu;
                        testprocessblu.Start();
                        obs_val  = "Bluetooth_enabled";
                        stepdata = stepdata + Stepname + "\t" + Parameter + "\t" + Action + "\t" + LocatorType + "\t" + Locator + "\t" + EXpected + "\t" + obs_val + "\n";
                        File.AppendAllText(Path, stepdata);

                        break;

                    case "Bluetoothdisable":

                        System.Diagnostics.Process          testprocessBluoff  = new System.Diagnostics.Process();
                        System.Diagnostics.ProcessStartInfo cmdstartInfoBluoff = new System.Diagnostics.ProcessStartInfo();
                        cmdstartInfoBluoff.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
                        cmdstartInfoBluoff.FileName    = "cmd.exe";
                        cmdstartInfoBluoff.Arguments   = "/C adb shell service call bluetooth_manager 9";
                        testprocessBluoff.StartInfo    = cmdstartInfoBluoff;
                        testprocessBluoff.Start();
                        obs_val  = "Bluetooth_disabled";
                        stepdata = stepdata + Stepname + "\t" + Parameter + "\t" + Action + "\t" + LocatorType + "\t" + Locator + "\t" + EXpected + "\t" + obs_val + "\n";
                        File.AppendAllText(Path, stepdata);

                        break;

                    case "Mobiledataoff":
                        System.Diagnostics.Process          processdata   = new System.Diagnostics.Process();
                        System.Diagnostics.ProcessStartInfo startInfodata = new System.Diagnostics.ProcessStartInfo();
                        startInfodata.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
                        startInfodata.FileName    = "cmd.exe";
                        startInfodata.Arguments   = "/C adb shell svc data disable";


                        processdata.StartInfo = startInfodata;
                        processdata.Start();
                        obs_val  = "MobileData_disabled";
                        stepdata = stepdata + Stepname + "\t" + Parameter + "\t" + Action + "\t" + LocatorType + "\t" + Locator + "\t" + EXpected + "\t" + obs_val + "\n";
                        File.AppendAllText(Path, stepdata);
                        break;

                    case "Mobiledataon":
                        System.Diagnostics.Process          processdataon   = new System.Diagnostics.Process();
                        System.Diagnostics.ProcessStartInfo startInfodataon = new System.Diagnostics.ProcessStartInfo();
                        startInfodataon.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
                        startInfodataon.FileName    = "cmd.exe";
                        startInfodataon.Arguments   = "/C adb shell svc data enable";


                        processdataon.StartInfo = startInfodataon;
                        processdataon.Start();
                        obs_val  = "MobileData_enabled";
                        stepdata = Stepname + "\t" + Parameter + "\t" + Action + "\t" + LocatorType + "\t" + Locator + "\t" + EXpected + "\t" + obs_val + "\n";
                        File.AppendAllText(Path, stepdata);

                        break;
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                    obs_val = "Error:" + e.Message.ToString();
                    File.AppendAllText(Path, obs_val);
                }
            }
        }
Пример #22
0
        public void JoinLeagueAndChallenge()
        {
            Func <AppQuery, AppQuery> menuButton = e => e.Marked("ic_more_vert_white");

            if (platform == Platform.Android)
            {
                menuButton = e => e.Marked("NoResourceEntry-0").Index(app.Query(ee => ee.Marked("NoResourceEntry-0")).Length - 1);
            }

            app.WaitForElement("authButton");
            app.Tap("When the app starts", "authButton");

            var emailId              = "#Email";
            var passwordId           = "#Passwd";
            var nextButtonEmailId    = "#next";
            var nextButtonPasswordId = "#signIn";

            //Give the Google auth form time to load
            Thread.Sleep(15000);

            var query = app.Query(e => e.Css("#identifierId"));

            if (query.Length > 0)
            {
                emailId              = "#identifierId";
                passwordId           = "#password";
                nextButtonEmailId    = "#identifierNext";
                nextButtonPasswordId = "#passwordNext";
            }

            app.WaitForElement(e => e.Css(emailId));
            app.EnterText(e => e.Css(emailId), Keys.TestEmail, "And I enter my email address");
            app.DismissKeyboard();

            if (app.Query(e => e.Css(nextButtonEmailId)).Length > 0)
            {
                app.Tap(e => e.Css(nextButtonEmailId));
            }

            if (TestEnvironment.IsTestCloud)
            {
                Thread.Sleep(10000);                 //Need to wait for form fields to animate over
            }
            //app.Repl();
            app.Tap(e => e.Css(passwordId));
            app.EnterText(e => e.Css(passwordId), Keys.TestPassword, "And I enter my super secret password");
            app.DismissKeyboard();
            app.Tap(e => e.Css(nextButtonPasswordId));

            //app.Tap("And I click the Sign In button", e => e.Css("#signIn"));

            //Thread.Sleep(2000); //Can't wait here because the dialog is conditional
            //if(app.Query(e => e.Button("Remember")).Length > 0)
            //	app.Back();

            //Thread.Sleep(5000);
            //if(app.Query(e => e.Css("#grant_heading")).Length > 0)
            //{
            //	app.ScrollDownTo(e => e.Css("#submit_approve_access"));
            //	app.Tap("And I accept the terms", e => e.Css("#submit_approve_access"));
            //}

            app.WaitForElement(e => e.Marked("aliasText"), "Timed out waiting for aliasText", TimeSpan.FromMinutes(5));
            app.ClearText(e => e.Marked("aliasText"));
            app.EnterText(e => e.Marked("aliasText"), Keys.TestAlias, "And I enter my alias");
            app.DismissKeyboard();
            Thread.Sleep(3000);

            app.Tap("And I save my profile", e => e.Marked("saveButton"));
            app.WaitForElement("continueButton", "Timed out waiting for the Continue button", TimeSpan.FromMinutes(5));
            Thread.Sleep(3000);
            app.Tap("Continue button", e => e.Marked("continueButton"));

            app.WaitForElement(e => e.Marked("leagueRow"));
            app.Screenshot("Now I should see a list of leagues I have joined");

            //Available leagues
            //			Helpers.OnAndroid("NoResourceEntry-0".Tap);
            //			Helpers.OniOS("ic_add_white".Tap);

            if (platform == Platform.Android)
            {
                app.Tap("NoResourceEntry-0");
            }
            else if (platform == Platform.iOS)
            {
                app.Tap("ic_add_white");
            }

            //Thread.Sleep(5000);
            app.WaitForElement(e => e.Marked("leagueRow"));

            if (TestEnvironment.IsTestCloud)
            {
                Thread.Sleep(10000);                 //Need to wait for list images to load
            }
            app.Screenshot("Then I should see a list of leagues to join");

            Thread.Sleep(1000);
            app.Tap("leagueRow");

            app.WaitForElement("leaderboardButton");
            app.Screenshot("Then I should see a league I can join");

            app.Back(platform);
            app.Tap("Done");

            app.Screenshot("Athlete leagues listview");
            app.ScrollDownTo("Billiards");
            app.Tap("Billiards");

            app.WaitForElement("leaguePhoto");
            app.Screenshot("Then I should see the league details");
            app.ScrollDownTo("leaderboardButton", "scrollView");
            app.Tap("leaderboardButton");

            app.WaitForElement("memberItemRoot");
            app.Screenshot("Leaderboard listview");

            app.ScrollDownTo("10");
            app.Tap("10");
            app.WaitForElement("memberDetailsRoot");
            app.Screenshot("Member details page");

            app.ScrollDownTo("pastButton", "scrollView");
            app.Tap("Bottom of member details page", e => e.Marked("pastButton"));

            app.WaitForElement("challengeItemRoot");
            app.Screenshot("Challenge history page");

            if (TestEnvironment.IsTestCloud)
            {
                Thread.Sleep(10000);                 //Need to wait for list to load
            }
            if (app.Query("resultItemRoot").Length > 0)
            {
                app.Tap("resultItemRoot");
                app.WaitForElement("challengeRoot");
                app.Screenshot("Challenge result page");

                app.ScrollDownTo("winningLabel", "scrollView");
                app.Screenshot("Challenge result page bottom");
                app.Back(platform);
                app.Tap("Done");
            }
            else
            {
                app.Tap("Done");
            }

            app.Tap("challengeButton");
            app.Screenshot("Challenge date page");

            app.Tap("datePicker");
            app.Screenshot("Challenge date picker");

            DismissPicker();
            app.Screenshot("End");

            app.Tap("timePicker");
            app.Screenshot("Challenge time picker");

            DismissPicker();
            app.Tap("Cancel");

            app.WaitForElement("Membership Info");
            app.Back(platform);

            app.WaitForElement("Leaderboard");
            app.Back(platform);

            app.Tap(menuButton);
            app.Tap("Cowardly Abandon League");

            app.Screenshot("Confirm");
            app.Tap("No");

            app.Back(platform);
            app.Screenshot("End");

            app.Tap(menuButton);
            app.Screenshot("More options menu");
            app.Tap(e => e.Marked("About"), "About page");

            app.WaitForElement("aboutPage");
            app.ScrollDownTo("sourceButton", "scrollView");
            app.Screenshot("Bottom of About page");

            app.Tap("Done");

            app.Tap(menuButton);
            app.Tap(e => e.Marked("My Profile"), "Profile page");
            app.ScrollDownTo("saveButton", "scrollView");
            app.Tap("Saving profile", e => e.Marked("saveButton"));

            app.WaitForElement(e => e.Marked("leagueRow"));
            app.Screenshot("End of test");
        }
Пример #23
0
        public void JoinLeagueAndChallenge()
        {
            Func <AppQuery, AppQuery> menuButton = e => e.Marked("ic_more_vert_white");

            if (platform == Platform.Android)
            {
                menuButton = e => e.Marked("NoResourceEntry-0").Index(app.Query(ee => ee.Marked("NoResourceEntry-0")).Length - 1);
            }

            Thread.Sleep(5000);
            app.WaitForElement("authButton");
            app.Tap("When the app starts", "authButton");

            app.WaitForElement(e => e.Css("#Email"), "Timed out waiting for Google Oauth form", TimeSpan.FromSeconds(60));
            app.EnterText(e => e.Css("#Email"), Keys.TestEmail, "And I enter my email address");
            app.DismissKeyboard();

            Thread.Sleep(2000);             //Can't wait for element because it will show but is disabled
            if (app.Query(e => e.Css("#next")).Length > 0)
            {
                app.Tap(e => e.Css("#next"));
            }

            Thread.Sleep(5000);             //Google seems to be animating their forms now - delay to let it animate
            app.EnterText(e => e.Css("#Passwd"), Keys.TestPassword, "And I enter my super secret password");
            app.DismissKeyboard();

            app.Tap("And I click the Sign In button", e => e.Css("#signIn"));

            Thread.Sleep(2000);             //Can't wait here because the dialog is conditional
            if (app.Query(e => e.Button("Remember")).Length > 0)
            {
                app.Back();
            }

            app.WaitForElement(e => e.Css("#grant_heading"));
            app.ScrollDownTo(e => e.Css("#submit_approve_access"));
            app.Tap("And I accept the terms", e => e.Css("#submit_approve_access"));

//			Thread.Sleep(5000);
//			int tries = 0;
//			while(app.Query(e => e.Marked("aliasText")).Length == 0 && tries < 5)
//			{
//				app.ScrollDown();
//				if(app.Query(e => e.Css("#submit_approve_access")).Length > 0)
//				{
//					app.Tap("And I accept the terms", e => e.Css("#submit_approve_access"));
//				}
//
//				Thread.Sleep(10000);
//				tries++;
//			}

            app.WaitForElement(e => e.Marked("authButton"));
            app.Screenshot("Authentication complete!");

            Thread.Sleep(10000);
            app.WaitForElement(e => e.Marked("aliasText"));
            app.ClearText(e => e.Marked("aliasText"));
            app.EnterText(e => e.Marked("aliasText"), "XTC Tester", "And I enter my alias");
            app.DismissKeyboard();

            app.Tap("And I save my profile", e => e.Marked("saveButton"));

            app.WaitForElement("continueButton");
            app.Tap("Continue button", e => e.Marked("continueButton"));

            app.WaitForElement(e => e.Marked("leagueRow"));
            app.Screenshot("Now I should see a list of leagues I have joined");

            //Available leagues
            if (platform == Platform.Android)
            {
                app.Tap("NoResourceEntry-0");
            }
            else if (platform == Platform.iOS)
            {
                app.Tap("ic_add_white");
            }

            //Thread.Sleep(5000);
            app.WaitForElement(e => e.Marked("leagueRow"));

            Thread.Sleep(10000);             //Pausing to allow time for images to load
            app.Screenshot("Then I should see a list of leagues to join");

            app.Tap(e => e.Marked("leagueRow").Index(0));
            app.WaitForElement("leaderboardButton");
            app.Screenshot("Then I should see a league I can join");

            app.Back(platform);
            app.Tap("Done");

            app.Screenshot("Athlete leagues listview");
            app.ScrollDownTo("XTC Tests");
            app.Tap("XTC Tests");

            app.WaitForElement("leaguePhoto");
            app.Screenshot("Then I should see the league details");
            app.ScrollDownTo("leaderboardButton");
            app.Tap("leaderboardButton");

            app.WaitForElement("memberItemRoot");
            app.Screenshot("Leaderboard listview");

            var result = app.Query("*You*")[0];

            app.TapCoordinates(result.Rect.X, result.Rect.Y - result.Rect.Height);             //Select player above self
            app.WaitForElement("memberDetailsRoot");
            app.Screenshot("Member details page");

            app.ScrollDownTo("pastButton");
            app.Tap("Bottom of member details page", e => e.Marked("pastButton"));

            app.WaitForElement("challengeItemRoot");
            app.Screenshot("Challenge history page");

            Thread.Sleep(10000);             //Need to wait for list to load

            if (app.Query("resultItemRoot").Length > 0)
            {
                app.Tap("resultItemRoot");
                app.WaitForElement("challengeRoot");
                app.Screenshot("Challenge result page");

                app.ScrollDownTo("winningLabel");
                app.Screenshot("Challenge result page bottom");
                app.Back(platform);
                app.Tap("Done");
            }
            else
            {
                app.Tap("Done");
            }

            app.Tap("challengeButton");
            app.Screenshot("Challenge date page");

            app.Tap("datePicker");
            app.Screenshot("Challenge date picker");

            DismissPicker();
            app.Screenshot("End");

            app.Tap("timePicker");
            app.Screenshot("Challenge time picker");

            DismissPicker();
            app.Tap("Cancel");

            app.Back(platform);
            app.Back(platform);

            app.Tap("challengeButton");
            app.Screenshot("Challenge date page");

            app.Tap("datePicker");
            app.Screenshot("Challenge date picker");
            DismissPicker();
            app.Screenshot("End");

            app.Tap("timePicker");
            app.Screenshot("Challenge time picker");
            DismissPicker();
            app.Tap("Cancel");

            app.Screenshot("Back");

            app.Tap(menuButton);
            app.Tap("Cowardly Abandon League");

            app.Screenshot("Confirm");
            app.Tap("No");

            app.Back(platform);
            app.Screenshot("End");

            app.Tap(menuButton);
            app.Screenshot("More options menu");
            app.Tap(e => e.Marked("About"), "About page");

            app.ScrollDownTo("sourceButton");
            app.Screenshot("Bottom of About page");

            app.Tap("Done");

            app.Tap(menuButton);
            app.Tap(e => e.Marked("My Profile"), "Profile page");
            app.ScrollTo("saveButton");
            app.Tap("Saving profile", e => e.Marked("saveButton"));

            app.WaitForElement(e => e.Marked("leagueRow"), "Timed out waiting for leagues list", TimeSpan.FromMinutes(2));
            app.Screenshot("End of test");
        }
Пример #24
0
 public void ViewAlertSuggestion()
 {
     Signup();
     app.ClearText("NoResourceEntry-40");
     app.ClearText("NoResourceEntry-41");
     app.EnterText("NoResourceEntry-40", "sean.mayer1");
     app.EnterText("NoResourceEntry-41", "password");
     app.DismissKeyboard();
     app.Tap("NoResourceEntry-42");
     Thread.Sleep(8000);
     app.SwipeLeftToRight(0.99, 1000, true);
     app.Tap("NoResourceEntry-58");
     app.SwipeRightToLeft(0.99, 1000, true);
 }
Пример #25
0
 public void EnterSubTotal(decimal subTotal)
 {
     app.ClearText("SubTotal");
     app.EnterText("SubTotal", subTotal.ToString());
     app.DismissKeyboard();
 }
Пример #26
0
 public void WhenIEnterAnValidEmailAddress()
 {
     app.ClearText();
     app.EnterText("*****@*****.**");
 }
 public static void WaitForThenClearText(this IApp app, Func <AppQuery, AppQuery> lambda)
 {
     WaitFor(app, lambda);
     app.DoubleTap(lambda);
     app.ClearText();
 }
Пример #28
0
 public void EnterEmail(string email)
 {
     _app.ClearText(_mailEntry);
     _app.EnterText(_mailEntry, email);
 }
 public void ClearText(Func <AppQuery, AppWebQuery> query)
 {
     _app.ClearText(query);
 }
Пример #30
0
        /// <summary>
        /// Fills the items on a record entry's edit screen
        /// </summary>
        /// <param name="fields">List of fields as strings that need to be generated</param>
        /// <param name="type">Feed or bedding type to be added</param>
        private void RecordBuild(List <string> fields, int type = 0)
        {
            // set description
            if (fields.Contains("Description"))
            {
                SeekToElement(c => c.Class("ButtonRenderer").Text("Save"), SeekDirection.Up);
                SeekToElement(c => c.Text("Description").Sibling("EditorRenderer").Child("FormsEditText"), SeekDirection.Down);
                app.Tap(c => c.Text("Description").Sibling("EditorRenderer").Child("FormsEditText"));
                app.ClearText();
                app.EnterText("ABCDEFGHIJKLMNOPQRSTUVWKYZ1234" +
                              "ABCDEFGHIJKLMNOPQRSTUVWKYZ1234" +
                              "ABCDEFGHIJKLMNOPQRSTUVWKYZ1234" +
                              "ABCDEFGHIJKLMNOPQRSTUVWKYZ1234" +
                              "ABCDEFGHIJKLMNOPQRSTUVWKYZ1234");
                app.DismissKeyboard();
            }
            if (fields.Contains("DescriptionOpt"))
            {
                SeekToElement(c => c.Class("ButtonRenderer").Text("Save"), SeekDirection.Up);
                SeekToElement(c => c.Text("Description (Optional)").Sibling("EditorRenderer").Child("FormsEditText"), SeekDirection.Down);
                app.Tap(c => c.Text("Description (Optional)").Sibling("EditorRenderer").Child("FormsEditText"));
                app.ClearText();
                app.EnterText("ABCDEFGHIJKLMNOPQRSTUVWKYZ1234" +
                              "ABCDEFGHIJKLMNOPQRSTUVWKYZ1234" +
                              "ABCDEFGHIJKLMNOPQRSTUVWKYZ1234" +
                              "ABCDEFGHIJKLMNOPQRSTUVWKYZ1234" +
                              "ABCDEFGHIJKLMNOPQRSTUVWKYZ1234");
                app.DismissKeyboard();
            }
            // set type for feed, service, or bedding
            if (fields.Contains("TypeFeed"))
            {
                SeekToElement(c => c.Class("ButtonRenderer").Text("Save"), SeekDirection.Up);
                SeekToElement(c => c.Text("Type").Sibling("PickerRenderer"), SeekDirection.Down);
                app.Tap(c => c.Text("Type").Sibling("PickerRenderer"));
                app.Tap(c => c.Text(feedTypes[type]));
            }
            if (fields.Contains("TypeBed"))
            {
                SeekToElement(c => c.Class("ButtonRenderer").Text("Save"), SeekDirection.Up);
                SeekToElement(c => c.Text("Type").Sibling("PickerRenderer"), SeekDirection.Down);
                app.Tap(c => c.Text("Type").Sibling("PickerRenderer"));
                app.Tap(c => c.Text(beddingTypes[type]));
            }
            if (fields.Contains("TypeService"))
            {
                SeekToElement(c => c.Class("ButtonRenderer").Text("Save"), SeekDirection.Up);
                SeekToElement(c => c.Text("Type").Sibling("PickerRenderer"), SeekDirection.Down);
                app.Tap(c => c.Text("Type").Sibling("PickerRenderer"));
                app.Tap(c => c.Text(servicesTypes[type]));
            }
            // set location
            if (fields.Contains("Location"))
            {
                SeekToElement(c => c.Class("ButtonRenderer").Text("Save"), SeekDirection.Up);
                SeekToElement(c => c.Text("Location").Sibling("EditorRenderer").Child("FormsEditText"), SeekDirection.Down);
                app.Tap(c => c.Text("Location").Sibling("EditorRenderer").Child("FormsEditText"));
                app.ClearText();
                app.EnterText("ABCDEFGHIJKLMNOPQRSTUVWKYZ1234" +
                              "ABCDEFGHIJKLMNOPQRSTUVWKYZ1234" +
                              "ABCDEFGHIJKLMNOPQRSTUVWKYZ1234" +
                              "ABCDEFGHIJKLMNOPQRSTUVWKYZ1234" +
                              "ABCDEFGHIJKLMNOPQRSTUVWKYZ1234");
                app.DismissKeyboard();
            }
            // set start and end times
            if (fields.Contains("Times"))
            {
                // Set start time to now in AM
                SeekToElement(c => c.Class("ButtonRenderer").Text("Save"), SeekDirection.Up);
                SeekToElement(c => c.Text("Start Time").Sibling("ButtonRenderer"), SeekDirection.Down);
                app.Tap(c => c.Text("Start Time").Sibling("ButtonRenderer"));
                app.Tap(c => c.Text("Start Time").Sibling("TimePickerRenderer"));
                app.Tap(c => c.Id("am_label"));
                app.Tap(c => c.Text("OK"));
                // set end time to now in PM
                SeekToElement(c => c.Class("ButtonRenderer").Text("Save"), SeekDirection.Up);
                SeekToElement(c => c.Text("End Time").Sibling("ButtonRenderer"), SeekDirection.Down);
                app.Tap(c => c.Text("End Time").Sibling("ButtonRenderer"));
                app.Tap(c => c.Text("End Time").Sibling("TimePickerRenderer"));
                app.Tap(c => c.Id("pm_label"));
                app.Tap(c => c.Text("OK"));
            }
            // set amount
            if (fields.Contains("Amount"))
            {
                SeekToElement(c => c.Class("ButtonRenderer").Text("Save"), SeekDirection.Up);
                SeekToElement(c => c.Text("Amount (lbs.)").Sibling("EntryRenderer").Child("FormsEditText"), SeekDirection.Down);
                app.Tap(c => c.Text("Amount (lbs.)").Sibling("EntryRenderer").Child("FormsEditText"));
                app.ClearText();
                app.EnterText("2.50");
                app.DismissKeyboard();
            }
            // set cost
            if (fields.Contains("Cost"))
            {
                SeekToElement(c => c.Class("ButtonRenderer").Text("Save"), SeekDirection.Up);
                SeekToElement(c => c.Text("Cost ($)").Sibling("EntryRenderer").Child("FormsEditText"), SeekDirection.Down);
                app.Tap(c => c.Text("Cost ($)").Sibling("EntryRenderer").Child("FormsEditText"));
                app.ClearText();
                app.EnterText("5.00");
                app.DismissKeyboard();
            }

            // save the record
            SeekToElement(c => c.Class("ButtonRenderer").Text("Save"), SeekDirection.Up);
            app.WaitForElement(c => c.Class("ButtonRenderer").Text("Save"));
            app.Tap(c => c.Class("ButtonRenderer").Text("Save"));
        }