Skip to content

Commit 4641b40

Browse files
committed
release ver 0.2.0.0 see change-log.md
1 parent 2e3d4d8 commit 4641b40

File tree

19 files changed

+177
-13
lines changed

19 files changed

+177
-13
lines changed

Draki.Core/ActionSyntaxProvider.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ internal SwitchSyntaxProvider(ActionSyntaxProvider syntaxProvider)
236236
}
237237

238238
/// <summary>
239-
/// Switch to a window by name or URL (can be relative such as /about -- matches on the end of the URL)
239+
/// Switch to a window by name containing or URL (can be relative such as /about -- matches on the end of the URL)
240240
/// </summary>
241241
/// <param name="windowName"></param>
242242
public IActionSyntaxProvider Window(string windowName)
@@ -618,6 +618,7 @@ public void Dispose()
618618
this.isDisposed = true;
619619
this.commandProvider.Dispose();
620620
}
621+
621622
}
622623

623624
/// <summary>

Draki.Core/Properties/AssemblyGlobal.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@
88
[assembly: AssemblyTrademark("")]
99
[assembly: AssemblyCulture("")]
1010
[assembly: ComVisible(false)]
11-
[assembly: AssemblyVersion("0.1.0.3")]
11+
[assembly: AssemblyVersion("0.2.0.0")]

Draki.SeleniumWebDriver/CommandProvider.cs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,18 @@ public ICommandProvider WithConfig(FluentSettings settings)
105105
}
106106
}
107107
catch (UnhandledAlertException) { }
108+
// added catch InvalidOperationException catch below to fix a serious problem; needs a functional test to prove this solves certain issues
109+
// was getting the following error when trying to switch back from a popup modal in Goblinfactory
110+
// possibly because the modal changes window size and there are alerts, ...however I was unable to create a simple
111+
// test to reproduce the behavior, and I needed an urgent fix. Must come back to this to work out what was really needed and exactly why?
112+
// -----------
113+
// unknown error: unhandled inspector error: { "code":-32000,"message":"No target with given id"}
114+
// (Session info: chrome = 65.0.3325.181)
115+
// (Driver info: chromedriver = 2.37.544315(730aa6a5fdba159ac9f4c1e8cbc59bf1b5ce12b7),platform = Windows NT 10.0.16299 x86_64)
116+
catch (InvalidOperationException) {}
108117

109118
this.Settings = settings;
110-
119+
111120
return this;
112121
}
113122

