示例#1
0
        /// <summary>
        /// Loads a file into the GUI.
        /// </summary>
        private void OpenTestFile()
        {
            LoadFileTestReset();

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

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

            // Working in the load dialog
            ApplicationSession.FindElementByClassName("Edit").SendKeys(TargetFileLocation + TestFileGZ);
            ApplicationSession.FindElementByClassName("Button").FindElementByName("Open").Click();
            Thread.Sleep(TimeSpan.FromSeconds(2));

            // Working in enter password for file form
            ApplicationSession.FindElementByName("PasswordEntry").SendKeys("password");
            ApplicationSession.FindElementByName("Ok").Click();

            Thread.Sleep(TimeSpan.FromSeconds(4));
        }
示例#2
0
        public void LoadFileWithKeyTest()
        {
            // Arrange
            LoadFileWithKeyTestReset();
            DirectoryInfo keyFileInfo = new DirectoryInfo(TestKeyFile);
            string        keyFilePath = keyFileInfo.FullName;

            // Act

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

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

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

            // Working in the load dialog
            ApplicationSession.FindElementByClassName("Edit").SendKeys(TargetFileLocation + TestFileGZ);
            ApplicationSession.FindElementByClassName("Button").FindElementByName("Open").Click();

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

            // Working in enter password for file form
            ApplicationSession.FindElementByName("PasswordEntry").SendKeys("password");
            ApplicationSession.FindElementByName("FindKeyFile").Click();

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

            // Working in Windows' open file dialog
            ApplicationSession.FindElementByClassName("Edit").SendKeys(keyFilePath);
            ApplicationSession.FindElementByClassName("Button").FindElementByName("Open").Click();

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

            // Working in enter password for file form
            ApplicationSession.FindElementByName("Ok").Click();

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

            // Assert
            Assert.AreEqual(FileOP.GetFile(), TestFileCSV);

            ApplicationSession.FindElementByName("LockButton").Click();
            Thread.Sleep(TimeSpan.FromSeconds(2));
            ApplicationSession.FindElementByName("Yes").Click();
            Thread.Sleep(TimeSpan.FromSeconds(5));
        }
示例#3
0
        public void EditWithRandomPasswordTest()
        {
            // Arrange
            OpenTestFile();

            // Act

            // Working in master form
            ApplicationSession.FindElementByName("AddNewEntry").Click();
            ApplicationSession.FindElementByName("EntryVariablesExpirationTextBox").SendKeys("expdate1");
            ApplicationSession.FindElementByName("EntryVariablesTitleTextBox").SendKeys("title1");
            ApplicationSession.FindElementByName("EntryVariablesUsernameTextBox").SendKeys("user1");
            ApplicationSession.FindElementByName("EntryVariablesUrlTextBox").SendKeys("url1");
            ApplicationSession.FindElementByName("EntryVariablesPasswordTextBox").Click();

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

            // Working in entry password form
            ApplicationSession.FindElementByName("EntryPasswordRandomizeButton").Click();

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

            // Working in random password generator form
            ApplicationSession.FindElementByName("Special").Click();
            ApplicationSession.FindElementByName("UpperCase").Click();
            ApplicationSession.FindElementByName("Brackets").Click();
            ApplicationSession.FindElementByName("Digits").Click();
            ApplicationSession.FindElementByName("CloseButton").Click();

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

            // Working in entry password form
            ApplicationSession.FindElementByName("entryPasswordOkButton").Click();

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

            // Working in master form
            ApplicationSession.FindElementByName("EntryVariablesConfirmButton").Click();
            ApplicationSession.FindElementByName("SaveFileButton").Click();

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

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

            ApplicationSession.FindElementByName("LockButton").Click();
            Thread.Sleep(TimeSpan.FromSeconds(2));
            ApplicationSession.FindElementByName("Yes").Click();
            Thread.Sleep(TimeSpan.FromSeconds(5));
        }
示例#4
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));
        }
示例#5
0
        public void LoadFileTest()
        {
            // Arrange
            LoadFileTestReset();

            // Act

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

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

            // Working in the load dialog
            ApplicationSession.FindElementByClassName("Edit").SendKeys(TargetFileLocation + TestFileGZ);
            ApplicationSession.FindElementByClassName("Button").FindElementByName("Open").Click();

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

            // Working in enter password for file form
            ApplicationSession.FindElementByName("PasswordEntry").SendKeys("password");
            ApplicationSession.FindElementByName("Ok").Click();

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

            // Assert
            Assert.AreEqual(TestFileCSV, FileOP.GetFile());

            ApplicationSession.FindElementByName("LockButton").Click();
            Thread.Sleep(TimeSpan.FromSeconds(2));
            ApplicationSession.FindElementByName("Yes").Click();
            Thread.Sleep(TimeSpan.FromSeconds(5));
        }