Best Ocaramba code snippet using Ocaramba.Tests.Xunit.ProjectTestBase.DriverContext
ProjectTestBase.cs
Source:ProjectTestBase.cs
...41 /// Initializes a new instance of the <see cref="ProjectTestBase"/> class.42 /// </summary>43 protected ProjectTestBase()44 {45 this.DriverContext.CurrentDirectory = AppDomain.CurrentDomain.BaseDirectory;46 Logger.Info("new test");47 this.DriverContext.Start();48 }49 public bool Disposed50 {51 get52 {53 if (!this.disposed)54 {55 return this.disposed;56 }57 throw new ObjectDisposedException("CanBeDisposed");58 }59 }60 protected DriverContext DriverContext { get; } = new DriverContext();61 public void Dispose()62 {63 this.Dispose(true);64 GC.SuppressFinalize(this);65 }66 protected virtual void Dispose(bool disposing)67 {68 if (!this.disposed)69 {70 if (disposing)71 {72 this.DriverContext.Stop();73 }74 this.disposed = true;75 }76 }77 }78}...
ExampleTest1.cs
Source:ExampleTest1.cs
...29 [Fact]30 public void TestMethod1()31 {32 const string PageTitle = "New Window";33 var newWindowPage = new InternetPage(this.DriverContext)34 .OpenHomePage()35 .GoToMultipleWindowsPage()36 .OpenNewWindowPage();37 Assert.True(newWindowPage.IsPageTile(PageTitle));38 Assert.True(newWindowPage.IsNewWindowH3TextVisible(PageTitle));39 }40 [Fact]41 public void ContextMenuTest()42 {43 const string H3Value = "Context Menu";44 var browser = BaseConfiguration.TestBrowser;45 if (browser.Equals(BrowserType.Firefox))46 {47 var contextMenuPage = new InternetPage(this.DriverContext)48 .OpenHomePage()49 .GoToContextMenuPage()50 .SelectTheInternetOptionFromContextMenu();51 Assert.Equal("You selected a context menu", contextMenuPage.JavaScriptText);52 Assert.True(contextMenuPage53 .ConfirmJavaScript()54 .IsH3ElementEqualsToExpected(H3Value));55 }56 }57 }58}...
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!!