/// <summary> /// Gets a browser identification instance from the given web driver. /// </summary> /// <returns>The identification.</returns> /// <param name="webDriver">Web driver.</param> public BrowserIdentification GetIdentification(IHasCapabilities webDriver) { return(GetIdentification(webDriver, null)); }
public string getDriverVersion(IWebDriver driver) { IHasCapabilities capabilitiesDriver = driver as IHasCapabilities; return(capabilitiesDriver.Capabilities.Version.ToString()); }
public void GetIdentification_uses_explicit_requested_version_over_version_stored_in_driver(ICreatesBrowserVersions versionFactory, [BrowserId(RequestedVersion = "123")] IHasCapabilities driver, ICapabilities requestedCaps) { // Arrange var sut = new BrowserIdentificationFactory(versionFactory); Mock.Get(requestedCaps).SetupGet(x => x.Version).Returns("456"); // Act sut.GetIdentification(driver, requestedCaps); // Assert Mock.Get(versionFactory) .Verify(x => x.CreateVersion(It.IsAny <string>(), It.IsAny <string>(), "456"), Times.Once); Mock.Get(versionFactory) .Verify(x => x.CreateVersion(It.IsAny <string>(), It.IsAny <string>(), "123"), Times.Never); }
public void GetIdentification_can_pass_null_to_version_factory_as_original_version(ICreatesBrowserVersions versionFactory, [BrowserId(HasRequestedVersion = true)] IHasCapabilities driver) { // Arrange var sut = new BrowserIdentificationFactory(versionFactory); // Act sut.GetIdentification(driver); // Assert Mock.Get(versionFactory) .Verify(x => x.CreateVersion(It.IsAny <string>(), It.IsAny <string>(), null), Times.Once); }
public void GetIdentification_passes_original_browser_version_to_version_factory_when_it_exists(ICreatesBrowserVersions versionFactory, [BrowserId(RequestedVersion = "123")] IHasCapabilities driver) { // Arrange var sut = new BrowserIdentificationFactory(versionFactory); // Act sut.GetIdentification(driver); // Assert Mock.Get(versionFactory) .Verify(x => x.CreateVersion(It.IsAny <string>(), It.IsAny <string>(), "123"), Times.Once); }
public void GetIdentification_integration_test_gets_correct_unrecognised_version([BrowserId(Version = "FlamboyantBannana")] IHasCapabilities driver) { // Arrange var sut = new BrowserIdentificationFactory(); // Act var result = sut.GetIdentification(driver); // Assert Assert.That(result.Version, Is.EqualTo(new UnrecognisedVersion("FlamboyantBannana"))); }
public void GetIdentification_integration_test_can_create_identification_for_a_browser([BrowserId] IHasCapabilities driver) { // Arrange var sut = new BrowserIdentificationFactory(); // Act var result = sut.GetIdentification(driver); // Assert Assert.That(result, Is.Not.Null); }