Exemplo n.º 1
0
        public void CreateAccount()
        {
            LoginPage     loginPage = new LoginPage();
            CreateAccount account   = new CreateAccount();

            driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10);
            loginPage.ClickCreate();
            driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10);
            account.enterAccountInfo(Data.GetNewAccountEmail(), "Test Account 2", Data.GetPassword(), "The Hint");
            account.ClickSubmit();
            account.ClickYesOnAlert();


            Driver.Navigate().GoToUrl("https://mailsac.com/login");
            MailSac mailSac = new MailSac();

            mailSac.LogIn(Data.GetMailSacUser(), Data.GetPassword());
            driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10);
            mailSac.ClickMailBox2();
            bool emailRecieved = mailSac.IsEmailReceived("Welcome");

            Assert.That(emailRecieved, Is.True, "Can't find the email");
            //TODO: Change to only take screenshot of failed test cases
            GetScreenshot.TakeScreenshot();
            mailSac.DeleteEmail();
        }
Exemplo n.º 2
0
        public void passwordHint()
        {
            LoginPage loginPage = new LoginPage();
            HintPage  hintPage  = new HintPage();

            driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10);
            loginPage.ClickHint();
            hintPage.enterEmail(Data.GetMailSacEmail());
            hintPage.clickSubmit();
            hintPage.clickCancel();

            /*
             * TODO Set this up in a new Tab
             * Driver.FindElement(By.TagName("body")).SendKeys(Keys.Control + "t");
             * Driver.SwitchTo().Window(Driver.WindowHandles.Last());
             */

            Driver.Navigate().GoToUrl("https://mailsac.com/login");
            MailSac mailSac = new MailSac();

            mailSac.LogIn(Data.GetMailSacUser(), Data.GetPassword());
            driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10);
            mailSac.ClickMaiBox();
            bool emailRecieved = mailSac.IsEmailReceived("Your Master Password Hint");

            Assert.That(emailRecieved, Is.True, "Can't find the email");
            //TODO: Change to only take screenshot of failed test cases
            GetScreenshot.TakeScreenshot();
            mailSac.DeleteEmail();
        }
        public void AfterTest()
        {
            var status     = NUnit.Framework.TestContext.CurrentContext.Result.Outcome.Status;
            var stacktrace = string.IsNullOrEmpty(NUnit.Framework.TestContext.CurrentContext.Result.StackTrace)
                    ? ""
                    : string.Format("{0}", NUnit.Framework.TestContext.CurrentContext.Result.StackTrace);
            Status logstatus;
            var    errorMessage = NUnit.Framework.TestContext.CurrentContext.Result.Message;

            switch (status)
            {
            case TestStatus.Failed:
            {
                logstatus = Status.Fail;
                string screenshotPath = GetScreenshot.Capture(driver, "Fail");
                _test.Log(Status.Fail, "Snapshot below: ", MediaEntityBuilder.CreateScreenCaptureFromPath(screenshotPath).Build());
                break;
            }

            case TestStatus.Inconclusive:
                logstatus = Status.Warning;
                break;

            case TestStatus.Skipped:
                logstatus = Status.Skip;
                break;

            default:
                logstatus = Status.Pass;
                break;
            }
            _test.Log(logstatus, "Test ended with " + logstatus + stacktrace);
            _extent.Flush();
        }
Exemplo n.º 4
0
        public void Login()
        {
            Driver.Navigate().GoToUrl("https://testdo.bitwarden.com");
            driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10);

            LoginPage loginPage = new LoginPage();
            VaultPage vaultPage = new VaultPage();

            loginPage.EnterUserNameAndPassword(Data.GetEmail(), Data.GetPassword());
            loginPage.ClickLogin();

            Thread.Sleep(3000);

            Assert.AreEqual(Driver.Url, "https://testdo.bitwarden.com/#/vault", "URL doesn't match");
            GetScreenshot.TakeScreenshot();
        }