public void SavePageSourceNoExistingDirectory() { string pageSourcePath = AppiumUtilities.SavePageSource(this.AppiumDriver, this.TestObject, "TempTestDirectory", "SavePSNoDir"); Assert.IsTrue(File.Exists(pageSourcePath), "Fail to find Page Source"); File.Delete(pageSourcePath); }
public void SavedPageSourceTestObjectAssociation() { string pageSourcePath = AppiumUtilities.SavePageSource(this.AppiumDriver, this.TestObject, "TempTestDirectory", "TestObjAssoc"); Assert.IsTrue(this.TestObject.ContainsAssociatedFile(pageSourcePath), "Failed to find page source"); File.Delete(pageSourcePath); }
public void IntializeTest() { AppiumUtilities au = new AppiumUtilities(); AndroidContext = au.InitializeAndrioidApp(); ScenarioContext.Current["andriotContext"] = AndroidContext; }
public void CaptureScreenshotTest() { AppiumUtilities.CaptureScreenshot(this.TestObject.AppiumDriver, this.TestObject); string filePath = Path.ChangeExtension(((FileLogger)this.Log).FilePath, ".png"); Assert.IsTrue(File.Exists(filePath), "Fail to find screenshot"); File.Delete(filePath); }
public void SavePageSourceNoExistingDirectoryDeprecated() { #pragma warning disable CS0618 // Type or member is obsolete string pageSourcePath = AppiumUtilities.SavePageSource(this.AppiumDriver, "TempTestDirectory", "OldSavePSNoDir"); #pragma warning restore CS0618 // Type or member is obsolete Assert.IsTrue(File.Exists(pageSourcePath), "Fail to find Page Source"); File.Delete(pageSourcePath); }
public void CaptureScreenshotTestObjectAssociation() { AppiumUtilities.CaptureScreenshot(this.TestObject.AppiumDriver, this.TestObject); string filePath = Path.ChangeExtension(((FileLogger)this.Log).FilePath, ".Png"); Assert.IsTrue(this.TestObject.ContainsAssociatedFile(filePath), "Failed to find screenshot"); File.Delete(filePath); }
public void SavePageSourceTest() { AppiumUtilities.SavePageSource(this.TestObject.AppiumDriver, this.TestObject); string logLocation = ((FileLogger)this.Log).FilePath; string pageSourceFilelocation = $"{logLocation.Substring(0, logLocation.LastIndexOf('.'))}_PS.txt"; Assert.IsTrue(File.Exists(pageSourceFilelocation), "Failed to find page source"); File.Delete(pageSourceFilelocation); }
public void CaptureScreenshotTestDeprecated() { #pragma warning disable CS0618 // Type or member is obsolete AppiumUtilities.CaptureScreenshot(this.TestObject.AppiumDriver, this.Log); #pragma warning restore CS0618 // Type or member is obsolete string filePath = Path.ChangeExtension(((FileLogger)this.Log).FilePath, ".png"); Assert.IsTrue(File.Exists(filePath), "Fail to find screenshot"); File.Delete(filePath); }
public void SavePageSourceThrownException() { FileLogger tempLogger = new FileLogger(); tempLogger.FilePath = "<>"; // illegal file path this.TestObject.Log = tempLogger; bool successfullyCaptured = AppiumUtilities.SavePageSource(this.AppiumDriver, this.TestObject); Assert.IsFalse(successfullyCaptured); }
public void SavePageSourceThrownExceptionDeprecated() { FileLogger tempLogger = new FileLogger(); tempLogger.FilePath = "<>"; // illegal file path #pragma warning disable CS0618 // Type or member is obsolete bool successfullyCaptured = AppiumUtilities.SavePageSource(this.AppiumDriver, tempLogger); #pragma warning restore CS0618 // Type or member is obsolete Assert.IsFalse(successfullyCaptured); }
public void SavePageSourceTestDeprecated() { #pragma warning disable CS0618 // Type or member is obsolete AppiumUtilities.SavePageSource(this.TestObject.AppiumDriver, this.Log); #pragma warning restore CS0618 // Type or member is obsolete string logLocation = ((FileLogger)this.Log).FilePath; string pageSourceFilelocation = logLocation.Substring(0, logLocation.LastIndexOf('.')) + "_PS.txt"; Assert.IsTrue(File.Exists(pageSourceFilelocation), "Failed to find page source"); File.Delete(pageSourceFilelocation); }
public void CaptureScreenshotThrownException() { FileLogger tempLogger = new FileLogger { FilePath = "\\<>/" // illegal file path }; this.TestObject.Log = tempLogger; bool successfullyCaptured = AppiumUtilities.CaptureScreenshot(this.TestObject.AppiumDriver, this.TestObject); Assert.IsFalse(successfullyCaptured); }
public void CaptureScreenshotThrownExceptionDeprecated() { FileLogger tempLogger = new FileLogger { FilePath = "<>" // illegal file path }; #pragma warning disable CS0618 // Type or member is obsolete bool successfullyCaptured = AppiumUtilities.CaptureScreenshot(TestObject.AppiumDriver, tempLogger); #pragma warning restore CS0618 // Type or member is obsolete Assert.IsFalse(successfullyCaptured); }
public void CaptureScreenshotWithConsoleLoggerTest() { // Create a console logger and calculate the file location ConsoleLogger consoleLogger = new ConsoleLogger(); this.TestObject.Log = consoleLogger; // Take a screenshot bool success = AppiumUtilities.CaptureScreenshot(this.TestObject.AppiumDriver, this.TestObject, "Delete"); // Make sure we didn't take the screenshot Assert.IsFalse(success, "Screenshot taken with console logger"); }
public void CaptureScreenshotWithConsoleLoggerTestDeprecated() { // Create a console logger and calculate the file location ConsoleLogger consoleLogger = new ConsoleLogger(); // Take a screenshot #pragma warning disable CS0618 // Type or member is obsolete bool success = AppiumUtilities.CaptureScreenshot(TestObject.AppiumDriver, consoleLogger, "Delete"); #pragma warning restore CS0618 // Type or member is obsolete // Make sure we didn't take the screenshot Assert.IsFalse(success, "Screenshot taken with console logger"); }
public void GetWaitDriverTest() { AppiumDriver <IWebElement> driver = AppiumDriverFactory.GetDefaultMobileDriver(); WebDriverWait wait = AppiumUtilities.GetDefaultWaitDriver(driver); try { Assert.IsNotNull(wait); } finally { driver.Quit(); driver.Dispose(); } }
public void CapturePageSourceWithConsoleLoggerTest() { string name = Guid.NewGuid().ToString(); string path = Path.Combine(Path.GetDirectoryName((this.Log as FileLogger).FilePath), $"PageSource{name}.txt"); // Create a console logger and calculate the file location ConsoleLogger consoleLogger = new ConsoleLogger(); this.TestObject.Log = consoleLogger; // Capture page source bool success = AppiumUtilities.SavePageSource(this.TestObject.AppiumDriver, this.TestObject, name); // Make sure we can save the page source Assert.IsTrue(success, "Page source file should have been saved"); Assert.IsTrue(File.Exists(path)); }
public void CleanUp() { var end = jsonFile("platfromOS"); switch (end) { case "android": AppiumUtilities.CloseMobileApp(); break; case "ios": AppiumUtilities.CloseMobileApp(); break; case "chrome": driver.Quit(); break; default: break; } ExtentClose(); }