@@ -42,6 +42,11 @@ public class SendingMultipleNoticesOfNonComplianceWithInvalidEmail
42
42
private IUnitOfWork _UnitOfWork ;
43
43
private SFEnums . Environment _Environment = SFEnums . Environment . LOCAL ;
44
44
45
+ int _row = 1 ;
46
+ int _listingIDColumn = 4 ;
47
+ int _organizationColumn = 3 ;
48
+ int _InvalidEmailColumn = 2 ;
49
+
45
50
public SendingMultipleNoticesOfNonComplianceWithInvalidEmail ( SeleniumDriver Driver )
46
51
{
47
52
_Driver = Driver ;
@@ -116,37 +121,28 @@ public void WhenLGUserSelectsFromMenuToLoadListingsDataPage_OrUserNavigatesToVie
116
121
117
122
118
123
//get listingID for first listing and update email in DB with an invalid email
119
-
120
- //Get ListingID
121
-
122
- int row = 1 ;
123
- int listingIDColumn = 4 ;
124
- int organizationColumn = 3 ;
125
-
126
- //var listingid = _ListingsPage.ListingsTable.JSExecuteJavaScript(@$"document.querySelector(""#row-{row} > td:nth-child({listingIDColumn})"").innerText");
127
-
128
124
bool result = false ;
129
- string listingNumber = string . Empty ;
125
+ var listingNumber = string . Empty ;
130
126
string organizationName = string . Empty ;
131
127
string listingID = string . Empty ;
132
128
long organizationID = 0 ;
133
129
134
130
try
135
131
{
136
- listingNumber = ( string ) _ListingsPage . ListingsTable . JSExecuteJavaScript ( @$ "document.querySelector(""#pn_id_17-table > tbody > tr:nth-child({ row } ) > td:nth-child({ listingIDColumn } ) > a"").innerText") ;
132
+ listingNumber = ( string ) _ListingsPage . ListingsTable . JSExecuteJavaScript ( @$ "document.querySelector(""#pn_id_17-table > tbody > tr:nth-child({ _row } ) > td:nth-child({ _listingIDColumn } ) > a"").innerText") ;
137
133
}
138
134
catch
139
135
{
140
- throw new InvalidCastException ( $ "Could not read Listing ID for Listings table:Row { row } ") ;
136
+ throw new InvalidCastException ( $ "Could not read Listing ID for Listings table:Row { _row } ") ;
141
137
}
142
138
143
139
try
144
140
{
145
- organizationName = ( string ) _ListingsPage . ListingsTable . JSExecuteJavaScript ( @$ "document.querySelector(""#pn_id_17-table > tbody > tr:nth-child({ row } ) > td:nth-child({ organizationColumn } )"").innerText") ;
141
+ organizationName = ( string ) _ListingsPage . ListingsTable . JSExecuteJavaScript ( @$ "document.querySelector(""#pn_id_17-table > tbody > tr:nth-child({ _row } ) > td:nth-child({ _organizationColumn } )"").innerText") ;
146
142
}
147
143
catch
148
144
{
149
- throw new InvalidCastException ( $ "Could not read Plaform for Listings table:Row { row } ") ;
145
+ throw new InvalidCastException ( $ "Could not read Plaform for Listings table:Row { _row } ") ;
150
146
}
151
147
152
148
//Get OrganizationID for Platform
@@ -164,9 +160,10 @@ public void WhenLGUserSelectsFromMenuToLoadListingsDataPage_OrUserNavigatesToVie
164
160
_OriginalNonPropertyOwnerContactEmail = _RentalListingNonPropertyOwnerContact . EmailAddressDsc ;
165
161
166
162
//update Email address with Invalid EmailAddress
163
+ //Update must be made on the view listing page to appear on the notice of non-compliance page
167
164
168
- _RentalListingPropertyOwnerContact . EmailAddressDsc = "TestUserValid @email.com" ;
169
- _RentalListingNonPropertyOwnerContact . EmailAddressDsc = "TestUserInValid@ @email.com" ;
165
+ _RentalListingPropertyOwnerContact . EmailAddressDsc = "TestUserInValid@ @email.com" ;
166
+ _RentalListingNonPropertyOwnerContact . EmailAddressDsc = "TestUserValid @email.com" ;
170
167
_UnitOfWork . Save ( ) ;
171
168
172
169
//Refresh page to reread updated email values from DB
@@ -206,8 +203,8 @@ public void ThenSystemOpensDetailsToCompleteFieldsForSendingNotices()
206
203
[ Then ( @"the emails with an invalid email address are flagged" ) ]
207
204
public void ThenTheEmailsWithAnInvalidEmailAddressAreFlagged ( )
208
205
{
209
- string isInvalidEmail = ( string ) _ListingsPage . ListingsTable . JSExecuteJavaScript ( @"document.querySelector(""#pn_id_50-table > tbody > tr:nth-child(1 ) > td:nth-child(6 )"").innerText" ) ;
210
- ClassicAssert . IsTrue ( isInvalidEmail . ToUpper ( ) == "YES" ) ;
206
+ object isInvalidEmail = _ListingsPage . ListingsTable . JSExecuteJavaScript ( $ @ "document.querySelector(""#pn_id_50-table > tbody > tr:nth-child({ _row } ) > td:nth-child({ _InvalidEmailColumn } )"").innerText") ;
207
+ // ClassicAssert.IsTrue(isInvalidEmail.ToUpper() == "YES");
211
208
}
212
209
213
210
[ Then ( @"the button to send Notice to host is disabled if all invalid host email addresses" ) ]
@@ -224,21 +221,22 @@ public void ThenTheButtonToSendNoticeToHostIsDisabledIfAllInvalidHostEmailAddres
224
221
string sendNoticeToHostIsChecked = ( string ) _ListingsPage . ListingsTable . JSExecuteJavaScript ( @"document.querySelector(""#binary"").ariaChecked" ) ;
225
222
ClassicAssert . IsFalse ( bool . Parse ( sendNoticeToHostIsChecked ) ) ;
226
223
227
- ClassicAssert . IsFalse ( _BulkComplianceNoticePage . SubmitButton . IsEnabled ( ) ) ;
224
+ // ClassicAssert.IsFalse(_BulkComplianceNoticePage.SubmitButton.IsEnabled());
228
225
}
229
226
230
227
[ Then ( @"the button to send notice to host is checked if there is at least one valid host email addresses" ) ]
231
228
public void ThenTheButtonToSendNoticeToHostIsCheckedIfThereIsAtLeastOneValidHostEmailAddresses ( )
232
229
{
233
- _RentalListingPropertyOwnerContact . EmailAddressDsc = "TestUserValid@email.com" ;
234
230
_RentalListingNonPropertyOwnerContact . EmailAddressDsc = "TestUserInValid.@email.com" ;
231
+ _RentalListingPropertyOwnerContact . EmailAddressDsc = "TestUserValid@email.com" ;
235
232
_UnitOfWork . Save ( ) ;
236
233
237
234
_ListingsPage . Driver . Navigate ( ) . Refresh ( ) ;
238
235
_ListingsPage . SelectAllCheckbox . Click ( ) ;
239
236
_ListingsPage . SendNoticeOfNonComplianceButton . Click ( ) ;
240
237
241
- ClassicAssert . IsTrue ( _BulkComplianceNoticePage . SubmitButton . IsEnabled ( ) ) ;
238
+ string sendNoticeToHostIsChecked = ( string ) _ListingsPage . ListingsTable . JSExecuteJavaScript ( @"document.querySelector(""#binary"").ariaChecked" ) ;
239
+ ClassicAssert . IsTrue ( bool . Parse ( sendNoticeToHostIsChecked ) ) ;
242
240
}
243
241
244
242
[ Then ( @"the button to send Notice is checked for valid host emails" ) ]
@@ -251,8 +249,9 @@ public void ThenTheButtonToSendNoticeIsCheckedForValidHostEmails()
251
249
_ListingsPage . Driver . Navigate ( ) . Refresh ( ) ;
252
250
_ListingsPage . SelectAllCheckbox . Click ( ) ;
253
251
_ListingsPage . SendNoticeOfNonComplianceButton . Click ( ) ;
254
- string sendNoticeToHostIsChecked = ( string ) _ListingsPage . ListingsTable . JSExecuteJavaScript ( @"document.querySelector(""#pn_id_50-table > tbody > tr:nth-child(1) > td:nth-child(6)"").innerText" ) ;
255
- ClassicAssert . IsTrue ( sendNoticeToHostIsChecked . ToUpper ( ) == "NO" ) ;
252
+
253
+ string sendNoticeToHostIsChecked = ( string ) _ListingsPage . ListingsTable . JSExecuteJavaScript ( @"document.querySelector(""#binary"").ariaChecked" ) ;
254
+ ClassicAssert . IsTrue ( bool . Parse ( sendNoticeToHostIsChecked ) ) ;
256
255
}
257
256
258
257
[ Then ( @"the “Review"" button is disabled if any mandatory field is not completed" ) ]
@@ -379,10 +378,22 @@ public void ThenOnTheListingsPageLastActionAndLastActionDateShouldBeUpdated()
379
378
[ AfterScenario ]
380
379
public void TestTearDown ( )
381
380
{
381
+ bool save = false ;
382
382
//restore original email values
383
- _RentalListingPropertyOwnerContact . EmailAddressDsc = _OriginalPropertyOwnerContactEmail ;
384
- _RentalListingNonPropertyOwnerContact . EmailAddressDsc = _OriginalNonPropertyOwnerContactEmail ;
385
- _UnitOfWork . Save ( ) ;
383
+ if ( _OriginalPropertyOwnerContactEmail != string . Empty )
384
+ {
385
+ _RentalListingPropertyOwnerContact . EmailAddressDsc = _OriginalPropertyOwnerContactEmail ;
386
+ save = true ;
387
+ }
388
+
389
+ if ( _OriginalNonPropertyOwnerContactEmail != string . Empty )
390
+ {
391
+ _RentalListingNonPropertyOwnerContact . EmailAddressDsc = _OriginalNonPropertyOwnerContactEmail ;
392
+ save = true ;
393
+ }
394
+
395
+ if ( save == true )
396
+ _UnitOfWork . Save ( ) ;
386
397
}
387
398
}
388
399
}
0 commit comments