Skip to content

Commit

Permalink
Merge pull request #23 from King-of-Spades/UITest-Inheirt
Browse files Browse the repository at this point in the history
UITest inheirit
  • Loading branch information
King-of-Spades authored Feb 2, 2019
2 parents de3f478 + 19d1cb7 commit 6853b45
Show file tree
Hide file tree
Showing 16 changed files with 979 additions and 1,100 deletions.
545 changes: 0 additions & 545 deletions Xamarin.UITest/FormsGallery/FormsGallery.UITest/CSTests.cs

This file was deleted.

72 changes: 72 additions & 0 deletions Xamarin.UITest/FormsGallery/FormsGallery.UITest/Cells.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
using System;
using System.IO;
using System.Linq;
using System.Threading;
using NUnit.Framework;
using Xamarin.UITest;
using Xamarin.UITest.Queries;

namespace FormsGallery.UITest
{
[TestFixture(Platform.Android)]
[TestFixture(Platform.iOS)]
public class Cells : HelperMethods
{
public Cells(Platform platform)
{
this.platform = platform;
}

[Test]
public void TextCell()
{
for (int i = 0; i >= 1; i++)
{
OpenPage("TextCell", i);
app.Back();
}
}

[Test]
public void ImageCell()
{
for (int i = 0; i >= 1; i++)
{
OpenPage("ImageCell", i);
app.Back();
}
}

[Test]
public void SwitchCell()
{
for (int i = 0; i >= 1; i++)
{
OpenPage("SwitchCell", i);

if (platform == Platform.Android)
{
app.Tap(x => x.Class("Switch"));
}
else app.Tap(x => x.Class("UISwitch"));

app.Screenshot("Flipped switch");
app.Back();
}
}

[Test]
public void EntryCell()
{
for (int i = 0; i >= 1; i++)
{
OpenPage("EntryCell", i);
app.EnterText("Type text here", "This is an Entry Cell");
app.Screenshot("Text entered into Entry Cell");
app.DismissKeyboard();
app.Screenshot("Keyboard Dismissed");
app.Back();
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,17 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="CSTests.cs" />
<Compile Include="LayoutsWithMultipleChildren.cs" />
<Compile Include="AppInitializer.cs" />
<Compile Include="XamlTests.cs" />
<Compile Include="HelperMethods.cs" />
<Compile Include="ViewsForPresentation.cs" />
<Compile Include="ViewsThatInitiateCommands.cs" />
<Compile Include="ViewsForSettingValues.cs" />
<Compile Include="ViewsForEditingText.cs" />
<Compile Include="ViewsThatDisplayCollections.cs" />
<Compile Include="Cells.cs" />
<Compile Include="Pages.cs" />
<Compile Include="LayoutsWithSingleContent.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
Expand Down
38 changes: 38 additions & 0 deletions Xamarin.UITest/FormsGallery/FormsGallery.UITest/HelperMethods.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
using System;
using NUnit.Framework;
using Xamarin.UITest;

namespace FormsGallery.UITest
{
public class HelperMethods
{

public IApp app;
public Platform platform;

public void OpenPage(string page, int pageType)
{
if (pageType == 0)
{
app.Tap("C# Pages");
app.Screenshot("C# " + page + " page");
}
else
{
app.Tap("XAML Pages");
app.Screenshot("XAML " + page + " page");
}
app.ScrollDownTo(page);
app.Screenshot("Scrolled Down To" + page);
app.Tap(x => x.Marked(page));
app.Screenshot(page);
}

[SetUp]
public void BeforeEachTest()
{
app = AppInitializer.StartApp(platform);
}

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
using System;
using System.IO;
using System.Linq;
using System.Threading;
using NUnit.Framework;
using Xamarin.UITest;
using Xamarin.UITest.Queries;

namespace FormsGallery.UITest
{
[TestFixture(Platform.Android)]
[TestFixture(Platform.iOS)]
public class LayoutsWithMultipleChildren : HelperMethods
{
public LayoutsWithMultipleChildren(Platform platform)
{
this.platform = platform;
}

[Test]
public void StackLayout()
{
for (int i = 0; i >= 1; i++)
{
OpenPage("StackLayout", i);
app.Back();
}
}

[Test]
public void AbsoluteLayout()
{
for (int i = 0; i >= 1; i++)
{
OpenPage("AbsoluteLayout", i);
app.Screenshot("Additional screenshot to catch them moving");
app.Back();
}
}

[Test]
public void Grid()
{
for (int i = 0; i >= 1; i++)
{
OpenPage("Grid", i);
app.Back();
}
}

[Test]
public void RelativeLayout()
{
for (int i = 0; i >= 1; i++)
{
OpenPage("RelativeLayout", i);
app.Back();
}
}

[Test]
public void FlexLayout()
{
for (int i = 0; i >= 1; i++)
{
OpenPage("FlexLayout", i);

// Right to left
app.SwipeRightToLeft();
app.Screenshot("Swiped right to left");
// Left to right
app.SwipeLeftToRight();
app.Screenshot("Swiped left to right");
// Down
app.ScrollDown();
app.Screenshot("Scrolled Down");
// Up
app.ScrollUp();
app.Screenshot("Scrolled Up");
// end
app.Back();
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
using System;
using System.IO;
using System.Linq;
using System.Threading;
using NUnit.Framework;
using Xamarin.UITest;
using Xamarin.UITest.Queries;

namespace FormsGallery.UITest
{
[TestFixture(Platform.Android)]
[TestFixture(Platform.iOS)]
public class LayoutsWithSingleContent : HelperMethods
{
public LayoutsWithSingleContent(Platform platform)
{
this.platform = platform;
}

[Test]
public void ContentView()
{
for (int i = 0; i >= 1; i++)
{
OpenPage("ContentView", i);
app.Back();
}
}

[Test]
public void Frame()
{
for (int i = 0; i >= 1; i++)
{
OpenPage("Frame", i);
app.Back();
}
}

[Test]
public void ScrollView()
{
for (int i = 0; i >= 1; i++)
{
OpenPage("ScrollView", i);
app.ScrollDown();
app.Screenshot("Scrolled down");
app.ScrollUp();
app.Screenshot("Scrolled back up");
app.Back();
}
}
}
}
Loading

0 comments on commit 6853b45

Please sign in to comment.