@@ -488,8 +497,8 @@ public void SwitchToWindow(string windowName)
488497
foreach (var windowHandle in this.webDriver.WindowHandles)
489498
{
490499
this.webDriver.SwitchTo().Window(windowHandle);
491-
492-
if (this.webDriver.Title == windowName || this.webDriver.Url.EndsWith(windowName))
500+
var title = this.webDriver.Title;
501+
if (title == windowName || this.webDriver.Url.Contains(windowName) || title.Contains(windowName))
493502
{
494503
matchFound = true;
495504
break;

Draki.Tests/Actions/ClickTests.cs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
using Draki.Exceptions;
33
using NUnit.Framework;
44

5-
65
namespace Draki.Tests.Actions
76
{
87
public class ClickTests : BaseTest
98
{
109
[Test]
11-
[Category(Category.SLOW)]
10+
[Category(Category.FLAKEY)]
1211
public void LeftClick()
1312
{
13+
// either flakey or has side effects or is impacted by side effects!
1414
InputsPage.Go();
1515
I.Click(InputsPage.ButtonControlSelector)
1616
.WaitUntil(()=> I.Expect.Text("Button Clicked").In(InputsPage.ButtonClickedTextSelector));
@@ -19,6 +19,20 @@ public void LeftClick()
1919
.WaitUntil(()=> I.Expect.Text("Input Button Clicked").In(InputsPage.ButtonClickedTextSelector));
2020
}
2121

22+
[Test]
23+
[Category(Category.SLOW)]
24+
[Category(Category.FLAKEY)]
25+
public void LinkClick()
26+
{
27+
InputsPage.Go();
28+
I.Click(InputsPage.LinkButtonControlSelector)
29+
.WaitUntil(() => I.Expect.Text("If you see me, then the click link worked").In("#seeme"));
30+
InputsPage.Go();
31+
I.Click(InputsPage.LinkButtonJavascriptControlSelector)
32+
.WaitUntil(() => I.Expect.Text("If you see me, then the click link worked").In("#seeme"));
33+
34+
}
35+
2236
[Test]
2337
[Category(Category.SLOW)]
2438
public void RightClick()

Draki.Tests/Actions/SwitchTests.cs

Lines changed: 50 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,16 @@ public void FrameSwitchToNonexistantFrameThrowsTest()
4343

4444

4545
[Test]
46-
[Category(Category.VERYSLOW)]
46+
[Category(Category.SLOW)]
4747
public void WindowSwitchTest()
4848
{
4949
SwitchPage.Go();
5050

5151
I.Click(SwitchPage.NewWindowSelector);
5252

53-
I.Switch.Window("Inputs - Draki Testbed")
54-
.Assert.Text("Input Controls Testbed").In("h2");
53+
I.Switch.Window("Inputs - FluentAutomation Testbed");
54+
55+
I.Assert.Text("Input Controls Testbed").In("h2");
5556

5657
I.Switch.Window()
5758
.Assert.Text("Switch Testbed").In("h2");
@@ -61,8 +62,54 @@ public void WindowSwitchTest()
6162

6263
I.Switch.Window()
6364
.Assert.Text("Switch Testbed").In("h2");
65+
}
66+
67+
[Test]
68+
[Category(Category.SLOW)]
69+
public void WindowSwitchToTitleContainingTest()
70+
{
71+
SwitchPage.Go();
72+
73+
I.Click(SwitchPage.NewWindowSelector);
74+
75+
I.Switch.Window("Inputs - Flue");
76+
I.Assert.Text("Input Controls Testbed").In("h2");
77+
}
6478

79+
[Test]
80+
[Category(Category.SLOW)]
81+
public void WindowSwitchToUrlContainingTest()
82+
{
83+
SwitchPage.Go();
84+
85+
I.Click(SwitchPage.NewWindowSelector);
86+
87+
I.Switch.Window("/Inp");
88+
I.Assert.Text("Input Controls Testbed").In("h2");
89+
}
90+
91+
[Test]
92+
[Category(Category.VERYSLOW)]
93+
public void WindowSwitchToNonExistentThrowsTest()
94+
{
95+
SwitchPage.Go();
6596
Assert.Throws<FluentException>(() => I.Switch.Window("non existent window"));
6697
}
98+
99+
[Test]
100+
public void SwitchToPopupTest()
101+
{
102+
SwitchPage.Go();
103+
104+
I.Expect.Text("Switch Testbed").In("h2");
105+
// open pop up
106+
I.Click(SwitchPage.new_popup);
107+
108+
I.Switch.Window("Inputs").Expect.Text("Inputs - FluentAutomation Testbed").In("head > title");
109+
I.Enter("can you see me").In(InputsPage.TextControlSelector);
110+
111+
// switch back to primary window
112+
I.Switch.Window().Expect.Text("Switch Testbed").In("h2");
113+
}
67114
}
68115
}

Draki.Tests/Asserts/CountTests.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ public void CountElements()
1515
{
1616
InputsPage.Go();
1717

18+
I.Assert.Count(1).Of("h2");
19+
I.Expect.Count(1).Of("h2");
20+
21+
I.Assert.Count(8).Of("input");
22+
I.Expect.Count(8).Of("input");
23+
1824
I.Assert
1925
.Count(0).Not.Of("div")
2026
.Count(0).Not.Of(I.Find("div"))

Draki.Tests/Category.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public class Category
1313
public const string VERYSLOW = "VERYSLOW";
1414

1515
/// <summary>
16-
/// Test known to be flakey and needs more work.
16+
/// Test known to be flakey and needs more work. Might be impacted by side effects from other asserts or tests.
1717
/// </summary>
1818
public const string FLAKEY = "FLAKEY";
1919
}

Draki.Tests/Pages/InputsPage.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ public InputsPage(FluentTest test)
2323

2424
public string ButtonControlSelector = "#button-control";
2525

26+
public string LinkButtonControlSelector = "#linkbutton-control";
27+
public string LinkButtonJavascriptControlSelector = "#linkjavascript-control";
28+
2629
public string InputButtonControlSelector = "#input-button-control";
2730

2831
public string TextChangedTextSelector = "#text-control-changed";

Draki.Tests/Pages/SwitchPage.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ public SwitchPage(FluentTest test)
1616

1717
public string NewWindowSelector = "#new-window";
1818

19+
public string new_popup = "#new-popup";
20+
1921
public string IFrameSelector = "iframe";
2022
}
2123
}

Draki.sln

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
1717
ProjectSection(SolutionItems) = preProject
1818
.gitignore = .gitignore
1919
backlog.md = backlog.md
20+
change-log.md = change-log.md
2021
README.md = README.md
2122
EndProjectSection
2223
EndProject
@@ -33,6 +34,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build.scripts", "build.scri
3334
AppVeyor.yml = AppVeyor.yml
3435
EndProjectSection
3536
EndProject
37+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Draki.TestBed.AspNetWebForms", "Draki.TestBed.AspNetWebForms\Draki.TestBed.AspNetWebForms.csproj", "{52498DA3-F5BF-45F0-AC68-D5C284C07C06}"
38+
EndProject
3639
Global
3740
GlobalSection(SolutionConfigurationPlatforms) = preSolution
3841
Debug|Any CPU = Debug|Any CPU
@@ -55,6 +58,10 @@ Global
5558
{07D8DE59-3DEB-4722-B093-6FCC0B0F7FFF}.Debug|Any CPU.Build.0 = Debug|Any CPU
5659
{07D8DE59-3DEB-4722-B093-6FCC0B0F7FFF}.Release|Any CPU.ActiveCfg = Release|Any CPU
5760
{07D8DE59-3DEB-4722-B093-6FCC0B0F7FFF}.Release|Any CPU.Build.0 = Release|Any CPU
61+
{52498DA3-F5BF-45F0-AC68-D5C284C07C06}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
62+
{52498DA3-F5BF-45F0-AC68-D5C284C07C06}.Debug|Any CPU.Build.0 = Debug|Any CPU
63+
{52498DA3-F5BF-45F0-AC68-D5C284C07C06}.Release|Any CPU.ActiveCfg = Release|Any CPU
64+
{52498DA3-F5BF-45F0-AC68-D5C284C07C06}.Release|Any CPU.Build.0 = Release|Any CPU
5865
EndGlobalSection
5966
GlobalSection(SolutionProperties) = preSolution
6067
HideSolutionNode = FALSE

0 commit comments

Comments
 (0)