public void TestValidCaptcha() { CommentFormPOM commentForm = new CommentFormPOM(driver); string captchaText = commentForm.TxtCaptcha.Text; Console.WriteLine("Captcha: " + captchaText); int sum = commentForm.ReturnNumberFromCaptha(captchaText); commentForm.FillForm("Ljiljana", "This is the second message.", sum.ToString()); new WebDriverWait(driver, TimeSpan.FromSeconds(5)).Until(driver => commentForm.MsgSuccess); Console.WriteLine("Message shown: " + commentForm.MsgSuccess.Text); Assert.AreEqual(commentForm.MsgSuccess.Text, "Success", "Message 'Success' is not shown on the page."); }
public void TestInvalidCaptcha() { CommentFormPOM commentForm = new CommentFormPOM(driver); string captchaText = commentForm.TxtCaptcha.Text; Console.WriteLine("Captcha: " + captchaText); commentForm.FillForm("Ljiljana", "This is the first message.", "-1"); new WebDriverWait(driver, TimeSpan.FromSeconds(5)).Until(driver => commentForm.MsgWrongNumber); Console.WriteLine("Message shown: " + commentForm.MsgWrongNumber.Text); string newCaptchaText = commentForm.TxtCaptcha.Text; Console.WriteLine("New captcha: " + newCaptchaText); Assert.AreNotEqual(captchaText, newCaptchaText, "Expected that new captcha " + newCaptchaText + " is not equal to old captcha " + captchaText + " but it is."); }