Best Ocaramba code snippet using Ocaramba.Tests.PageObjects.PageObjects.TheInternet.FloatingMenuPage.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 netcoreapp2_235        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;2using Ocaramba.Tests.PageObjects.PageObjects.TheInternet;3using NUnit.Framework;4{5    [Parallelizable(ParallelScope.Fixtures)]6    {7        private readonly string url = BaseConfiguration.GetUrlValue;8        public void FloatingMenuPage()9        {10            var floatingMenuPage = new FloatingMenuPage(this.DriverContext);11            floatingMenuPage.OpenHomePage(this.url);12            floatingMenuPage.AssertFloatingMenu();13            floatingMenuPage.AssertMenu();14        }15    }16}FloatingMenuPage
Using AI Code Generation
1FloatingMenuPage floatingMenuPage = new FloatingMenuPage(DriverContext);2floatingMenuPage.FloatingMenuPageMethod();3FloatingMenuPage floatingMenuPage = new FloatingMenuPage(DriverContext);4floatingMenuPage.FloatingMenuPageMethod();5FloatingMenuPage floatingMenuPage = new FloatingMenuPage(DriverContext);6floatingMenuPage.FloatingMenuPageMethod();7FloatingMenuPage floatingMenuPage = new FloatingMenuPage(DriverContext);8floatingMenuPage.FloatingMenuPageMethod();9FloatingMenuPage floatingMenuPage = new FloatingMenuPage(DriverContext);10floatingMenuPage.FloatingMenuPageMethod();11FloatingMenuPage floatingMenuPage = new FloatingMenuPage(DriverContext);12floatingMenuPage.FloatingMenuPageMethod();13FloatingMenuPage floatingMenuPage = new FloatingMenuPage(DriverContext);14floatingMenuPage.FloatingMenuPageMethod();15FloatingMenuPage floatingMenuPage = new FloatingMenuPage(DriverContext);16floatingMenuPage.FloatingMenuPageMethod();17FloatingMenuPage floatingMenuPage = new FloatingMenuPage(DriverContext);18floatingMenuPage.FloatingMenuPageMethod();FloatingMenuPage
Using AI Code Generation
1using Ocaramba;2using Ocaramba.Tests.PageObjects.TheInternet;3using TechTalk.SpecFlow;4{5    {6        private readonly FloatingMenuPage _floatingMenuPage;7        public FloatingMenuSteps(DriverContext driverContext)8            : base(driverContext)9        {10            _floatingMenuPage = new FloatingMenuPage(this.DriverContext);11        }12        [Given(@"I am on the floating menu page")]13        public void GivenIAmOnTheFloatingMenuPage()14        {15            _floatingMenuPage.OpenHomePage();16        }17        [When(@"I scroll down")]18        public void WhenIScrollDown()19        {20            _floatingMenuPage.ScrollDown();21        }22        [Then(@"I see the menu")]23        public void ThenISeeTheMenu()24        {25            _floatingMenuPage.AssertMenuIsVisible();26        }27    }28}29using Ocaramba;30using Ocaramba.Tests.PageObjects.TheInternet;31using TechTalk.SpecFlow;32{33    {34        private readonly FloatingMenuPage _floatingMenuPage;35        public FloatingMenuSteps(DriverContext driverContext)36            : base(driverContext)37        {38            _floatingMenuPage = new FloatingMenuPage(this.DriverContext);39        }40        [Given(@"I am on the floating menu page")]41        public void GivenIAmOnTheFloatingMenuPage()42        {43            _floatingMenuPage.OpenHomePage();44        }45        [When(@"I scroll down")]46        public void WhenIScrollDown()47        {48            _floatingMenuPage.ScrollDown();49        }50        [Then(@"I see the menu")]51        public void ThenISeeTheMenu()52        {53            _floatingMenuPage.AssertMenuIsVisible();54        }55    }56}57using Ocaramba;58using Ocaramba.Tests.PageObjects.TheInternet;59using TechTalk.SpecFlow;60{FloatingMenuPage
Using AI Code Generation
1using Ocaramba;2using Ocaramba.Tests.PageObjects.PageObjects.TheInternet;3using NUnit.Framework;4using System;5using System.Collections.Generic;6using System.Linq;7using System.Text;8using System.Threading.Tasks;9{10    {11        public void FloatingMenuTest()12        {13            var floatingMenuPage = new FloatingMenuPage(this.DriverContext);14            floatingMenuPage.OpenHomePage();15            floatingMenuPage.FloatingMenuPageTest();16        }17    }18}FloatingMenuPage
Using AI Code Generation
1FloatingMenuPage floatingMenuPage = new FloatingMenuPage(DriverContext);2floatingMenuPage.FloatingMenuPageMethod();3FloatingMenuPage floatingMenuPage = new FloatingMenuPage(DriverContext);4floatingMenuPage.FloatingMenuPageMethod();5FloatingMenuPage floatingMenuPage = new FloatingMenuPage(DriverContext);6floatingMenuPage.FloatingMenuPageMethod();7FloatingMenuPage floatingMenuPage = new FloatingMenuPage(DriverContext);8floatingMenuPage.FloatingMenuPageMethod();9FloatingMenuPage floatingMenuPage = new FloatingMenuPage(DriverContext);10floatingMenuPage.FloatingMenuPageMethod();11FloatingMenuPage floatingMenuPage = new FloatingMenuPage(DriverContext);12floatingMenuPage.FloatingMenuPageMethod();13FloatingMenuPage floatingMenuPage = new FloatingMenuPage(DriverContext);14floatingMenuPage.FloatingMenuPageMethod();15FloatingMenuPage floatingMenuPage = new FloatingMenuPage(DriverContext);16floatingMenuPage.FloatingMenuPageMethod();17FloatingMenuPage floatingMenuPage = new FloatingMenuPage(DriverContext);18floatingMenuPage.FloatingMenuPageMethod();FloatingMenuPage
Using AI Code Generation
1FloatingMenuPage floatingMenuPage = new FloatingMenuPage(DriverContext);2floatingMenuPage.GoTo();3floatingMenuPage.ScrollDown();4floatingMenuPage.ScrollUp();5floatingMenuPage.ScrollToBottom();6floatingMenuPage.ScrollToTop();7FloatingMenuPage floatingMenuPage = new FloatingMenuPage(DriverContext);8floatingMenuPage.GoTo();9floatingMenuPage.ScrollDown();10floatingMenuPage.ScrollUp();11floatingMenuPage.ScrollToBottom();12floatingMenuPage.ScrollToTop();13FloatingMenuPage floatingMenuPage = new FloatingMenuPage(DriverContext);14floatingMenuPage.GoTo();15floatingMenuPage.ScrollDown();16floatingMenuPage.ScrollUp();17floatingMenuPage.ScrollToBottom();18floatingMenuPage.ScrollToTop();19FloatingMenuPage floatingMenuPage = new FloatingMenuPage(DriverContext);20floatingMenuPage.GoTo();21floatingMenuPage.ScrollDown();22floatingMenuPage.ScrollUp();23floatingMenuPage.ScrollToBottom();24floatingMenuPage.ScrollToTop();25FloatingMenuPage floatingMenuPage = new FloatingMenuPage(DriverContext);26floatingMenuPage.GoTo();27floatingMenuPage.ScrollDown();28floatingMenuPage.ScrollUp();29floatingMenuPage.ScrollToBottom();30floatingMenuPage.ScrollToTop();31FloatingMenuPage floatingMenuPage = new FloatingMenuPage(DriverContext);32floatingMenuPage.GoTo();33floatingMenuPage.ScrollDown();34floatingMenuPage.ScrollUp();35floatingMenuPage.ScrollToBottom();36floatingMenuPage.ScrollToTop();37FloatingMenuPage floatingMenuPage = new FloatingMenuPage(DriverContext);38floatingMenuPage.GoTo();FloatingMenuPage
Using AI Code Generation
1public void FloatingMenuPage()2{3    var floatingMenuPage = new FloatingMenuPage(DriverContext);4    floatingMenuPage.Open();5    floatingMenuPage.ScrollToBottom();6    floatingMenuPage.ScrollToTop();7}8public void FloatingMenuPage()9{10    var floatingMenuPage = new FloatingMenuPage(DriverContext);11    floatingMenuPage.Open();12    floatingMenuPage.ScrollToBottom();13    floatingMenuPage.ScrollToTop();14}15public void FloatingMenuPage()16{17    var floatingMenuPage = new FloatingMenuPage(DriverContext);18    floatingMenuPage.Open();19    floatingMenuPage.ScrollToBottom();20    floatingMenuPage.ScrollToTop();21}22public void FloatingMenuPage()23{24    var floatingMenuPage = new FloatingMenuPage(DriverContext);25    floatingMenuPage.Open();26    floatingMenuPage.ScrollToBottom();27    floatingMenuPage.ScrollToTop();28}29public void FloatingMenuPage()30{31    var floatingMenuPage = new FloatingMenuPage(DriverContext);32    floatingMenuPage.Open();33    floatingMenuPage.ScrollToBottom();34    floatingMenuPage.ScrollToTop();35}FloatingMenuPage
Using AI Code Generation
1FloatingMenuPage floatingMenuPage = new FloatingMenuPage(DriverContext);2floatingMenuPage.GoTo();3floatingMenuPage.ScrollDownToPageBottom();4floatingMenuPage.ScrollUpToPageTop();5floatingMenuPage.ScrollUpToElement(floatingMenuPage.HomeLink);6floatingMenuPage.ScrollDownToElement(floatingMenuPage.NewsLink);7FloatingMenuPage floatingMenuPage = new FloatingMenuPage(DriverContext);8floatingMenuPage.GoTo();9floatingMenuPage.ScrollToElement(floatingMenuPage.HomeLink);10floatingMenuPage.ScrollToElement(floatingMenuPage.NewsLink);11FloatingMenuPage floatingMenuPage = new FloatingMenuPage(DriverContext);12floatingMenuPage.GoTo();13floatingMenuPage.ScrollToPageBottom();14floatingMenuPage.ScrollToPageTop();15floatingMenuPage.ScrollToElement(floatingMenuPage.HomeLink);16floatingMenuPage.ScrollToElement(floatingMenuPage.NewsLink);17FloatingMenuPage floatingMenuPage = new FloatingMenuPage(DriverContext);18floatingMenuPage.GoTo();19floatingMenuPage.ScrollToElement(floatingMenuPage.HomeLink);20floatingMenuPage.ScrollToElement(floatingMenuPage.NewsLink);21FloatingMenuPage floatingMenuPage = new FloatingMenuPage(DriverContext);22floatingMenuPage.GoTo();23floatingMenuPage.ScrollToPageBottom();24floatingMenuPage.ScrollToPageTop();25floatingMenuPage.ScrollToElement(floatingMenuPage.HomeLink);26floatingMenuPage.ScrollToElement(floatingMenuPage.NewsLink);27FloatingMenuPage floatingMenuPage = new FloatingMenuPage(DriverContext);28floatingMenuPage.GoTo();29floatingMenuPage.ScrollToElement(floatingMenuPage.HomeLink);30floatingMenuPage.ScrollToElement(floatingMenuPage.NewsLink);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!!
