Best Ocaramba code snippet using Ocaramba.Tests.PageObjects.PageObjects.TheInternet.FloatingMenuPage
HerokuappTestsMsTest.cs
Source:HerokuappTestsMsTest.cs
1// <copyright file="HerokuappTestsMsTest.cs" company="Objectivity Bespoke Software Specialists">2// Copyright (c) Objectivity Bespoke Software Specialists. All rights reserved.3// </copyright>4// <license>5// The MIT License (MIT)6// Permission is hereby granted, free of charge, to any person obtaining a copy7// of this software and associated documentation files (the "Software"), to deal8// in the Software without restriction, including without limitation the rights9// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell10// copies of the Software, and to permit persons to whom the Software is11// furnished to do so, subject to the following conditions:12// The above copyright notice and this permission notice shall be included in all13// copies or substantial portions of the Software.14// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR15// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,16// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE17// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER18// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,19// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE20// SOFTWARE.21// </license>22namespace Ocaramba.Tests.MsTest.Tests23{24 using System.Diagnostics.CodeAnalysis;25 using System.Xml;26 using System.Data;27 using Microsoft.VisualStudio.TestTools.UnitTesting;28 using Ocaramba;29 using Ocaramba.Tests.PageObjects.PageObjects.TheInternet;30 /// <summary>31 /// Tests to verify checkboxes tick and Untick.32 /// </summary>33 [TestClass]34 [SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1650:ElementDocumentationMustBeSpelledCorrectly", Justification = "Reviewed. Suppression is OK here.")]35 public class HerokuappTestsMsTest : ProjectTestBase36 {37 [TestMethod]38 public void TickCheckboxTest()39 {40 var checkboxes = new InternetPage(this.DriverContext)41 .OpenHomePage()42 .GoToCheckboxesPage()43 .TickCheckboxOne();44 Assert.IsTrue(checkboxes.IsCheckmarkOneTicked, "Checkbox1 is unticked!");45 }46 [TestMethod]47 public void UnTickCheckboxTest()48 {49 var checkboxes = new InternetPage(this.DriverContext)50 .OpenHomePage()51 .GoToCheckboxesPage()52 .UnTickCheckboxTwo();53 Assert.IsFalse(checkboxes.IsCheckmarkTwoTicked, "Checkbox2 is ticked!");54 }55 [TestMethod]56 public void PageSourceContainsCaseTest()57 {58 const string ExpectedText = "HTTP status codes are a standard set of numbers used to communicate from a web server";59 var statusCodes = new InternetPage(this.DriverContext)60 .OpenHomePage()61 .GoToStatusCodesPage();62 Assert.IsTrue(statusCodes.IsTextExistedInPageSource(ExpectedText), "Text is not present!");63 }64 [TestMethod]65 public void JavaScriptClickTest()66 {67 HttpCode200Page httpCode200 = new InternetPage(this.DriverContext)68 .OpenHomePage()69 .GoToStatusCodesPage()70 .Click200();71 Assert.IsTrue(httpCode200.IsHTTPCode200PageIsDisplayed(), "Code 200 was not clicked or page is not displayed.");72 }73 [TestMethod]74 public void ClickFloatingMenuTest()75 {76 var floatingMenuPage = new InternetPage(this.DriverContext)77 .OpenHomePage()78 .GoToFloatingMenu()79 .ClickFloatingMenuButton();80 Assert.IsTrue(floatingMenuPage.IsUrlEndsWith("#home"), "URL does not end with #home - probably 'Home' floating menu button was not clicked properly");81 }82#if net4783 [DeploymentItem("Ocaramba.Tests.MsTest\\DDT.xml")]84 [DeploymentItem("Ocaramba.Tests.MsTest\\IEDriverServer.exe")]85 [DataSource("Microsoft.VisualStudio.TestTools.DataSource.XML", "|DataDirectory|\\DDT.xml", "credential", DataAccessMethod.Sequential)]86 [TestMethod]87 public void FormAuthenticationPageTest()88 {89 var formFormAuthentication = new InternetPage(this.DriverContext)90 .OpenHomePage()91 .GoToFormAuthenticationPage();92 formFormAuthentication.EnterUserName((string)this.TestContext.DataRow["user"]);93 formFormAuthentication.EnterPassword((string)this.TestContext.DataRow["password"]);94 formFormAuthentication.LogOn();95 Verify.That(96 this.DriverContext,97 () => Assert.AreEqual((string)this.TestContext.DataRow["message"], formFormAuthentication.GetMessage));98 }99#endif100#if net47101 [DeploymentItem("Ocaramba.Tests.MsTest\\DDT.csv")]102 [DataSource("Microsoft.VisualStudio.TestTools.DataSource.CSV", "|DataDirectory|\\DDT.csv", "DDT#csv", DataAccessMethod.Sequential)]103 [TestMethod]104 public void FormAuthenticationPageCsvDataDrivenTest()105 {106 var formFormAuthentication = new InternetPage(this.DriverContext)107 .OpenHomePage()108 .GoToFormAuthenticationPage();109 formFormAuthentication.EnterUserName((string)this.TestContext.DataRow["user"]);110 formFormAuthentication.EnterPassword((string)this.TestContext.DataRow["password"]);111 formFormAuthentication.LogOn();112 Verify.That(113 this.DriverContext,114 () => Assert.AreEqual((string)this.TestContext.DataRow["message"], formFormAuthentication.GetMessage));115 }116#endif117 [TestMethod]118 public void VerifyTest()119 {120 Verify.That(this.DriverContext, () => Assert.AreEqual(1, 1), () => Assert.AreEqual(2, 2), () => Assert.AreEqual(3, 3));121 Verify.That(this.DriverContext, () => Assert.IsFalse(false), enableScreenShot: true, enableSavePageSource: true);122 Verify.That(this.DriverContext, () => Assert.IsTrue(true));123 }124 [TestMethod]125 public void ToByTest()126 {127 string expectedDescription = @"Also known as split testing. This is a way in which businesses are able to simultaneously test and learn different versions of a page to see which text and/or functionality works best towards a desired outcome (e.g. a user action such as a click-through).";128 new InternetPage(this.DriverContext)129 .OpenHomePage()130 .GoToPage("abtest");131 var abeTestingPage = new AbTestingPage(this.DriverContext);132 Assert.AreEqual(expectedDescription, abeTestingPage.GetDescriptionUsingBy);133 }134 [TestMethod]135 public void GetElementTest()136 {137 string expectedDescription = @"Also known as split testing. This is a way in which businesses are able to simultaneously test and learn different versions of a page to see which text and/or functionality works best towards a desired outcome (e.g. a user action such as a click-through).";138 new InternetPage(this.DriverContext)139 .OpenHomePage()140 .GoToPage("abtest");141 var abeTestingPage = new AbTestingPage(this.DriverContext);142 Assert.AreEqual(expectedDescription, abeTestingPage.GetDescription);143 }144 [TestMethod]145 public void GetElementTestWithCustomTimeoutTest()146 {147 string expectedDescription = @"Also known as split testing. This is a way in which businesses are able to simultaneously test and learn different versions of a page to see which text and/or functionality works best towards a desired outcome (e.g. a user action such as a click-through).";148 new InternetPage(this.DriverContext)149 .OpenHomePage()150 .GoToPage("abtest");151 var abeTestingPage = new AbTestingPage(this.DriverContext);152 Assert.AreEqual(expectedDescription, abeTestingPage.GetDescriptionWithCustomTimeout);153 }154 [TestMethod]155 public void WaitElementDissapearsTest()156 {157 new InternetPage(this.DriverContext)158 .OpenHomePage()159 .GoToPage("disappearing_elements");160 var disappearingElements = new DisappearingElementsPage(this.DriverContext);161 disappearingElements.RefreshAndWaitLinkNotVisible("NotExistingLink");162 }163 [TestMethod]164 public void GetElementWithCustomConditionTest()165 {166 new InternetPage(this.DriverContext)167 .OpenHomePage()168 .GoToPage("disappearing_elements");169 var disappearingElementsPage = new DisappearingElementsPage(this.DriverContext);170 var currentTagName = disappearingElementsPage.GetLinkTitleTagName("Home");171 Assert.AreEqual("a", currentTagName);172 }173 [TestMethod]174 public void GetElementWithCustomTimeoutAndConditionTest()175 {176 new InternetPage(this.DriverContext)177 .OpenHomePage()178 .GoToPage("disappearing_elements");179 var disappearingElementsPage = new DisappearingElementsPage(this.DriverContext);180 var currentIsSelected = disappearingElementsPage.IsLinkSelected("Home");181 Assert.AreEqual(false, currentIsSelected);182 }183 }184}...
FloatingMenuPage.cs
Source:FloatingMenuPage.cs
1// <copyright file="FloatingMenuPage.cs" company="Objectivity Bespoke Software Specialists">2// Copyright (c) Objectivity Bespoke Software Specialists. All rights reserved.3// </copyright>4// <license>5// The MIT License (MIT)6// Permission is hereby granted, free of charge, to any person obtaining a copy7// of this software and associated documentation files (the "Software"), to deal8// in the Software without restriction, including without limitation the rights9// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell10// copies of the Software, and to permit persons to whom the Software is11// furnished to do so, subject to the following conditions:12// The above copyright notice and this permission notice shall be included in all13// copies or substantial portions of the Software.14// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR15// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,16// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE17// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER18// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,19// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE20// SOFTWARE.21// </license>22namespace Ocaramba.Tests.PageObjects.PageObjects.TheInternet23{24 using System;25 using NLog;26 using Ocaramba;27 using Ocaramba.Extensions;28 using Ocaramba.Types;29 public class FloatingMenuPage : ProjectPageBase30 {31#if net4732 private static readonly NLog.Logger Logger = LogManager.GetCurrentClassLogger();33#endif34#if netcoreapp3_135 private static readonly NLog.Logger Logger = NLog.Web.NLogBuilder.ConfigureNLog("nlog.config").GetCurrentClassLogger();36#endif37 private readonly ElementLocator floatingMenuPageText = new ElementLocator(38 Locator.CssSelector,39 "div.scroll");40 private readonly ElementLocator floatingHomeButton = new ElementLocator(41 Locator.CssSelector,42 "a[href='#home']");43 public FloatingMenuPage(DriverContext driverContext)44 : base(driverContext)45 {46 Logger.Info("Waiting for File Download page to open");47 //// this.Driver.IsElementPresent(this.floatingMenuPageText, BaseConfiguration.ShortTimeout);48 }49 public FloatingMenuPage ClickFloatingMenuButton()50 {51 this.Driver.ScrollIntoMiddle(this.floatingMenuPageText);52 this.Driver.GetElement(this.floatingHomeButton).Click();53 return this;54 }55 public bool IsUrlEndsWith(string text)56 {57 return this.DriverContext.Driver.Url.ToString().EndsWith(text, StringComparison.CurrentCulture);58 }59 }60}...
FloatingMenuPage
Using AI Code Generation
1using Ocaramba.Tests.PageObjects.PageObjects.TheInternet;2using Ocaramba.Tests.PageObjects.PageObjects.TheInternet;3using Ocaramba.Tests.PageObjects.PageObjects.TheInternet;4using Ocaramba.Tests.PageObjects.PageObjects.TheInternet;5using Ocaramba.Tests.PageObjects.PageObjects.TheInternet;6using Ocaramba.Tests.PageObjects.PageObjects.TheInternet;7using Ocaramba.Tests.PageObjects.PageObjects.TheInternet;8using Ocaramba.Tests.PageObjects.PageObjects.TheInternet;9using Ocaramba.Tests.PageObjects.PageObjects.TheInternet;10using Ocaramba.Tests.PageObjects.PageObjects.TheInternet;11using Ocaramba.Tests.PageObjects.PageObjects.TheInternet;12using Ocaramba.Tests.PageObjects.PageObjects.TheInternet;13using Ocaramba.Tests.PageObjects.PageObjects.TheInternet;14using Ocaramba.Tests.PageObjects.PageObjects.TheInternet;15using Ocaramba.Tests.PageObjects.PageObjects.TheInternet;
FloatingMenuPage
Using AI Code Generation
1using Ocaramba.Tests.PageObjects.PageObjects.TheInternet;2using Ocaramba.Tests.PageObjects.PageObjects.TheInternet;3using Ocaramba.Tests.PageObjects.PageObjects.TheInternet;4using Ocaramba.Tests.PageObjects.PageObjects.TheInternet;5using Ocaramba.Tests.PageObjects.PageObjects.TheInternet;6using Ocaramba.Tests.PageObjects.PageObjects.TheInternet;7using Ocaramba.Tests.PageObjects.PageObjects.TheInternet;8using Ocaramba.Tests.PageObjects.PageObjects.TheInternet;9using Ocaramba.Tests.PageObjects.PageObjects.TheInternet;10using Ocaramba.Tests.PageObjects.PageObjects.TheInternet;11using Ocaramba.Tests.PageObjects.PageObjects.TheInternet;12using Ocaramba.Tests.PageObjects.PageObjects.TheInternet;13using Ocaramba.Tests.PageObjects.PageObjects.TheInternet;14using Ocaramba.Tests.PageObjects.PageObjects.TheInternet;15using Ocaramba.Tests.PageObjects.PageObjects.TheInternet;
FloatingMenuPage
Using AI Code Generation
1using Ocaramba.Tests.PageObjects.PageObjects.TheInternet;2using Ocaramba.Tests.PageObjects;3using Ocaramba.Tests.PageObjects.TheInternet;4using Ocaramba.Tests.PageObjects.PageObjects;5using Ocaramba.Tests.PageObjects.TheInternet;6using Ocaramba.Tests.PageObjects.TheInternet;7using Ocaramba.Tests.PageObjects.TheInternet;8using Ocaramba.Tests.PageObjects.PageObjects.TheInternet;9using Ocaramba.Tests.PageObjects;10using Ocaramba.Tests.PageObjects.TheInternet;11using Ocaramba.Tests.PageObjects.PageObjects;12using Ocaramba.Tests.PageObjects.TheInternet;13using Ocaramba.Tests.PageObjects.TheInternet;14using Ocaramba.Tests.PageObjects.TheInternet;15using Ocaramba.Tests.PageObjects.TheInternet;16using Ocaramba.Tests.PageObjects.PageObjects.TheInternet;17using Ocaramba.Tests.PageObjects;
FloatingMenuPage
Using AI Code Generation
1using Ocaramba.Tests.PageObjects.PageObjects.TheInternet;2using Ocaramba;3using NUnit.Framework;4{5 [Parallelizable(ParallelScope.Fixtures)]6 {7 private readonly FloatingMenuPage _floatingMenuPage;8 public FloatingMenuTest(DriverContext driverContext)9 : base(driverContext)10 {11 this._floatingMenuPage = new FloatingMenuPage(this.DriverContext);12 }13 public void FloatingMenuTestTest()14 {15 this._floatingMenuPage.OpenBaseUrl();16 this._floatingMenuPage.AssertFloatingMenuIsDisplayed();17 }18 }19}20using Ocaramba.Tests.PageObjects.PageObjects.TheInternet;21using Ocaramba;22using NUnit.Framework;23{24 [Parallelizable(ParallelScope.Fixtures)]25 {26 private readonly FloatingMenuPage _floatingMenuPage;27 public FloatingMenuTest(DriverContext driverContext)28 : base(driverContext)29 {30 this._floatingMenuPage = new FloatingMenuPage(this.DriverContext);31 }32 public void FloatingMenuTestTest()33 {34 this._floatingMenuPage.OpenBaseUrl();35 this._floatingMenuPage.AssertFloatingMenuIsDisplayed();36 }37 }38}39using Ocaramba.Tests.PageObjects.PageObjects.TheInternet;40using Ocaramba;41using NUnit.Framework;42{43 [Parallelizable(ParallelScope.Fixtures)]44 {45 private readonly FloatingMenuPage _floatingMenuPage;46 public FloatingMenuTest(DriverContext driverContext)47 : base(driverContext)48 {49 this._floatingMenuPage = new FloatingMenuPage(this.DriverContext);50 }51 public void FloatingMenuTestTest()52 {53 this._floatingMenuPage.OpenBaseUrl();54 this._floatingMenuPage.AssertFloatingMenuIsDisplayed();55 }56 }57}
FloatingMenuPage
Using AI Code Generation
1using Ocaramba;2using Ocaramba.Tests.PageObjects.PageObjects.TheInternet;3using Ocaramba.Types;4using NUnit.Framework;5{6 [Parallelizable(ParallelScope.Fixtures)]7 {8 public void FloatingMenuTest()9 {10 var floatingMenuPage = new FloatingMenuPage(this.DriverContext);11 floatingMenuPage.OpenBaseUrl(BaseUrl);12 floatingMenuPage.ScrollToBottom();13 floatingMenuPage.AssertFloatingMenuIsVisible();14 }15 }16}17using Ocaramba;18using Ocaramba.Tests.PageObjects.PageObjects.TheInternet;19using Ocaramba.Types;20using NUnit.Framework;21{22 [Parallelizable(ParallelScope.Fixtures)]23 {24 public void FloatingMenuTest()25 {26 var floatingMenuPage = new FloatingMenuPage(this.DriverContext);27 floatingMenuPage.OpenBaseUrl(BaseUrl);28 floatingMenuPage.ScrollToBottom();29 floatingMenuPage.AssertFloatingMenuIsVisible();30 }31 }32}33using Ocaramba;34using Ocaramba.Tests.PageObjects.PageObjects.TheInternet;35using Ocaramba.Types;36using NUnit.Framework;37{38 [Parallelizable(ParallelScope.Fixtures)]39 {40 public void FloatingMenuTest()41 {42 var floatingMenuPage = new FloatingMenuPage(this.DriverContext);43 floatingMenuPage.OpenBaseUrl(BaseUrl);44 floatingMenuPage.ScrollToBottom();45 floatingMenuPage.AssertFloatingMenuIsVisible();46 }47 }48}
FloatingMenuPage
Using AI Code Generation
1using Ocaramba.Tests.PageObjects.PageObjects.TheInternet;2using Ocaramba;3using Ocaramba.Types;4using NUnit.Framework;5using System;6using System.Collections.Generic;7using System.Linq;8using System.Text;9using System.Threading.Tasks;10using System.Threading;11using System.IO;12using System.Diagnostics;13using System.Reflection;14using System.Collections;15using System.Collections.ObjectModel;16using System.Text.RegularExpressions;17using System.Globalization;18{19 [Parallelizable(ParallelScope.Fixtures)]20 {21 private readonly FloatingMenuPage floatingMenuPage;22 public FloatingMenuPageTests()23 : base(Assembly.GetExecutingAssembly())24 {25 this.floatingMenuPage = new FloatingMenuPage(this.DriverContext);26 }27 public void CheckMenuVisibility()28 {29 this.floatingMenuPage.OpenStartPage();30 this.floatingMenuPage.CheckFloatingMenuVisibility();31 }32 public void CheckMenuHidden()33 {34 this.floatingMenuPage.OpenStartPage();35 this.floatingMenuPage.CheckFloatingMenuHidden();36 }37 public void CheckMenuVisibilityAfterScrollDown()38 {39 this.floatingMenuPage.OpenStartPage();40 this.floatingMenuPage.ScrollDown();41 this.floatingMenuPage.CheckFloatingMenuVisibility();42 }43 public void CheckMenuHiddenAfterScrollUp()44 {45 this.floatingMenuPage.OpenStartPage();46 this.floatingMenuPage.ScrollDown();47 this.floatingMenuPage.ScrollUp();48 this.floatingMenuPage.CheckFloatingMenuHidden();49 }50 }51}52using Ocaramba.Tests.PageObjects.PageObjects.TheInternet;53using Ocaramba;54using Ocaramba.Types;55using NUnit.Framework;56using System;57using System.Collections.Generic;
FloatingMenuPage
Using AI Code Generation
1using Ocaramba.Tests.PageObjects.PageObjects.TheInternet;2using Ocaramba;3using Ocaramba.Extensions;4using NUnit.Framework;5{6 {7 public void VerifyFloatingMenu()8 {9 var floatingMenuPage = new FloatingMenuPage(this.DriverContext);10 floatingMenuPage.OpenBaseUrl(_url);11 floatingMenuPage.AssertFloatingMenu();12 }13 }14}15using Ocaramba;16using Ocaramba.Extensions;17using Ocaramba.Types;18using OpenQA.Selenium;19{20 {21 public FloatingMenuPage(DriverContext driverContext)22 : base(driverContext)23 {24 }25 public void AssertFloatingMenu()26 {27 var floatingMenu = this.Driver.FindElement(By.CssSelector(".menu"));28 Assert.IsTrue(floatingMenu.Displayed);29 Assert.AreEqual("menu", floatingMenu.GetAttribute("id"));30 }31 }32}33using System;34using System.Collections.Generic;35using System.Linq;36using System.Text;37using System.Threading.Tasks;38{39 {40 public ProjectPageBase(DriverContext driverContext)41 : base(driverContext)42 {43 }44 }45}46using System;47using System.Collections.Generic;48using System.Linq;49using System.Text;50using System.Threading.Tasks;51using Ocaramba;52using Ocaramba.Types;53{54 {55 public ProjectTestBase()56 : base(DriverContext.Current)57 {58 }59 }60}
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!