Skip to content

Commit 4944aa6

Browse files
Add ReadStory Test
1 parent f1f604a commit 4944aa6

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

Src/HackerNews.UITests/Pages/NewsPage.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ public NewsPage(IApp app) : base(app, PageTitleConstants.NewsPageTitle)
2323
_ => throw new NotSupportedException(),
2424
};
2525

26+
public bool IsBrowserOpen => App switch
27+
{
28+
iOSApp iOSApp => iOSApp.Query(x => x.Class("SFSafariView")).Any(),
29+
_ => throw new NotSupportedException("Browser Can Only Be Verified on iOS")
30+
};
31+
2632
public override void WaitForPageToLoad()
2733
{
2834
base.WaitForPageToLoad();

Src/HackerNews.UITests/Tests/Tests.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
using System.Linq;
12
using HackerNews.Shared;
23
using NUnit.Framework;
34
using Xamarin.UITest;
5+
using Xamarin.UITest.iOS;
46

57
namespace HackerNews.UITests
68
{
@@ -32,5 +34,21 @@ public void DownloadTopStories()
3234
Assert.LessOrEqual(actualNumberOfStories, expectedNumberOfStories);
3335
Assert.Greater(actualNumberOfStories, 0);
3436
}
37+
38+
[Test]
39+
public void ReadStory()
40+
{
41+
//Arrange
42+
var topStory = NewsPage.GetStoryList().First();
43+
44+
//Act
45+
App.Tap(topStory.Title);
46+
47+
//Assert
48+
if(App is iOSApp)
49+
{
50+
Assert.IsTrue(NewsPage.IsBrowserOpen);
51+
}
52+
}
3553
}
3654
}

0 commit comments

Comments
 (0)