Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: allure integration and migration utility for component tests #3949

Merged
merged 10 commits into from
Dec 30, 2024
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Logs

Check warning on line 1 in .gitignore

View workflow job for this annotation

GitHub Actions / Check for formatting & lint errors

File ignored by default.
logs
*.log
npm-debug.log*
Expand Down Expand Up @@ -139,4 +139,8 @@

# component test report
test_reports/
temp/
temp/

# Allure
allure-results/
allure-report/
2 changes: 1 addition & 1 deletion jest.config.typescript.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ module.exports = {
// snapshotSerializers: [],

// The test environment that will be used for testing
testEnvironment: 'node',
testEnvironment: 'allure-jest/node',

// Options that will be passed to the testEnvironment
// testEnvironmentOptions: {},
Expand Down
59 changes: 57 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@
"@types/supertest": "^6.0.2",
"@typescript-eslint/eslint-plugin": "^5.61.0",
"@typescript-eslint/parser": "^5.59.2",
"allure-jest": "^3.0.7",
"axios-mock-adapter": "^1.22.0",
"benchmark-suite": "^0.1.8",
"commander": "^10.0.1",
Expand All @@ -154,6 +155,8 @@
"http-terminator": "^3.2.0",
"husky": "^9.1.6",
"jest": "^29.5.0",
"jest-diff": "^29.7.0",
"jest-environment-node": "^29.7.0",
"jest-sonar": "^0.2.16",
"jest-when": "^3.5.2",
"lint-staged": "^13.2.2",
Expand Down
17 changes: 9 additions & 8 deletions test/integrations/component.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { appendFileSync } from 'fs';
import { assertRouterOutput, responses } from '../testHelper';
import { generateTestReport, initaliseReport } from '../test_reporter/reporter';
import _ from 'lodash';
import { enhancedTestUtils } from '../test_reporter/allureReporter';

// To run single destination test cases
// npm run test:ts -- component --destination=adobe_analytics
Expand Down Expand Up @@ -55,7 +56,12 @@ if (opts.generate === 'true') {

let server: Server;

const INTEGRATIONS_WITH_UPDATED_TEST_STRUCTURE = ['klaviyo', 'campaign_manager', 'criteo_audience'];
const INTEGRATIONS_WITH_UPDATED_TEST_STRUCTURE = [
'active_campaign',
'klaviyo',
'campaign_manager',
'criteo_audience',
];

beforeAll(async () => {
initaliseReport();
Expand Down Expand Up @@ -153,13 +159,8 @@ const testRoute = async (route, tcData: TestCaseData) => {

if (INTEGRATIONS_WITH_UPDATED_TEST_STRUCTURE.includes(tcData.name?.toLocaleLowerCase())) {
expect(validateTestWithZOD(tcData, response)).toEqual(true);
const bodyMatched = _.isEqual(response.body, outputResp.body);
const statusMatched = response.status === outputResp.status;
if (bodyMatched && statusMatched) {
generateTestReport(tcData, response.body, 'passed');
} else {
generateTestReport(tcData, response.body, 'failed');
}
enhancedTestUtils.beforeTestRun(tcData);
enhancedTestUtils.afterTestRun(tcData, response.body);
}

if (outputResp?.body) {
Expand Down
Loading
Loading