@@ -16,7 +16,7 @@ beforeEach(async () => {
1616 await CandidatesPage . load ( ) ;
1717 await driver . pause ( waitTime ) ;
1818 // Below line to be commented out once defect #WV-943 is fixed.
19- // await CandidatesPage.stateSelect.selectByVisibleText('Hawaii');
19+ // await CandidatesPage.stateSelect.selectByVisibleText('Hawaii');
2020 //await driver.pause(waitTime);
2121} ) ;
2222
@@ -353,7 +353,7 @@ describe('Candidates PageBrowser', () => {
353353 }
354354 } ) ;
355355
356- // Candidates_018
356+ // Candidates_018
357357 it ( 'verifyLikeCandidateClick @WV-1073' , async ( ) => {
358358 const stateNameRandomTC10 = readTestDataStates ( 'random' , 1 ) [ 0 ] ;
359359 console . log ( `Running verifyLikeCandidateClick using state ${ stateNameRandomTC10 } ` ) ;
@@ -438,9 +438,9 @@ describe('Candidates PageBrowser', () => {
438438 } ) ;
439439
440440 // Candidates_023-Candidates_030
441- const searchText = readSearchText ( ) ;
441+ const searchText = readSearchText ( ) ;
442442 searchText . forEach ( ( { text, runType } ) => {
443- it ( `verifyCandidateSearchByNameOrOffice for ${ text } with ${ runType } ` , async ( ) => {
443+ it ( `verifyCandidateSearchByNameOrOfficeOrParty for ${ text } with ${ runType } ` , async ( ) => {
444444 console . log ( ` *** ***** Running verifySearchText using name: ${ text } , state: ${ runType } ` ) ;
445445 const stateNameRandomTC23 = readTestDataStates ( 'random' , 1 ) [ 0 ] ;
446446 await CandidatesPage . searchBar . click ( ) ;
@@ -453,7 +453,7 @@ describe('Candidates PageBrowser', () => {
453453 await driver . pause ( waitTime ) ;
454454 }
455455 const candidateCards = await CandidatesPage . candidateSearchList ;
456- console . log ( `Total cards: ${ candidateCards . length } ` )
456+ console . log ( `Total cards: ${ candidateCards . length } ` ) ;
457457 for ( let i = 0 ; i < candidateCards . length ; i ++ ) {
458458 const card = candidateCards [ i ] ;
459459 await driver . waitUntil ( async ( ) => ! ( await card . getAttribute ( 'id' ) ) . includes ( 'Loading' ) , {
@@ -463,23 +463,33 @@ describe('Candidates PageBrowser', () => {
463463 const cardId = await card . getAttribute ( 'id' ) ;
464464 const candidateNameDisplayed = ( await CandidatesPage . getCandidateCardCandidateName ( cardId ) ) ;
465465 const officeNameDisplayed = ( await CandidatesPage . getCandidateCardOffice ( cardId ) ) ;
466+ const partyNameDisplayed = ( await CandidatesPage . getCandidateCardPartyName ( cardId ) ) ;
466467
467468 console . log ( `Candidate Name: ${ candidateNameDisplayed } ` ) ;
468469 console . log ( `Candidate Office: ${ officeNameDisplayed } ` ) ;
469- if ( runType === 'stateSelected' ) {
470- const expectedStateValue = [ 'National' . toUpperCase ( ) , stateNameRandomTC23 . toUpperCase ( ) ] ;
471- const stateNameDisplayed = ( await CandidatesPage . getCandidateCardState ( cardId ) ) . toUpperCase ( ) ;
470+ console . log ( `Candidate Party: ${ partyNameDisplayed } ` ) ;
471+ if ( runType === 'stateSelected' ) {
472+ const expectedStateValue = [ 'National' . toUpperCase ( ) , stateNameRandomTC23 . toUpperCase ( ) ] ;
473+ const stateNameDisplayed = ( await CandidatesPage . getCandidateCardState ( cardId ) ) . toUpperCase ( ) ;
472474 console . log ( `Candidate State: ${ stateNameDisplayed } ` ) ;
473- await ` expect(expectedStateValue).toContain(stateNameDisplayed);`
475+ await expect ( expectedStateValue ) . toContain ( stateNameDisplayed ) ;
474476 }
475477 try {
476478 await expect ( candidateNameDisplayed . toLowerCase ( ) ) . toContain ( text . toLowerCase ( ) ) ;
479+ console . log ( `Candidate Name contains searched text: "${ text } " for Candidate: ${ candidateNameDisplayed } ` ) ;
477480 } catch {
478- await console . log ( `Candidate Name did not match the searched text: << ${ text } >>, checking Office Name instead...` ) ;
481+ console . log ( `Candidate Name did not match the searched text: << ${ text } >>, checking Office Name instead...` ) ;
479482 try {
480483 await expect ( officeNameDisplayed . toLowerCase ( ) ) . toContain ( text . toLowerCase ( ) ) ;
484+ console . log ( `Office Name contains searched text: "${ text } " for Candidate: ${ candidateNameDisplayed } ` ) ;
481485 } catch {
482- throw new Error ( `Neither candidateName nor officeName matched searched text: "${ text } " for Candidate: ${ candidateNameDisplayed } ` ) ;
486+ console . log ( `Office Name did not match the searched text: << ${ text } >>, checking Party Name instead...` ) ;
487+ try {
488+ await expect ( partyNameDisplayed . toLowerCase ( ) ) . toContain ( text . toLowerCase ( ) ) ;
489+ console . log ( `Party Name contains searched text: "${ text } " for Candidate: ${ candidateNameDisplayed } ` ) ;
490+ } catch {
491+ throw new Error ( `Neither candidateName nor officeName nor partyName matched searched text: "${ text } " for Candidate: ${ candidateNameDisplayed } ` ) ;
492+ }
483493 }
484494 }
485495 }
@@ -532,14 +542,14 @@ describe('Candidates PageBrowser', () => {
532542 allSearch . push ( searchText . toLowerCase ( ) ) ;
533543 allSearch . push ( searchText . toUpperCase ( ) ) ;
534544 allSearch . push ( searchText [ 0 ] . toUpperCase ( ) + searchText . slice ( 1 ) ) ;
535- }
545+ }
536546 const states = [ 'stateNotSelected' , 'stateSelected' ] ;
537547 const combinations = [ ] ;
538548 for ( const text of allSearch ) {
539549 for ( const runType of states ) {
540- combinations . push ( { text, runType } ) ;
541- }
550+ combinations . push ( { text, runType } ) ;
542551 }
552+ }
543553
544554 console . log ( "Running tests for test data combinations:" ) ;
545555 console . log ( combinations ) ;
0 commit comments