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 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 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 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 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)); }