Пример #1
0
        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);
        }
Пример #2
0
        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);
        }
Пример #3
0
        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);
        }
Пример #4
0
        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);
        }
Пример #5
0
        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);
        }
Пример #6
0
        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);
        }
Пример #7
0
        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);
        }
Пример #8
0
        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));
        }