Ejemplo n.º 1
0
        public void Theory(Type type, string value)
        {
            try { Convert.ChangeType(value, type); } catch { return; }

            Console.WriteLine($"TEST CASE: type={type.FullName}, value={value}");

            RunningApp.ClearText(Id.ValueEntry);

            var input  = string.Empty;
            var output = string.Empty;

            foreach (var c in value)
            {
                input += c;
                RunningApp.EnterText(Id.ValueEntry, $"{c}");

                if (TryParse(type, input, ref output))
                {
                    input = output;
                }

                if (string.IsNullOrEmpty(output))
                {
                    continue;
                }

                RunningApp.WaitForElement(q => q.Marked($"value: {output}"));
            }

            if (!Equals(Convert.ChangeType(value, type), Convert.ChangeType(output, type)))
            {
                throw new Exception($"Value '{value}' entered as '{output}'.");
            }
        }
Ejemplo n.º 2
0
        public void InsanelyWideHorizontalSpacingShouldNotCrash()
        {
            RunningApp.WaitForElement("entryUpdate_Spacing");
            RunningApp.Tap("entryUpdate_Spacing");
            RunningApp.ClearText();
            RunningApp.EnterText("0,500");
            RunningApp.Tap("btnUpdate_Spacing");

            // If it hasn't crashed, we should still be able to find this
            RunningApp.WaitForElement("entryUpdate_Spacing");
        }
Ejemplo n.º 3
0
        public string DateString(String format, String date)
        {
            RunningApp.ClearText("dateFormatString");
            RunningApp.EnterText("dateFormatString", format);
            RunningApp.PressEnter();
            RunningApp.ClearText("settingDate");
            RunningApp.EnterText("settingDate", date);
            RunningApp.PressEnter();
            var text = RunningApp.ReadDatePicker("dateCalendarOptions");

            return(text);
        }
Ejemplo n.º 4
0
        public string TimeString(String format, String time)
        {
            RunningApp.ClearText("timeFormatString");
            RunningApp.EnterText("timeFormatString", format);
            RunningApp.PressEnter();
            RunningApp.ClearText("settingTime");
            RunningApp.EnterText("settingTime", time);
            RunningApp.PressEnter();
            var text = RunningApp.ReadTimePicker("timeClockOptions");

            return(text);
        }
Ejemplo n.º 5
0
        public void Theory(Type type, string[] values)
        {
            RunningApp.ClearText(Ids.TypeEntry);
            RunningApp.EnterText(Ids.TypeEntry, type.FullName);
            RunningApp.Tap(Ids.BindButton);
            RunningApp.WaitForElement(q => q.Marked($"type: {type.FullName}"));

            foreach (var value in values)
            {
                Theory(type, value);
            }
        }
Ejemplo n.º 6
0
        public void VerifyEditorTextChangeEventsAreFiring()
        {
            RunningApp.WaitForElement("EditorAutomationId");
            RunningApp.EnterText("EditorAutomationId", "Test 1");

            Assert.AreEqual("Test 1", RunningApp.WaitForElement("EditorAutomationId")[0].ReadText());
            Assert.AreEqual("Test 1", RunningApp.WaitForElement("EntryAutomationId")[0].ReadText());

            RunningApp.ClearText("EntryAutomationId");
            RunningApp.EnterText("EntryAutomationId", "Test 2");

            Assert.AreEqual("Test 2", RunningApp.WaitForElement("EditorAutomationId")[0].ReadText());
            Assert.AreEqual("Test 2", RunningApp.WaitForElement("EntryAutomationId")[0].ReadText());
        }
Ejemplo n.º 7
0
        public void HeaderDoesNotBreakIndexes()
        {
            RunningApp.WaitForElement("entryInsert");
            RunningApp.Tap("entryInsert");
            RunningApp.ClearText();
            RunningApp.EnterText("1");
            RunningApp.Tap("Insert");

            // If the bug is still present, then there will be
            // two "Item: 0" items instead of the newly inserted item
            // Or the header will have disappeared
            RunningApp.WaitForElement("Inserted");
            RunningApp.WaitForElement("This is the header");
        }
