-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #40 from pagopa/CHK-3252-io-integration-tests
[CHK-3252] feat: add IO flow integration tests
- Loading branch information
Showing
9 changed files
with
123 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ECOMMERCE_IO_CLIENT_REDIRECT_OUTCOME_PATH=iowallet://localhost:1234/ecommerce/io-outcomes/v1/transactions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
module.exports = { | ||
preset: "jest-puppeteer", | ||
testRegex: "./no-redirect.test\\.ts$", | ||
reporters: [ | ||
'default', | ||
[ 'jest-junit', { | ||
outputDirectory: './test_reports', | ||
outputName: 'ecommerce-no-redirect-TEST.xml', | ||
} ] | ||
] | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
src/__integration_tests__/final-status-io.integration.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import "expect-puppeteer"; | ||
|
||
describe("Check final status on IO mapping tests", () => { | ||
/** | ||
* Test input and configuration | ||
*/ | ||
|
||
const ECOMMERCE_FE_ESITO_PAGE = "http://localhost:1234/ecommerce-fe/esito#clientId=IO&sessionToken=test&transactionId="; | ||
|
||
/** | ||
* Add all mock flow. Reference to the flow defined into the checkout be mock | ||
*/ | ||
const mockTransactionIdsWithExpectedResultMap = new Map([ | ||
["302054585254587560","0"], | ||
["302054585254587561","0"], | ||
["302054585254587562","1"], | ||
["302054585254587563","0"], | ||
["302054585254587564","1"], | ||
["302054585254587565","1"], | ||
["302054585254587566","1"], | ||
["302054585254587567","1"], | ||
["302054585254587568","1"], | ||
["302054585254587569","4"], | ||
["302054585254587570","8"], | ||
["302054585254587571","8"], | ||
["302054585254587572","1"], | ||
["302054585254587573","8"], | ||
["302054585254587574","1"], | ||
["302054585254587575","2"], | ||
["302054585254587576","17"], | ||
["302054585254587577","1"], | ||
["302054585254587578","0"], | ||
["302054585254587579","17"] | ||
]); | ||
|
||
|
||
/** | ||
* Default test timeout (80000ms) | ||
*/ | ||
jest.setTimeout(80000); | ||
jest.retryTimes(3); | ||
page.setDefaultNavigationTimeout(80000); | ||
page.setDefaultTimeout(80000); | ||
|
||
beforeAll(async () => { | ||
await page.goto(ECOMMERCE_FE_ESITO_PAGE); | ||
await page.setViewport({ width: 1200, height: 907 }); | ||
}) | ||
|
||
|
||
for (const [transactionId, expectedOutcome] of mockTransactionIdsWithExpectedResultMap) { | ||
it(`TransactionId ${transactionId} with expected outcome: ${expectedOutcome}`, async() => { | ||
console.log(`Executing transactionId: [${transactionId}]. expected outcome: [${expectedOutcome}]`); | ||
await page.goto(ECOMMERCE_FE_ESITO_PAGE + transactionId); | ||
await page.waitForFunction("window.location.pathname.includes('ecommerce/io-outcomes/v1/transactions')") | ||
const pollingOutcome = Number.parseInt(page.url().split("outcome=")[1]); | ||
expect(pollingOutcome).toBe(Number.parseInt(expectedOutcome)); | ||
}) | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import "expect-puppeteer"; | ||
|
||
describe("Test showing final button for continue to IO", () => { | ||
|
||
const ECOMMERCE_FE_ESITO_PAGE = "http://localhost:1234/ecommerce-fe/esito#clientId=IO&sessionToken=test&transactionId=302054585254587560"; | ||
|
||
/** | ||
* Default test timeout (80000ms) | ||
*/ | ||
jest.setTimeout(80000); | ||
jest.retryTimes(3); | ||
page.setDefaultNavigationTimeout(80000); | ||
page.setDefaultTimeout(80000); | ||
|
||
beforeAll(async () => { | ||
await page.setViewport({ width: 1200, height: 907 }); | ||
}) | ||
|
||
|
||
it(`Test IO button on success payment flow`, async() => { | ||
console.log("Start outcome page with IO app redirect") | ||
await page.goto(ECOMMERCE_FE_ESITO_PAGE); | ||
await page.waitForSelector('#continueToIOBtn'); | ||
}) | ||
}); |