test: Fix cypress local run (#26652)
## Description - Fix cypress local run #### PR fixes following issue(s) Fixes # (issue number) > if no issue exists, please create an issue and ask the maintainers about this first > > #### Media > A video or a GIF is preferred. when using Loom, don’t embed because it looks like it’s a GIF. instead, just link to the video > > #### Type of change > Please delete options that are not relevant. - Bug fix (non-breaking change which fixes an issue) - New feature (non-breaking change which adds functionality) - Breaking change (fix or feature that would cause existing functionality to not work as expected) - Chore (housekeeping or task changes that don't impact user perception) - This change requires a documentation update > > > ## Testing > #### How Has This Been Tested? > Please describe the tests that you ran to verify your changes. Also list any relevant details for your test configuration. > Delete anything that is not relevant - [ ] Manual - [ ] JUnit - [ ] Jest - [ ] Cypress > > #### Test Plan > Add Testsmith test cases links that relate to this PR > > #### Issues raised during DP testing > Link issues raised during DP testing for better visiblity and tracking (copy link from comments dropped on this PR) > > > ## Checklist: #### Dev activity - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag #### QA activity: - [ ] [Speedbreak features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-) have been covered - [ ] Test plan covers all impacted features and [areas of interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-) - [ ] Test plan has been peer reviewed by project stakeholders and other QA members - [ ] Manually tested functionality on DP - [ ] We had an implementation alignment call with stakeholders post QA Round 2 - [ ] Cypress test cases have been added and approved by SDET/manual QA - [ ] Added `Test Plan Approved` label after Cypress tests were reviewed - [ ] Added `Test Plan Approved` label after JUnit tests were reviewed
This commit is contained in:
parent
a1bf477f58
commit
301852dcd7
3
.github/workflows/upgrade-appsmith-tests.yml
vendored
3
.github/workflows/upgrade-appsmith-tests.yml
vendored
|
|
@ -121,5 +121,4 @@ jobs:
|
||||||
|
|
||||||
- name: Check ci-test set status
|
- name: Check ci-test set status
|
||||||
if: needs.ci-test.result != 'success'
|
if: needs.ci-test.result != 'success'
|
||||||
run: exit 1
|
run: exit 1
|
||||||
|
|
||||||
|
|
@ -36,16 +36,19 @@ function configureDbClient() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is to setup the AWS client
|
// This is to setup the AWS client
|
||||||
AWS.config.update({ region: "ap-south-1" });
|
function configureS3() {
|
||||||
const s3 = new AWS.S3({
|
AWS.config.update({ region: "ap-south-1" });
|
||||||
credentials: {
|
const s3client = new AWS.S3({
|
||||||
accessKeyId: getEnvValue("CYPRESS_S3_ACCESS", { required: true }),
|
credentials: {
|
||||||
secretAccessKey: getEnvValue("CYPRESS_S3_SECRET", { required: true }),
|
accessKeyId: getEnvValue("CYPRESS_S3_ACCESS", { required: true }),
|
||||||
},
|
secretAccessKey: getEnvValue("CYPRESS_S3_SECRET", { required: true }),
|
||||||
});
|
},
|
||||||
|
});
|
||||||
|
return s3client;
|
||||||
|
}
|
||||||
|
|
||||||
// This is to upload files to s3 when required
|
// This is to upload files to s3 when required
|
||||||
function uploadToS3(filePath, key) {
|
function uploadToS3(s3Client, filePath, key) {
|
||||||
const fileContent = fs.readFileSync(filePath);
|
const fileContent = fs.readFileSync(filePath);
|
||||||
|
|
||||||
const params = {
|
const params = {
|
||||||
|
|
@ -53,10 +56,11 @@ function uploadToS3(filePath, key) {
|
||||||
Key: key,
|
Key: key,
|
||||||
Body: fileContent,
|
Body: fileContent,
|
||||||
};
|
};
|
||||||
return s3.upload(params).promise();
|
return s3Client.upload(params).promise();
|
||||||
}
|
}
|
||||||
|
|
||||||
async function cypressHooks(on, config) {
|
async function cypressHooks(on, config) {
|
||||||
|
const s3 = configureS3();
|
||||||
const dbClient = configureDbClient();
|
const dbClient = configureDbClient();
|
||||||
const runData = {
|
const runData = {
|
||||||
commitMsg: getEnvValue("COMMIT_INFO_MESSAGE", { required: false }),
|
commitMsg: getEnvValue("COMMIT_INFO_MESSAGE", { required: false }),
|
||||||
|
|
@ -182,7 +186,7 @@ async function cypressHooks(on, config) {
|
||||||
const key = `${testResponse.rows[0].id}_${specData.specId}_${
|
const key = `${testResponse.rows[0].id}_${specData.specId}_${
|
||||||
scr.testAttemptIndex + 1
|
scr.testAttemptIndex + 1
|
||||||
}`;
|
}`;
|
||||||
Promise.all([uploadToS3(scr.path, key)]).catch((error) => {
|
Promise.all([uploadToS3(s3, scr.path, key)]).catch((error) => {
|
||||||
console.log("Error in uploading screenshots:", error);
|
console.log("Error in uploading screenshots:", error);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -197,7 +201,7 @@ async function cypressHooks(on, config) {
|
||||||
) {
|
) {
|
||||||
console.log("Uploading video...");
|
console.log("Uploading video...");
|
||||||
const key = `${specData.specId}`;
|
const key = `${specData.specId}`;
|
||||||
Promise.all([uploadToS3(results.video, key)]).catch((error) => {
|
Promise.all([uploadToS3(s3, results.video, key)]).catch((error) => {
|
||||||
console.log("Error in uploading video:", error);
|
console.log("Error in uploading video:", error);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user