Skip to content

Instantly share code, notes, and snippets.

@batmi02
Created May 23, 2019 17:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save batmi02/bc2eb2fb8168985824ba4ba2933b96f3 to your computer and use it in GitHub Desktop.
Save batmi02/bc2eb2fb8168985824ba4ba2933b96f3 to your computer and use it in GitHub Desktop.
Excerpt from MercuryHealthAppTests.cs
[TestMethod]
[TestCategory("UITests")]
public void Add1stDonutTest()
{
var webApp = HomePage.Launch(_applitoolsApiKey,
_applitoolsBatchName,
_applitoolsBatchId,
"Add 1st Donut Test",
_browserType);
try
{
// browse to home page of app
webApp.BrowseToHomePage(_homePageUrl)
.VerifyHomePageReached()
.TakeVisualPicture<HomePage>("Home Page")
//go to nutrition page
.ClickNutritionLink()
.VerifyNutritionPageReached()
// clean up and delete all donuts, take a picture of cleaned up nutrition page
.RemoveAllFood("Donut")
.TakeVisualPicture<NutritionPage>("Nutrition Page")
// click create new link to add new food
.ClickCreateNewLink()
.VerifyCreatePageReached()
.TakeVisualPicture<CreatePage>("Create Page")
// add donut as a food item and click the add button
.SetDescription("Donut")
.ClickCreateButton()
.VerifyNutritionPageReached()
.VerifyFoodInTable("Donut", 1)
.TakeVisualPicture<NutritionPage>("Nutrition Page After Adding Donut")
// clean up and delete all donuts
.RemoveAllFood("Donut")
.TakeVisualPicture<NutritionPage>("Nutrition Paqge After Removing All Donuts");
}
catch (Exception e)
{
Assert.Fail("Exception occured during test run: " + e);
}
finally
{
webApp.Close();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment