summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Core.iOS.UITests/Tests/ScrollViewUITests.cs
blob: 2266c26e0c63770951c9d329f7046c6ab0e36ce4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
using NUnit.Framework;
using Xamarin.UITest;

namespace Xamarin.Forms.Core.UITests
{
	[TestFixture]
	[Category ("ScrollView")]
	internal class ScrollViewGalleryTests : BaseTestFixture
	{
		public ScrollViewGalleryTests ()
		{
		}

		protected override void NavigateToGallery ()
		{
			App.NavigateToGallery (GalleryQueries.ScrollViewGallery);
		}

		[Test]
		[Description ("Scroll element to the start")]
		public void ScrollToElement1Start ()
		{
			//var scroller = App.Query (c => c.Marked ("thescroller"))[0];
			//need to extract the contentOffset on iOS
			App.Tap(c=> c.Marked("Start"));
			App.WaitForElement (c => c.Marked ("the scrollto button"));
			//Assert.Equals (App.Query (c => c.Marked ("the before")).Length, 0);
			App.Screenshot ("Element is  on the top");
		}

		[Test]
		[Description ("Scroll element to the center")]
		public void ScrollToElement2Center ()
		{
			App.Tap(c=> c.Marked("Center"));
			App.WaitForElement (c => c.Marked ("the scrollto button"));
			App.WaitForElement (c => c.Marked ("the before"));
			App.WaitForElement (c => c.Marked ("the after"));
			App.Screenshot ("Element is in the center");
		}

		[Test]
		[Description ("Scroll element to the end")]
		public void ScrollToElement3End ()
		{
			App.Tap(c=> c.Marked("End"));
			App.WaitForElement (c => c.Marked ("the scrollto button"));
			//Assert.Equals (App.Query (c => c.Marked ("the after")).Length, 0);
			App.Screenshot ("Element is in the end");
		}

		[Test]
		[Description ("ScrollTo Y = 100")]
		public void ScrollToY ()
		{
			App.Tap(c=> c.Marked("Scroll to 100"));
		}

		[Test]
		[Description ("ScrollTo Y = 100 no animation")]
		public void ScrollToYNoAnim ()
		{
			App.ScrollDown ();
			App.ScrollDown ();
			App.Tap (c => c.Marked ("Scroll to 100 no anim"));
		}
	}
}