Example #1
0
        public void CreateFileTest()
        {
            // Arrange
            DirectoryInfo keyFileInfo = new DirectoryInfo(TestKeyFile);
            string        keyFilePath = keyFileInfo.FullName;

            // Act

            // Working in the master form
            ApplicationSession.FindElementByName("CreateNewButton").Click();
            ApplicationSession.FindElementByName("Yes").Click();

            // Save current working file if one is opened
            try {
                Thread.Sleep(TimeSpan.FromSeconds(1)); // Wait for 1 second in case save as dialog appears
                ApplicationSession.FindElementByName("Yes").Click();
            }
            catch { }

            Thread.Sleep(TimeSpan.FromSeconds(1));

            // Working in the windows save dialog
            ApplicationSession.FindElementByAccessibilityId("FileNameControlHost").SendKeys(TargetFileLocation + TestFileCSV);
            ApplicationSession.FindElementByName("Save").Click();

            // Check if the Save As dialog appears when there's a leftover test file from previous test run
            try {
                Thread.Sleep(TimeSpan.FromSeconds(1)); // Wait for 1 second in case save as dialog appears
                ApplicationSession.FindElementByName("Confirm Save As").FindElementByName("Yes").Click();
            }
            catch { }

            Thread.Sleep(TimeSpan.FromSeconds(1));

            // Working in master password gen form
            ApplicationSession.FindElementByName("PassEntry1").SendKeys("password");
            ApplicationSession.FindElementByName("PassEntry2").SendKeys("password");
            ApplicationSession.FindElementByName("Ok").Click();

            Thread.Sleep(TimeSpan.FromSeconds(1));

            // Working in master password print pop up form
            ApplicationSession.FindElementByName("No").Click();

            Thread.Sleep(TimeSpan.FromSeconds(3));

            // Assert
            Assert.IsTrue(File.Exists(TargetFileLocation + TestFileGZ));
        }