public void ClickOnBuyButton() { // Run a copy of MatterControl Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) => { AutomationRunner testRunner = new AutomationRunner(MatterControlUtilities.DefaultTestImages); { //Make sure image does not exist before we click the buy button testRunner.MatchLimit = 500000; bool imageExists = testRunner.ImageExists("MatterHackersStoreImage.png"); resultsHarness.AddTestResult(imageExists == false, "Web page is not open"); //Click Buy button and test that the MatterHackers store web page is open testRunner.ClickByName("Buy Materials Button", 5); bool imageExists2 = testRunner.ImageExists("MatterHackersStoreImage.png", 10); resultsHarness.AddTestResult(imageExists2 == true, "Web page is open"); MatterControlUtilities.CloseMatterControl(testRunner); } }; AutomationTesterHarness testHarness = MatterControlUtilities.RunTest(testToRun, queueItemFolderToAdd: QueueTemplate.Three_Queue_Items); Assert.IsTrue(testHarness.AllTestsPassed); Assert.IsTrue(testHarness.TestCount == 2); // make sure we ran all our tests }
public void ClickOnBuyButton() { // Run a copy of MatterControl Action<AutomationTesterHarness> testToRun = (AutomationTesterHarness resultsHarness) => { AutomationRunner testRunner = new AutomationRunner(MatterControlUITests.DefaultTestImages); { //Make sure image does not exist before we click the buy button testRunner.MatchLimit = 500000; bool imageExists = testRunner.ImageExists("MatterHackersStoreImage.png"); resultsHarness.AddTestResult(imageExists == false, "Web page is not open"); //Click Buy button and test that the MatterHackers store web page is open testRunner.ClickByName("Buy Materials Button", secondsToWait: 5); bool imageExists2 = testRunner.ImageExists("MatterHackersStoreImage.png", 10); resultsHarness.AddTestResult(imageExists2 == true, "Web page is open"); MatterControlUITests.CloseMatterControl(testRunner); } }; #if !__ANDROID__ // Set the static data to point to the directory of MatterControl StaticData.Instance = new MatterHackers.Agg.FileSystemStaticData(Path.Combine("..", "..", "..", "..", "StaticData")); #endif bool showWindow; MatterControlApplication matterControlWindow = MatterControlApplication.CreateInstance(out showWindow); AutomationTesterHarness testHarness = AutomationTesterHarness.ShowWindowAndExectueTests(matterControlWindow, testToRun, 60); Assert.IsTrue(testHarness.AllTestsPassed); Assert.IsTrue(testHarness.TestCount == 2); // make sure we ran all our tests }