Ejemplo n.º 8
0
        public void TestCursorPositionAndSelection()
        {
            RunningApp.WaitForElement("CursorTextEntry");

            RunningApp.ClearText("CursorStart");
            RunningApp.EnterText("CursorStart", "2");
            RunningApp.ClearText("SelectionLength");
            RunningApp.EnterText("SelectionLength", "3");
            RunningApp.DismissKeyboard();
            RunningApp.Tap("Update");
            RunningApp.Screenshot("Text selection from char 2 length 3.");

            RunningApp.Tap("CursorTextEntry");
            Assert.AreEqual("0", RunningApp.WaitForElement("SelectionLength")[0].ReadText());
        }
Ejemplo n.º 9
0
        public void CanScrollToGroupAndItem()
        {
            RunningApp.WaitForElement("GroupNameEntry");
            RunningApp.Tap("GroupNameEntry");
            RunningApp.ClearText();
            RunningApp.EnterText("Heroes for Hire");

            RunningApp.Tap("ItemNameEntry");
            RunningApp.ClearText();
            RunningApp.EnterText("Misty Knight");

            RunningApp.Tap("GoItemButton");

            // Should scroll enough to display this item
            RunningApp.WaitForElement("Luke Cage");
        }
Ejemplo n.º 10
0
        public void InvalidScrollToIndexShouldNotCrash()
        {
            RunningApp.WaitForElement("GroupIndexEntry");
            RunningApp.Tap("GroupIndexEntry");
            RunningApp.ClearText();
            RunningApp.EnterText("55");

            RunningApp.Tap("ItemIndexEntry");
            RunningApp.ClearText();
            RunningApp.EnterText("1");

            RunningApp.Tap("GoButton");

            // Should scroll enough to display this item
            RunningApp.WaitForElement("Avengers");
        }
Ejemplo n.º 11
0
        public void CanScrollToGroupAndItemIndex()
        {
            RunningApp.WaitForElement("GroupIndexEntry");
            RunningApp.Tap("GroupIndexEntry");
            RunningApp.ClearText();
            RunningApp.EnterText("5");

            RunningApp.Tap("ItemIndexEntry");
            RunningApp.ClearText();
            RunningApp.EnterText("1");

            RunningApp.Tap("GoButton");

            // Should scroll enough to display this item
            RunningApp.WaitForElement("Squirrel Girl");
        }
Ejemplo n.º 12
0
        public void EntryTextDoesNotDisplayNonnumericInput()
        {
            RunningApp.WaitForElement("Start Entry");
            RunningApp.Tap("Start Entry");

            RunningApp.EnterText("123A");

            var entry = RunningApp.Query(q => q.Text("123"));

            Assert.That(entry.Length >= 1);

            var failedEntry = RunningApp.Query(q => q.Text("123A"));

            Assert.That(failedEntry.Length == 0);

            RunningApp.EnterText("4");

            var entry2 = RunningApp.Query(q => q.Text("1234"));

            Assert.That(entry2.Length >= 1);

            RunningApp.ClearText("36171Entry");

            RunningApp.WaitForElement("Start Editor");
            RunningApp.Tap("Start Editor");

            RunningApp.EnterText("123A");

            var editor = RunningApp.Query(q => q.Text("123"));

            Assert.That(editor.Length >= 1);

            var failedEditor = RunningApp.Query(q => q.Text("123A"));

            Assert.That(failedEditor.Length == 0);

            RunningApp.EnterText("4");

            var editor2 = RunningApp.Query(q => q.Text("1234"));

            Assert.That(editor2.Length >= 1);
        }
Ejemplo n.º 13
0
        public void Issue198TestsNREWithPopModal()
        {
            RunningApp.WaitForElement(q => q.Marked("Page One"));
            RunningApp.WaitForElement(q => q.Button("Leave"));
            RunningApp.Screenshot("All Elements Present");

            RunningApp.Tap(q => q.Marked("Leave"));
            RunningApp.Screenshot("Clicked Leave");

            RunningApp.WaitForElement(q => q.Marked("Bug Repro's"));
#if !__MACOS__
            RunningApp.ClearText(q => q.Raw("* marked:'SearchBarGo'"));
            RunningApp.EnterText(q => q.Raw("* marked:'SearchBarGo'"), "G198");
#endif
            RunningApp.Tap(q => q.Marked("SearchButton"));
            RunningApp.Screenshot("Navigate into gallery again");

            RunningApp.WaitForElement(q => q.Marked("Page Three"));
            RunningApp.Tap(q => q.Marked("Page Three"));

            RunningApp.WaitForElement(q => q.Marked("No Crash"));
            RunningApp.Screenshot("App did not crash");
        }