Skip to content

Commit 2b9beed

Browse files
authored
Merge pull request #686 from bcgov/ricander
Ricander
2 parents 6d25544 + 6e9ad00 commit 2b9beed

17 files changed

+741
-71
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,7 @@ docker.env
88
backup.sql
99
docker-compose.yml
1010
note.txt
11-
Scaffolding.txt
11+
Scaffolding.txt
12+
/Test/UITest/Configuration/AppSettings.dev.json
13+
/Test/UITest/Configuration/AppSettings.test.json
14+
/Test/UITest/Configuration/AppSettings.uat.json
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
Feature: ViewAggregatedListings
2+
Link to a feature: https://hous-hpb.atlassian.net/browse/DSS-505
3+
4+
@LandingPage
5+
Scenario: ViewAggregatedListings
6+
#User Authentication
7+
#Given that I am an authenticated user "<UserName>" with the necessary permissions to view listings View listings (listing_read) and the expected result is
8+
Given that I am an authenticated user "<UserName>" with the necessary permissions to view listings and the expected result is "<ExpectedResult>" and I am a "<UserType>" user
9+
10+
11+
12+
#Access to Data Portal:
13+
14+
When I access the Data Portal
15+
16+
#View Aggregated Listings
17+
18+
Given that I am on the aggregated listing page
19+
20+
Then I should see a parent row for each STR “property grouping “with information that is common to all listings associated with the group
21+
22+
And the ability to view drop down child rows under each parent row so that I can review all listings that are associated with a property grouping
23+
24+
#Parent Row
25+
26+
Given I am viewing a listing on the aggregated listing page
27+
28+
Then I should see information that is “common” to all listings associated with a property, including:
29+
30+
#Primary Host name
31+
#
32+
#Address (Best Match)
33+
#
34+
#Nights stayed YTD (from listing data)
35+
#
36+
#Business licence number
37+
#
38+
#Last Action
39+
#
40+
#Last Action Date
41+
42+
And I should have the option to expand a dropdown to view all child rows with listings associated with the parent row
43+
44+
#Child rows
45+
46+
When I expand the dropdown to view all child rows,
47+
48+
Then I should see key information for each listing, including:
49+
50+
#status/ flags
51+
#
52+
#platform name
53+
#
54+
#listing ID
55+
#
56+
#Link to Listing Details
57+
#
58+
#Address (Best match)
59+
#
60+
#Nights stayed (YTD)
61+
#
62+
#Business Licence
63+
#
64+
#last action
65+
#
66+
#last action date
67+
68+
69+
Examples:
70+
| UserName | UserType | Environment | ExpectedResult |
71+
| STRDSSLg1Dev | lg_staff | dev | pass |
72+
73+
74+
75+
76+
77+

Test/UITest/SpecFlowProjectBDD/Features/ViewAggregatedListings.feature.cs

Lines changed: 146 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Test/UITest/SpecFlowProjectBDD/Helpers/AuthHelper.cs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,17 @@ public AuthHelper(IDriver Driver)
7070

