@@ -12,12 +12,17 @@ import {
1212 cancelPayment ,
1313 caseSummary ,
1414 confirmYourPayment ,
15- enterPaymentDetails , home ,
16- serviceRequest
15+ enterPaymentDetails ,
16+ home ,
17+ serviceRequest ,
18+ user
1719} from '@data/page-data' ;
1820import { history } from '@data/page-data/history.page.data' ;
1921import { BrowserContext , Page } from "@playwright/test" ;
2022import { refundAndRemission } from "@data/user-data/staff.user.data" ;
23+ import { dismissCookieBanner } from '@config/cookie-banner' ;
24+
25+ test . use ( { storageState : undefined } ) ;
2126
2227async function clearBrowserSession ( page : Page , context : BrowserContext ) : Promise < void > {
2328 await context . clearCookies ( ) ;
@@ -31,13 +36,19 @@ async function clearBrowserSession(page: Page, context: BrowserContext): Promise
3136 } ) ;
3237}
3338
34- test . beforeEach ( async ( { page } ) => {
39+ test . beforeEach ( async ( { page, context } ) => {
3540 initializeExecutor ( page ) ;
3641 await performAction ( 'createCaseAPI' , { data : createCaseApiData . createCasePayload } ) ;
3742 await performAction ( 'submitCaseAPI' , { data : submitCaseApiData . submitCasePayloadNoDefendants } ) ;
38- await performAction ( 'navigateToUrl' , `${ process . env . MANAGE_CASE_BASE_URL } /cases/case-details/PCS/${ getCaseTypeId ( ) } /${ process . env . CASE_NUMBER } #Summary` ) ;
43+ await performAction ( 'navigateToUrl' , process . env . MANAGE_CASE_BASE_URL ) ;
44+ await clearBrowserSession ( page , context ) ;
45+ await dismissCookieBanner ( page , 'additional' ) ;
46+ await performAction ( 'login' , user . claimantSolicitor ) ;
47+ await dismissCookieBanner ( page , 'analytics' ) ;
48+ const url = `${ process . env . MANAGE_CASE_BASE_URL } /cases/case-details/PCS/${ getCaseTypeId ( ) } /${ process . env . CASE_NUMBER } #Service%20Request` ;
49+ await performAction ( 'navigateToUrl' , url ) ;
3950 await expect ( async ( ) => {
40- await page . waitForURL ( `${ process . env . MANAGE_CASE_BASE_URL } /**/**/**/**/**#Summary ` ) ;
51+ await page . waitForURL ( `${ process . env . MANAGE_CASE_BASE_URL } /**/**/**/**/**#Service%20Request ` ) ;
4152 } ) . toPass ( {
4253 timeout : VERY_LONG_TIMEOUT ,
4354 } ) ;
@@ -50,7 +61,7 @@ test.afterEach(async () => {
5061} ) ;
5162
5263test . describe ( '[Common Component Fee And Pay] @nightly @CC @feeAndPay' , async ( ) => {
53- test ( 'Fee And Pay - Pay by account PBA' , async ( ) => {
64+ test ( 'Fee And Pay - Pay by account PBA' , async ( { page , context } ) => {
5465 await performAction ( 'clickPayNowLink' , serviceRequest . payNowLink ) ;
5566 await performAction ( 'selectPaymentTypePBA' , {
5667 amountLabel : serviceRequest . amountToPayLabel ,
@@ -63,8 +74,10 @@ test.describe('[Common Component Fee And Pay] @nightly @CC @feeAndPay' , async (
6374 confirmButton : serviceRequest . confirmPaymentButton ,
6475 } ) ;
6576 await performValidation ( 'mainHeader' , serviceRequest . paymentSuccessMainHeader ) ;
77+ await performAction ( 'clickButton' , serviceRequest . viewServiceRequestsLink ) ;
78+ await clearBrowserSession ( page , context ) ;
79+ await performAction ( 'login' , { email : refundAndRemission . requesterEmail , password : process . env . IDAM_PCS_USER_PASSWORD } ) ;
6680 await performAction ( 'verifyStatusInHistoryAndSummaryTab' , {
67- serviceReqLink : serviceRequest . viewServiceRequestsLink ,
6881 serviceReqTab : caseSummary . serviceRequestTab ,
6982 historyTab : caseSummary . HistoryTab ,
7083 status : serviceRequest . paidStatus ,
@@ -73,7 +86,7 @@ test.describe('[Common Component Fee And Pay] @nightly @CC @feeAndPay' , async (
7386 } ) ;
7487 } ) ;
7588
76- test ( 'Fee And Pay - Pay by Card' , async ( ) => {
89+ test ( 'Fee And Pay - Pay by Card' , async ( { page , context } ) => {
7790 await performAction ( 'clickPayNowLink' , serviceRequest . payNowLink ) ;
7891 await performAction ( 'selectPaymentByCard' , {
7992 amountLabel : serviceRequest . amountToPayLabel ,
@@ -97,6 +110,9 @@ test.describe('[Common Component Fee And Pay] @nightly @CC @feeAndPay' , async (
97110 await performValidation ( 'mainHeader' , confirmYourPayment . mainHeader ) ;
98111 await performAction ( 'clickButton' , confirmYourPayment . confirmButton ) ;
99112 await performValidation ( 'mainHeader' , serviceRequest . paymentSuccessMainHeader ) ;
113+ await performAction ( 'clickButton' , serviceRequest . returnToServiceRequestLink ) ;
114+ await clearBrowserSession ( page , context ) ;
115+ await performAction ( 'login' , { email : refundAndRemission . requesterEmail , password : process . env . IDAM_PCS_USER_PASSWORD } ) ;
100116 await performAction ( 'verifyStatusInHistoryAndSummaryTab' , {
101117 serviceReqLink : serviceRequest . returnToServiceRequestLink ,
102118 serviceReqTab : caseSummary . serviceRequestTab ,
@@ -107,7 +123,7 @@ test.describe('[Common Component Fee And Pay] @nightly @CC @feeAndPay' , async (
107123 } ) ;
108124 } ) ;
109125
110- test ( 'Fee And Pay - Cancel Payment from You Card Details Page' , async ( ) => {
126+ test ( 'Fee And Pay - Cancel Payment from You Card Details Page' , async ( { page , context } ) => {
111127 await performAction ( 'clickPayNowLink' , serviceRequest . payNowLink ) ;
112128 await performAction ( 'selectPaymentByCard' , {
113129 amountLabel : serviceRequest . amountToPayLabel ,
@@ -118,6 +134,9 @@ test.describe('[Common Component Fee And Pay] @nightly @CC @feeAndPay' , async (
118134 await performAction ( 'clickButton' , enterPaymentDetails . cancelPaymentButton ) ;
119135 await performValidation ( 'mainHeader' , cancelPayment . mainHeader ) ;
120136 await performAction ( 'clickButton' , cancelPayment . continueButton ) ;
137+ await performAction ( 'clickButton' , serviceRequest . returnToServiceRequestLink ) ;
138+ await clearBrowserSession ( page , context ) ;
139+ await performAction ( 'login' , { email : refundAndRemission . requesterEmail , password : process . env . IDAM_PCS_USER_PASSWORD } ) ;
121140 await performAction ( 'verifyStatusInHistoryAndSummaryTab' , {
122141 serviceReqLink : cancelPayment . returnServiceReqLink ,
123142 serviceReqTab : caseSummary . serviceRequestTab ,
@@ -128,7 +147,7 @@ test.describe('[Common Component Fee And Pay] @nightly @CC @feeAndPay' , async (
128147 } ) ;
129148 } ) ;
130149
131- test ( 'Fee And Pay - Cancel Payment from Confirm Card Details Page' , async ( ) => {
150+ test ( 'Fee And Pay - Cancel Payment from Confirm Card Details Page' , async ( { page , context } ) => {
132151 await performAction ( 'clickPayNowLink' , serviceRequest . payNowLink ) ;
133152 await performAction ( 'selectPaymentByCard' , {
134153 amountLabel : serviceRequest . amountToPayLabel ,
@@ -153,6 +172,9 @@ test.describe('[Common Component Fee And Pay] @nightly @CC @feeAndPay' , async (
153172 await performAction ( 'clickButton' , confirmYourPayment . cancelPaymentButton ) ;
154173 await performValidation ( 'mainHeader' , cancelPayment . mainHeader ) ;
155174 await performAction ( 'clickButton' , cancelPayment . continueButton ) ;
175+ await performAction ( 'clickButton' , serviceRequest . returnToServiceRequestLink ) ;
176+ await clearBrowserSession ( page , context ) ;
177+ await performAction ( 'login' , { email : refundAndRemission . requesterEmail , password : process . env . IDAM_PCS_USER_PASSWORD } ) ;
156178 await performAction ( 'verifyStatusInHistoryAndSummaryTab' , {
157179 serviceReqLink : cancelPayment . returnServiceReqLink ,
158180 serviceReqTab : caseSummary . serviceRequestTab ,
0 commit comments