From ac1f807dabb7dc0a6a7f8edc05d9948cb615148d Mon Sep 17 00:00:00 2001 From: Jakub Raczek Date: Fri, 6 Dec 2024 11:41:51 +0100 Subject: [PATCH] fixed tests --- .../Ocaramba.Documentation.shfbproj | 6 +++-- .../Tests/HerokuappTestsNUnit.cs | 23 +++++++++---------- .../TheInternet/MultipleWindowsPage.cs | 2 +- .../Extensions/WebDriverExtensions.cs | 1 + 4 files changed, 17 insertions(+), 15 deletions(-) diff --git a/Ocaramba.Documentation/Ocaramba.Documentation.shfbproj b/Ocaramba.Documentation/Ocaramba.Documentation.shfbproj index 087117f5b..7887edd74 100644 --- a/Ocaramba.Documentation/Ocaramba.Documentation.shfbproj +++ b/Ocaramba.Documentation/Ocaramba.Documentation.shfbproj @@ -54,8 +54,9 @@ False Framework to automate tests using Selenium WebDriver ocaramba%40objectivity.co.uk - http://www.objectivity.co.uk/ - ocarmaba%40objectivity.co.uk + http://www.accenture.com + + Blank Summary, Parameter, Returns, AutoDocumentCtors, TypeParameter, AutoDocumentDispose @@ -77,6 +78,7 @@ + .NET Framework 4.7.2 diff --git a/Ocaramba.Tests.NUnit/Tests/HerokuappTestsNUnit.cs b/Ocaramba.Tests.NUnit/Tests/HerokuappTestsNUnit.cs index c7f380ee4..4eb759c1c 100644 --- a/Ocaramba.Tests.NUnit/Tests/HerokuappTestsNUnit.cs +++ b/Ocaramba.Tests.NUnit/Tests/HerokuappTestsNUnit.cs @@ -38,12 +38,10 @@ public void BasicAuthTest() var basicAuthPage = new InternetPage(this.DriverContext).OpenHomePageWithUserCredentials().GoToBasicAuthPage(); - //Verify.That( - // this.DriverContext, - // () => - //Assert.AreEqual( - // "Congratulations! You must have the proper credentials.", - // basicAuthPage.GetCongratulationsInfo)); + Verify.That( + this.DriverContext, + () => Assert.That(basicAuthPage.GetCongratulationsInfo, Is.EqualTo("Congratulations! You must have the proper credentials.")) + ); } [Test] @@ -54,10 +52,11 @@ public void ForgotPasswordTest() var forgotPassword = new ForgotPasswordPage(this.DriverContext); - //Verify.That( - // this.DriverContext, - // () => Assert.AreEqual(5 + 7 + 2, forgotPassword.EnterEmail(5, 7, 2)), - // () => Assert.AreEqual("Your e-mail's been sent!", forgotPassword.ClickRetrievePassword)); + Verify.That( + this.DriverContext, + () => Assert.That(forgotPassword.EnterEmail(5, 7, 2), Is.EqualTo(5 + 7 + 2)), + () => Assert.That(forgotPassword.ClickRetrievePassword, Is.EqualTo("Your e-mail's been sent!")) + ); } [Test] @@ -70,8 +69,8 @@ public void MultipleWindowsTest() .GoToMultipleWindowsPage() .OpenNewWindowPage(); - // Assert.True(newWindowPage.IsPageTile(PageTitle), "wrong page title, should be {0}", PageTitle); - //Assert.True(newWindowPage.IsNewWindowH3TextVisible(PageTitle), "text is not equal to {0}", PageTitle); + Assert.That(newWindowPage.IsPageTile(PageTitle), Is.True, "wrong page title, should be {0}", PageTitle); + Assert.That(newWindowPage.IsNewWindowH3TextVisible(PageTitle), Is.True, "text is not equal to {0}", PageTitle); } [Test] diff --git a/Ocaramba.Tests.PageObjects/PageObjects/TheInternet/MultipleWindowsPage.cs b/Ocaramba.Tests.PageObjects/PageObjects/TheInternet/MultipleWindowsPage.cs index f29adab4d..1f57a9f6b 100644 --- a/Ocaramba.Tests.PageObjects/PageObjects/TheInternet/MultipleWindowsPage.cs +++ b/Ocaramba.Tests.PageObjects/PageObjects/TheInternet/MultipleWindowsPage.cs @@ -40,7 +40,7 @@ public MultipleWindowsPage(DriverContext driverContext) public NewWindowPage OpenNewWindowPage() { this.Driver.GetElement(this.clickHerePageLocator).Click(); - this.Driver.SwitchToWindowUsingUrl(new Uri("http://the-internet.herokuapp.com/windows/new"), 5); + this.Driver.SwitchToWindowUsingUrl(new Uri("https://the-internet.herokuapp.com/windows/new"), 5); return new NewWindowPage(this.DriverContext); } } diff --git a/OcarambaLite/Extensions/WebDriverExtensions.cs b/OcarambaLite/Extensions/WebDriverExtensions.cs index c063aa84f..0c28e3bab 100644 --- a/OcarambaLite/Extensions/WebDriverExtensions.cs +++ b/OcarambaLite/Extensions/WebDriverExtensions.cs @@ -196,6 +196,7 @@ public static void SwitchToWindowUsingUrl(this IWebDriver webDriver, Uri url, do } } + Logger.Debug($"Driver url {driver.Url}"); return false; }); }