public void CheckTap(IPerformsTouchActions performer)
        {
            TouchAction t = new TouchAction(performer);
            t.Tap(accessibility);
            t.Perform();

            MultiAction m = new MultiAction(performer);
            m.Add(new TouchAction(performer).Tap(customView));
            m.Add(new TouchAction(performer).Tap(clickable));
            m.Perform();
        }
		public void MultiActionTestCase ()
		{
			IWebElement el = driver.FindElementByAccessibilityId ("ComputeSumButton");
			ITouchAction a1 = new TouchAction(driver);
			a1.Tap(el, 10, 10);
			ITouchAction a2 = new TouchAction(driver);
			a2.Tap(el);
			IMultiAction m = new MultiAction (driver);
			m.Add (a1).Add (a2);
			m.Perform ();
		}
示例#3
0
 public void MultiActionTestCase()
 {
     driver.FindElementById ("TextField1").Clear();
     driver.FindElementById ("TextField1").SendKeys ("2");
     driver.FindElementById ("TextField2").Clear();
     driver.FindElementById ("TextField2").SendKeys ("4");
     IWebElement el = driver.FindElementByAccessibilityId("ComputeSumButton");
     ITouchAction a1 = new TouchAction(driver);
     a1.Tap(el, 10, 10);
     ITouchAction a2 = new TouchAction(driver);
     a2.Tap(el);
     IMultiAction m = new MultiAction(driver);
     m.Add(a1).Add(a2);
     m.Perform();
     const string str = "6";
     Assert.AreEqual (driver.FindElementByXPath ("//*[@name = \"Answer\"]").Text, str);
 }
        public void SequentalMultiActionTestCase()
        {
            string originalActivity = driver.CurrentActivity;
            IList<AppiumWebElement> els = driver.FindElementsByClassName("android.widget.TextView");
            MultiAction multiTouch = new MultiAction(driver);

            TouchAction tap1 = new TouchAction(driver);
            tap1.Press(els[5]).Wait(1500).Release();

            multiTouch.Add(tap1).Add(tap1).Perform();

            Thread.Sleep(2500);
            els = driver.FindElementsByClassName("android.widget.TextView");

            TouchAction tap2 = new TouchAction(driver);
            tap2.Press(els[1]).Wait(1500).Release();

            MultiAction multiTouch2 = new MultiAction(driver);
            multiTouch2.Add(tap2).Add(tap2).Perform();

            Thread.Sleep(2500);
            Assert.AreNotEqual(originalActivity, driver.CurrentActivity);
        }
        public void MultiActionTestCase()
        {
            IOSDriver<IWebElement> driver = new IOSDriver<IWebElement>(defaultUri, capabilities);
            RequestProcessor re = setupMultiAction();
            IWebElement element = driver.FindElementByIosUIAutomation(".elements()");

            MultiAction m = new MultiAction(driver);
            m.Perform();
            Assert.AreEqual(re.inputData, "");

            TouchAction a1 = new TouchAction();
            a1
                .Press(element, 100, 100)
                .Wait(1000)
                .Release();
            m.Add(a1);
            m.Perform();
            Assert.AreEqual(re.inputData, "{\"actions\":[[{\"action\":\"press\",\"options\":{\"element\":\"5\",\"x\":100,\"y\":100}},{\"action\":\"wait\",\"options\":{\"ms\":1000}},{\"action\":\"release\"}]]}");

            TouchAction a2 = new TouchAction();
            a2
                .Tap(100, 100)
                .MoveTo(element);
            m.Add(a2);
            m.Perform();
            Assert.AreEqual(re.inputData, "{\"actions\":[[{\"action\":\"press\",\"options\":{\"element\":\"5\",\"x\":100,\"y\":100}},{\"action\":\"wait\",\"options\":{\"ms\":1000}},{\"action\":\"release\"}],[{\"action\":\"tap\",\"options\":{\"x\":100,\"y\":100}},{\"action\":\"moveTo\",\"options\":{\"element\":\"5\"}}]]}");
        }
		public void DrawSmileyTestCase ()
		{
			driver.FindElementByName ("Graphics").Click ();
			var el = FindTouchPaint ();
			el.Click ();
			Thread.Sleep (5000);
			ITouchAction a1 = new TouchAction ();
			a1.Press (140, 100).Release ();
			ITouchAction a2 = new TouchAction ();
			a2.Press (250, 100).Release ();
			ITouchAction smile = new TouchAction ();
			smile
				.Press (110, 200)
				.MoveTo(1, 1)
				.MoveTo(1, 1)
				.MoveTo(1, 1)
				.MoveTo(1, 1)
				.MoveTo(1, 1)
				.MoveTo(2, 1)
				.MoveTo(2, 1)
				.MoveTo(2, 1)
				.MoveTo(2, 1)
				.MoveTo(2, 1)
				.MoveTo(3, 1)
				.MoveTo(3, 1)
				.MoveTo(3, 1)
				.MoveTo(3, 1)
				.MoveTo(3, 1)
				.MoveTo(4, 1)
				.MoveTo(4, 1)
				.MoveTo(4, 1)
				.MoveTo(4, 1)
				.MoveTo(4, 1)
				.MoveTo(5, 1)
				.MoveTo(5, 1)
				.MoveTo(5, 1)
				.MoveTo(5, 1)
				.MoveTo(5, 1)
				.MoveTo(5, 0)
				.MoveTo(5, 0)
				.MoveTo(5, 0)
				.MoveTo(5, 0)
				.MoveTo(5, 0)
				.MoveTo(5, 0)
				.MoveTo(5, 0)
				.MoveTo(5, 0)
				.MoveTo(5, -1)
				.MoveTo(5, -1)
				.MoveTo(5, -1)
				.MoveTo(5, -1)
				.MoveTo(5, -1)
				.MoveTo(4, -1)
				.MoveTo(4, -1)
				.MoveTo(4, -1)
				.MoveTo(4, -1)
				.MoveTo(4, -1)
				.MoveTo(3, -1)
				.MoveTo(3, -1)
				.MoveTo(3, -1)
				.MoveTo(3, -1)
				.MoveTo(3, -1)
				.MoveTo(2, -1)
				.MoveTo(2, -1)
				.MoveTo(2, -1)
				.MoveTo(2, -1)
				.MoveTo(2, -1)
				.MoveTo(1, -1)
				.MoveTo(1, -1)
				.MoveTo(1, -1)
				.MoveTo(1, -1)
				.MoveTo(1, -1)
				.Release();

			IMultiAction m = new MultiAction (driver);
			m.Add (a1).Add(a2).Add(smile);
			m.Perform ();
			Thread.Sleep (10000);
			driver.Navigate ().Back ();
			Thread.Sleep (1000);
			driver.Navigate ().Back ();
			Thread.Sleep (1000);
            driver.GetScreenshot();
		}
        public void SingleMultiActionTestCase()
        {
            IList<AppiumWebElement> els = driver.FindElementsByClassName("android.widget.TextView");
            var loc1 = els[7].Location;
            AppiumWebElement target = els[1];
            var loc2 = target.Location;

            TouchAction swipe = new TouchAction(driver);

            swipe.Press(loc1.X, loc1.Y).Wait(1000)
                    .MoveTo(loc2.X, loc2.Y).Release();

            MultiAction multiAction = new MultiAction(driver);
            multiAction.Add(swipe).Perform();
            Assert.AreNotEqual(loc2.Y, target.Location.Y);
        }