7171
//Sleep for 5 seconds and try twice in case text boxes are rendered, but not yet ready. Selenium WaitFor would be a better option than
7272
// Sleep, but it is not reliable for authentication
73-
while ((result == false) && (i++ < 2))
73+
while ((result == false) && (i++ < 3))
7474
{
75+
string url = _Driver.GetCurrentURL();
7576
switch (logonType)
7677
{
7778
case LogonTypeEnum.IDIR:
7879
{
7980
try
8081
{
81-
_PathFinderPage.IDRButton.Click();
82+
if (url.Contains(@"openid-connect/auth"))
83+
_PathFinderPage.IDRButton.Click();
8284
Thread.Sleep(5000);
8385
//_IDRLoginPage.UserNameTextBox.WaitFor(30);
8486
_IDRLoginPage.UserNameTextBox.EnterText(_TestUserName);
@@ -88,7 +90,7 @@ public AuthHelper(IDriver Driver)
8890
}
8991
catch (Exception ex) when (ex is NoSuchElementException || ex is WebDriverTimeoutException)
9092
{
91-
if (_Driver.GetCurrentURL().Contains(@"openid-connect/auth"))
93+
if (url.Contains(@"openid-connect/auth")||url.Contains(@"/logon.cgi"))
9294
continue;
9395
}
9496

@@ -98,7 +100,8 @@ public AuthHelper(IDriver Driver)
98100
{
99101
try
100102
{
101-
_PathFinderPage.BCIDButton.Click();
103+
if (url.Contains(@"openid-connect/auth"))
104+
_PathFinderPage.BCIDButton.Click();
102105
Thread.Sleep(5000);
103106
_BCIDPage.UserNameTextBox.WaitFor(5);
104107
_BCIDPage.UserNameTextBox.EnterText(_TestUserName);
@@ -108,7 +111,7 @@ public AuthHelper(IDriver Driver)
108111
}
109112
catch (Exception ex) when (ex is NoSuchElementException || ex is WebDriverTimeoutException)
110113
{
111-
if (_Driver.GetCurrentURL().Contains(@"openid-connect/auth"))
114+
if (url.Contains(@"openid-connect/auth") || url.Contains(@"/logon.cgi"))
112115
continue;
113116
}
114117

Test/UITest/SpecFlowProjectBDD/SpecFlowProjectBDD.csproj

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@
4343
<DesignTime>true</DesignTime>
4444
<AutoGen>true</AutoGen>
4545
</Compile>
46+
<Compile Update="Features\ViewAggregatedListings.feature.cs">
47+
<DependentUpon>ViewAggregatedListings.feature</DependentUpon>
48+
</Compile>
4649
</ItemGroup>
4750

4851
<ItemGroup>
@@ -68,6 +71,10 @@
6871
<Visible>$(UsingMicrosoftNETSdk)</Visible>
6972
<CodeBehindFile>%(RelativeDir)%(Filename).feature$(DefaultLanguageSourceExtension)</CodeBehindFile>
7073
</SpecFlowFeatureFiles>
74+
<SpecFlowFeatureFiles Update="Features\ViewAggregatedListings.feature">
75+
<Visible>$(UsingMicrosoftNETSdk)</Visible>
76+
<CodeBehindFile>%(RelativeDir)%(Filename).feature$(DefaultLanguageSourceExtension)</CodeBehindFile>
77+
</SpecFlowFeatureFiles>
7178
<SpecFlowFeatureFiles Update="Features\UploadListingDataPlatformUser.feature">
7279
<Visible>$(UsingMicrosoftNETSdk)</Visible>
7380
<CodeBehindFile>%(RelativeDir)%(Filename).feature$(DefaultLanguageSourceExtension)</CodeBehindFile>

Test/UITest/SpecFlowProjectBDD/StepDefinitions/DenyAccessToSystem.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,12 +115,12 @@ public void IDontHaveTheRequiredAccessPermissions()
115115
[Then("I should see a specific message indicating that access is restricted")]
116116
public void IShouldSeeASpecificMessageIndicatingThatAccessIsRestricted()
117117
{
118-
System.Threading.Thread.Sleep(1000);
119-
try
118+
System.Threading.Thread.Sleep(3000);
119+
120+
if (!_Driver.Url.Contains("/401"))
120121
{
121-
ClassicAssert.IsTrue(_Driver.Url.Contains("/401"));
122122
}
123-
catch
123+
else
124124
{
125125
Thread.Sleep(2000);
126126
}

Test/UITest/SpecFlowProjectBDD/StepDefinitions/ManagingAccess.cs

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,6 @@ public void IAccessTheAdministrativeInterfaceOfTheSystem()
107107
[Then("There should be a dedicated section for managing user access requests")]
108108
public void ThereShouldBeADedicatedSectionForManagingUserAccessRequests()
109109
{
110-
string selector = "body > app-root > app-layout > div.content > app-user-management > div.table-card-container";
111-
112110
bool result = (bool)_ManagingAccessPage.UserTable.IsEnabled();
113111

114112
ClassicAssert.IsTrue(result);
@@ -134,18 +132,14 @@ public void IShouldSeeAListDisplayingAllUserAccessRequestss()
134132
result = (bool)_ManagingAccessPage.UserTable.JSExecuteJavaScript(@"document.querySelector(""#table-header"").checkVisibility()");
135133
ClassicAssert.IsTrue(result);
136134

137-
result = (bool)_ManagingAccessPage.UserTable.JSExecuteJavaScript(@"document.querySelector(""#givenNm_th"").textContent.toLowerCase().trim() === ""first name""");
138-
139-
ClassicAssert.IsTrue(result);
140-
141-
result = (bool)_ManagingAccessPage.UserTable.JSExecuteJavaScript(@"document.querySelector(""#familyNm_th"").textContent.toLowerCase().trim() === 'last name'");
142-
ClassicAssert.IsTrue(result);
143-
144-
result = (bool)_ManagingAccessPage.UserTable.JSExecuteJavaScript(@"document.querySelector(""#orgName_th"").textContent.toLowerCase().trim() === ""organization""");
145-
ClassicAssert.IsTrue(result);
135+
var headerRow = _ManagingAccessPage.UserTable.GetHeaderRow();
146136

147-
result = (bool)_ManagingAccessPage.UserTable.JSExecuteJavaScript(@"document.querySelector(""#emailAddressDsc_th"").textContent.toLowerCase().trim() === ""email address""");
148-
ClassicAssert.IsTrue(result);
137+
//2
138+
//result = (bool)_ManagingAccessPage.UserTable.JSExecuteJavaScript(@"document.querySelector(""#givenNm_th"").textContent.toLowerCase().trim() === ""first name""");
139+
ClassicAssert.AreEqual(headerRow[2],"First Name");
140+
ClassicAssert.AreEqual(headerRow[3], "Last Name");
141+
ClassicAssert.AreEqual(headerRow[6], "Organization");
142+
ClassicAssert.AreEqual(headerRow[5], "Email Address");
149143
}
150144

151145

@@ -158,7 +152,19 @@ public void ReviewingASpecificAccessRequest()
158152
[Then("I should be able to view detailed information provided by the user, including their role request and any justifications or additional comments")]
159153
public void ShouldBeAbleToViewDetailedInformationProvidedByTheUser()
160154
{
155+
//Finicky element. Added loop to ensure that the control is ready
156+
int trys = 0;
161157
bool result = (bool)_ManagingAccessPage.UserTable.JSExecuteJavaScript(@"document.querySelector(""#row-0"").checkVisibility()");
158+
159+
if (!result)
160+
{
161+
while ((!result) && (trys < 3))
162+
{
163+
Thread.Sleep(2000);
164+
result = (bool)_ManagingAccessPage.UserTable.JSExecuteJavaScript(@"document.querySelector(""#row-0"").checkVisibility()");
165+
}
166+
}
167+
162168
ClassicAssert.IsTrue(result);
163169
}
164170

0 commit comments

Comments
 (0)