Skip to content

Commit 7839a88

Browse files
committed
Merge branch 'release/0.5.0' into production
2 parents a03bc56 + 43a4e5e commit 7839a88

19 files changed

Lines changed: 152 additions & 60 deletions

CSF.WebDriverExtras.Tests/BrowserId/BrowserIdentificationFactoryTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,9 +294,9 @@ IDictionary<string,object> GetCapabilities(string platform,
294294

295295
void SendScenarioStatus(IWebDriver driver, bool isSuccess)
296296
{
297-
if(driver is ICanReceiveScenarioStatus)
297+
if(driver is ICanReceiveScenarioOutcome)
298298
{
299-
var statusDriver = (ICanReceiveScenarioStatus) driver;
299+
var statusDriver = (ICanReceiveScenarioOutcome) driver;
300300

301301
if(isSuccess)
302302
statusDriver.MarkScenarioAsSuccess();

CSF.WebDriverExtras.Tests/BrowserId/DottedNumericVersionTests.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,16 @@ public void Parse_can_roundtrip_a_valid_string(string versionString)
2424
Assert.That(roundtripped, Is.EqualTo(versionString));
2525
}
2626

27+
[Test]
28+
public void ToString_adds_presumed_flag_when_version_is_presumed()
29+
{
30+
// Act
31+
var result = DottedNumericVersion.Parse("0.1.2", true);
32+
33+
// Assert
34+
Assert.That(result.ToString(), Is.EqualTo("[presumed] 0.1.2"));
35+
}
36+
2737
[Test]
2838
public void Parse_returns_null_for_a_version_with_an_alphabetic_component()
2939
{

CSF.WebDriverExtras.Tests/BrowserId/SemanticVersionTests.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,16 @@ public void Parse_can_roundtrip_a_valid_string(string versionString)
2626
Assert.That(roundtripped, Is.EqualTo(versionString));
2727
}
2828

29+
[Test]
30+
public void ToString_adds_presumed_flag_when_version_is_presumed()
31+
{
32+
// Act
33+
var result = SemanticVersion.Parse("v0.1.2", true);
34+
35+
// Assert
36+
Assert.That(result.ToString(), Is.EqualTo("[presumed] v0.1.2"));
37+
}
38+
2939
[Test]
3040
public void Parse_returns_null_for_a_version_without_a_v_prefix()
3141
{

CSF.WebDriverExtras.Tests/CSF.WebDriverExtras.Tests.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<RootNamespace>CSF.WebDriverExtras.Tests</RootNamespace>
99
<AssemblyName>CSF.WebDriverExtras.Tests</AssemblyName>
1010
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
11-
<ReleaseVersion>0.4.0-beta</ReleaseVersion>
11+
<ReleaseVersion>0.5.0-beta</ReleaseVersion>
1212
</PropertyGroup>
1313
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
1414
<DebugSymbols>true</DebugSymbols>
@@ -72,7 +72,7 @@
7272
<Compile Include="Flags\DefinitionReaderTests.cs" />
7373
<Compile Include="Flags\FlagsDefinitionTests.cs" />
7474
<Compile Include="FactoryBuilders\WebDriverFactorySourceIntegrationTests.cs" />
75-
<Compile Include="ConnectToGoogleIntegrationTest.cs" />
75+
<Compile Include="WebDriverFactoryFromConfigurationIntegrationTests.cs" />
7676
<Compile Include="BrowserId\BrowserIdentificationFactoryTests.cs" />
7777
<Compile Include="BrowserId\SemanticVersionTests.cs" />
7878
<Compile Include="BrowserId\SimpleStringVersion.cs" />

CSF.WebDriverExtras.Tests/ConnectToGoogleIntegrationTest.cs

Lines changed: 0 additions & 31 deletions
This file was deleted.
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
using System;
2+
using NUnit.Framework;
3+
using OpenQA.Selenium.Support.UI;
4+
5+
namespace CSF.WebDriverExtras.Tests
6+
{
7+
[TestFixture]
8+
[Explicit]
9+
[Category("Browser")]
10+
[Description("End-to-end integration tests which use GetWebDriverFactory.FromConfiguration() and then make use of the driver to do something")]
11+
public class WebDriverFactoryFromConfigurationIntegrationTests
12+
{
13+
const string
14+
ConnectToGoogleScenarioName = "It should be possible to create a web driver from configuration, then use that driver to connect to the Google home page and read the window title",
15+
GoogleHomeUrl = "https://google.com/",
16+
Google = "Google";
17+
const int TimeoutSecondsToConnectToGoogleHomePage = 2;
18+
19+
[Test]
20+
[Description(ConnectToGoogleScenarioName)]
21+
public void Can_create_webdriver_then_connect_to_Google_and_read_the_window_title()
22+
{
23+
// Arrange
24+
var driverFactory = GetWebDriverFactory.FromConfiguration();
25+
string result;
26+
27+
// Act
28+
using(var webDriver = driverFactory.CreateWebDriver(scenarioName: ConnectToGoogleScenarioName))
29+
{
30+
webDriver.Navigate().GoToUrl(GoogleHomeUrl);
31+
var wait = new WebDriverWait(webDriver, TimeSpan.FromSeconds(TimeoutSecondsToConnectToGoogleHomePage))
32+
.Until(ExpectedConditions.TitleContains(Google));
33+
34+
result = webDriver.Title;
35+
36+
// Assert
37+
var statusDriver = webDriver as ICanReceiveScenarioOutcome;
38+
39+
try { Assert.That(result, Contains.Substring(Google)); }
40+
catch(AssertionException)
41+
{
42+
if(statusDriver != null) statusDriver.MarkScenarioAsFailure();
43+
throw;
44+
}
45+
46+
if(statusDriver != null) statusDriver.MarkScenarioAsSuccess();
47+
}
48+
}
49+
}
50+
}

CSF.WebDriverExtras.sln

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,6 @@ Global
2323
GlobalSection(NestedProjects) = preSolution
2424
EndGlobalSection
2525
GlobalSection(MonoDevelopProperties) = preSolution
26-
version = 0.4.0-beta
26+
version = 0.5.0-beta
2727
EndGlobalSection
2828
EndGlobal

CSF.WebDriverExtras/BrowserId/DottedNumericVersion.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,11 @@ public bool Equals(DottedNumericVersion other)
103103
/// Returns a <see cref="T:System.String"/> that represents the current <see cref="DottedNumericVersion"/>.
104104
/// </summary>
105105
/// <returns>A <see cref="T:System.String"/> that represents the current <see cref="DottedNumericVersion"/>.</returns>
106-
public override string ToString() => String.Join(".", Components);
106+
public override string ToString()
107+
{
108+
var presumedPrefix = IsPresumedVersion? "[presumed] " : String.Empty;
109+
return presumedPrefix + String.Join(".", Components);
110+
}
107111

108112
/// <summary>
109113
/// Initializes a new instance of the <see cref="T:CSF.WebDriverExtras.BrowserId.DottedNumericVersion"/> class.

CSF.WebDriverExtras/BrowserId/SemanticVersion.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,10 @@ public override int GetHashCode()
198198
/// </summary>
199199
/// <returns>A <see cref="T:System.String"/> that represents the current <see cref="SemanticVersion"/>.</returns>
200200
public override string ToString()
201-
=> $"v{Major}.{Minor}.{Patch}{GetPrereleaseIdentifiersString()}{GetMetadataString()}";
201+
{
202+
var presumedPrefix = IsPresumedVersion? "[presumed] " : String.Empty;
203+
return $"{presumedPrefix}v{Major}.{Minor}.{Patch}{GetPrereleaseIdentifiersString()}{GetMetadataString()}";
204+
}
202205

203206
string GetPrereleaseIdentifiersString()
204207
{

CSF.WebDriverExtras/BrowserId/UnrecognisedVersion.cs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
using System;
2+
using System.Collections.Generic;
3+
24
namespace CSF.WebDriverExtras.BrowserId
35
{
46
/// <summary>
@@ -8,6 +10,10 @@ namespace CSF.WebDriverExtras.BrowserId
810
/// </summary>
911
public class UnrecognisedVersion : BrowserVersion, IComparable<UnrecognisedVersion>, IEquatable<UnrecognisedVersion>
1012
{
13+
const string
14+
UnrecognisedAttrib = "unrecognised",
15+
PresumedAttrib = "presumed";
16+
1117
readonly string versionString;
1218

1319
/// <summary>
@@ -72,7 +78,16 @@ public override int GetHashCode()
7278
/// Returns a <see cref="T:System.String"/> that represents the current <see cref="UnrecognisedVersion"/>.
7379
/// </summary>
7480
/// <returns>A <see cref="T:System.String"/> that represents the current <see cref="UnrecognisedVersion"/>.</returns>
75-
public override string ToString() => $"Unrecognised version:{VersionString ?? "<null>"}";
81+
public override string ToString()
82+
{
83+
var attribs = new List<string>();
84+
attribs.Add(UnrecognisedAttrib);
85+
86+
if(IsPresumedVersion)
87+
attribs.Add(PresumedAttrib);
88+
89+
return $"[{String.Join(",", attribs)}] {VersionString ?? "<null>"}";
90+
}
7691

7792
/// <summary>
7893
/// Initializes a new instance of the <see cref="UnrecognisedVersion"/> class.

0 commit comments

Comments
 (0)