-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlambda.js
52 lines (42 loc) · 1.58 KB
/
lambda.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import 'dotenv/config'
import migrateTestCases from './migrate.js';
import { configureTestRail } from './testrail.js';
import { configureTestomatio } from './testomatio.js';
// ENABLE THIS LINE TO RUN THE SCRIPT
// PASS VALID VARIABLES TO ACCESS TESTRAIL
// configureTestRail(testrailBaseUrl, username, password, projectId);
// ENABLE THIS LINE TO RUN THE SCRIPT
// PASS VALID VARIABLES TO ACCESS TESTOMATIO
// configureTestomatio(testomatioAccessToken, testomatioHost, testomatioProject);
export const handler = async (event) => {
try {
console.log('Configuring Testrail...');
configureTestRail(
event.TESTRAIL_URL,
event.TESTRAIL_USERNAME,
event.TESTRAIL_PASSWORD,
event.TESTRAIL_PROJECT_ID
);
console.log('Configuring Testomatio...');
let host = (event.TESTOMATIO_HOST || process.env.TESTOMATIO_HOST || 'https://app.testomat.io');
console.log('Host...' + host);
configureTestomatio(
event.TESTOMATIO_TOKEN,
host,
event.TESTOMATIO_PROJECT,
);
console.log('Starting migration...');
const result = await migrateTestCases();
console.log('Migration completed:', result);
return {
statusCode: 200,
body: JSON.stringify({ message: 'Migration completed successfully', result })
};
} catch (error) {
console.error('Error:', error);
return {
statusCode: 500,
body: JSON.stringify({ message: 'Internal Server Error', error: error.message })
};
}
};