diff --git a/workflow_tests/platformDeploy.test.js b/workflow_tests/platformDeploy.test.js index 165189b90131..f350758a2fca 100644 --- a/workflow_tests/platformDeploy.test.js +++ b/workflow_tests/platformDeploy.test.js @@ -3,6 +3,7 @@ const kieMockGithub = require('@kie/mock-github'); const utils = require('./utils/utils'); const assertions = require('./assertions/platformDeployAssertions'); const mocks = require('./mocks/platformDeployMocks'); +const eAct = require('./utils/ExtendedAct'); let mockGithub; const FILES_TO_COPY_INTO_TEST_REPO = [ @@ -48,7 +49,7 @@ describe('test workflow platformDeploy', () => { test('as team member - platform deploy executes on staging', async () => { const repoPath = mockGithub.repo.getPath('testPlatformDeployWorkflowRepo') || ''; const workflowPath = path.join(repoPath, '.github', 'workflows', 'platformDeploy.yml'); - let act = new utils.ExtendedAct(repoPath, workflowPath); + let act = new eAct.ExtendedAct(repoPath, workflowPath); act = utils.setUpActParams( act, 'push', @@ -120,7 +121,7 @@ describe('test workflow platformDeploy', () => { test('as OSBotify - platform deploy executes on staging', async () => { const repoPath = mockGithub.repo.getPath('testPlatformDeployWorkflowRepo') || ''; const workflowPath = path.join(repoPath, '.github', 'workflows', 'platformDeploy.yml'); - let act = new utils.ExtendedAct(repoPath, workflowPath); + let act = new eAct.ExtendedAct(repoPath, workflowPath); act = utils.setUpActParams( act, 'push', @@ -192,7 +193,7 @@ describe('test workflow platformDeploy', () => { test('as outsider - platform deploy does not execute', async () => { const repoPath = mockGithub.repo.getPath('testPlatformDeployWorkflowRepo') || ''; const workflowPath = path.join(repoPath, '.github', 'workflows', 'platformDeploy.yml'); - let act = new utils.ExtendedAct(repoPath, workflowPath); + let act = new eAct.ExtendedAct(repoPath, workflowPath); act = utils.setUpActParams( act, 'push', diff --git a/workflow_tests/preDeploy.test.js b/workflow_tests/preDeploy.test.js index 2dfeee8abed9..2339b7390986 100644 --- a/workflow_tests/preDeploy.test.js +++ b/workflow_tests/preDeploy.test.js @@ -3,6 +3,7 @@ const kieMockGithub = require('@kie/mock-github'); const utils = require('./utils/utils'); const assertions = require('./assertions/preDeployAssertions'); const mocks = require('./mocks/preDeployMocks'); +const eAct = require('./utils/ExtendedAct'); let mockGithub; const FILES_TO_COPY_INTO_TEST_REPO = [ @@ -51,7 +52,7 @@ describe('test workflow preDeploy', () => { const workflowPath = path.join(repoPath, '.github', 'workflows', 'preDeploy.yml'); // instantiate Act in the context of the test repo and given workflow file - let act = new utils.ExtendedAct(repoPath, workflowPath); + let act = new eAct.ExtendedAct(repoPath, workflowPath); // set run parameters act = utils.setUpActParams( @@ -102,7 +103,7 @@ describe('test workflow preDeploy', () => { // test('push to different branch - workflow does not execute', async () => { // const repoPath = mockGithub.repo.getPath('testPreDeployWorkflowRepo') || ''; // const workflowPath = path.join(repoPath, '.github', 'workflows', 'preDeploy.yml'); - // let act = new utils.ExtendedAct(repoPath, workflowPath); + // let act = new eAct.ExtendedAct(repoPath, workflowPath); // act = utils.setUpActParams( // act, // 'push', @@ -145,7 +146,7 @@ describe('test workflow preDeploy', () => { test('different event than push - workflow does not execute', async () => { const repoPath = mockGithub.repo.getPath('testPreDeployWorkflowRepo') || ''; const workflowPath = path.join(repoPath, '.github', 'workflows', 'preDeploy.yml'); - let act = new utils.ExtendedAct(repoPath, workflowPath); + let act = new eAct.ExtendedAct(repoPath, workflowPath); const testMockSteps = { lint: mocks.LINT_JOB_MOCK_STEPS, test: mocks.TEST_JOB_MOCK_STEPS, @@ -214,7 +215,7 @@ describe('test workflow preDeploy', () => { test('lint job failed - workflow exits', async () => { const repoPath = mockGithub.repo.getPath('testPreDeployWorkflowRepo') || ''; const workflowPath = path.join(repoPath, '.github', 'workflows', 'preDeploy.yml'); - let act = new utils.ExtendedAct(repoPath, workflowPath); + let act = new eAct.ExtendedAct(repoPath, workflowPath); act = utils.setUpActParams( act, 'push', @@ -293,7 +294,7 @@ describe('test workflow preDeploy', () => { test('test job failed - workflow exits', async () => { const repoPath = mockGithub.repo.getPath('testPreDeployWorkflowRepo') || ''; const workflowPath = path.join(repoPath, '.github', 'workflows', 'preDeploy.yml'); - let act = new utils.ExtendedAct(repoPath, workflowPath); + let act = new eAct.ExtendedAct(repoPath, workflowPath); act = utils.setUpActParams( act, 'push', @@ -372,7 +373,7 @@ describe('test workflow preDeploy', () => { test('lint and test job succeed - workflow continues', async () => { const repoPath = mockGithub.repo.getPath('testPreDeployWorkflowRepo') || ''; const workflowPath = path.join(repoPath, '.github', 'workflows', 'preDeploy.yml'); - let act = new utils.ExtendedAct(repoPath, workflowPath); + let act = new eAct.ExtendedAct(repoPath, workflowPath); act = utils.setUpActParams( act, 'push', @@ -415,7 +416,7 @@ describe('test workflow preDeploy', () => { test('actor is OSBotify - no comment left', async () => { const repoPath = mockGithub.repo.getPath('testPreDeployWorkflowRepo') || ''; const workflowPath = path.join(repoPath, '.github', 'workflows', 'preDeploy.yml'); - let act = new utils.ExtendedAct(repoPath, workflowPath); + let act = new eAct.ExtendedAct(repoPath, workflowPath); act = utils.setUpActParams( act, 'push', @@ -454,7 +455,7 @@ describe('test workflow preDeploy', () => { test('actor is Expensify employee - no comment left', async () => { const repoPath = mockGithub.repo.getPath('testPreDeployWorkflowRepo') || ''; const workflowPath = path.join(repoPath, '.github', 'workflows', 'preDeploy.yml'); - let act = new utils.ExtendedAct(repoPath, workflowPath); + let act = new eAct.ExtendedAct(repoPath, workflowPath); act = utils.setUpActParams( act, 'push', @@ -493,7 +494,7 @@ describe('test workflow preDeploy', () => { test('actor is not Expensify employee, its not their first PR - job triggers, but no comment left', async () => { const repoPath = mockGithub.repo.getPath('testPreDeployWorkflowRepo') || ''; const workflowPath = path.join(repoPath, '.github', 'workflows', 'preDeploy.yml'); - let act = new utils.ExtendedAct(repoPath, workflowPath); + let act = new eAct.ExtendedAct(repoPath, workflowPath); act = utils.setUpActParams( act, 'push', @@ -532,7 +533,7 @@ describe('test workflow preDeploy', () => { test('actor is not Expensify employee, and its their first PR - job triggers and comment left', async () => { const repoPath = mockGithub.repo.getPath('testPreDeployWorkflowRepo') || ''; const workflowPath = path.join(repoPath, '.github', 'workflows', 'preDeploy.yml'); - let act = new utils.ExtendedAct(repoPath, workflowPath); + let act = new eAct.ExtendedAct(repoPath, workflowPath); act = utils.setUpActParams( act, 'push', @@ -575,7 +576,7 @@ describe('test workflow preDeploy', () => { test('not automated PR - deploy skipped and comment left', async () => { const repoPath = mockGithub.repo.getPath('testPreDeployWorkflowRepo') || ''; const workflowPath = path.join(repoPath, '.github', 'workflows', 'preDeploy.yml'); - let act = new utils.ExtendedAct(repoPath, workflowPath); + let act = new eAct.ExtendedAct(repoPath, workflowPath); act = utils.setUpActParams( act, 'push', @@ -615,7 +616,7 @@ describe('test workflow preDeploy', () => { test('automated PR - deploy skipped, but no comment left', async () => { const repoPath = mockGithub.repo.getPath('testPreDeployWorkflowRepo') || ''; const workflowPath = path.join(repoPath, '.github', 'workflows', 'preDeploy.yml'); - let act = new utils.ExtendedAct(repoPath, workflowPath); + let act = new eAct.ExtendedAct(repoPath, workflowPath); act = utils.setUpActParams( act, 'push', @@ -657,7 +658,7 @@ describe('test workflow preDeploy', () => { test('not automated PR - proceed with deploy', async () => { const repoPath = mockGithub.repo.getPath('testPreDeployWorkflowRepo') || ''; const workflowPath = path.join(repoPath, '.github', 'workflows', 'preDeploy.yml'); - let act = new utils.ExtendedAct(repoPath, workflowPath); + let act = new eAct.ExtendedAct(repoPath, workflowPath); act = utils.setUpActParams( act, 'push', @@ -701,7 +702,7 @@ describe('test workflow preDeploy', () => { test('automated PR - deploy skipped, but no comment left', async () => { const repoPath = mockGithub.repo.getPath('testPreDeployWorkflowRepo') || ''; const workflowPath = path.join(repoPath, '.github', 'workflows', 'preDeploy.yml'); - let act = new utils.ExtendedAct(repoPath, workflowPath); + let act = new eAct.ExtendedAct(repoPath, workflowPath); act = utils.setUpActParams( act, 'push', @@ -748,7 +749,7 @@ describe('test workflow preDeploy', () => { test('not automated PR - proceed with deploy', async () => { const repoPath = mockGithub.repo.getPath('testPreDeployWorkflowRepo') || ''; const workflowPath = path.join(repoPath, '.github', 'workflows', 'preDeploy.yml'); - let act = new utils.ExtendedAct(repoPath, workflowPath); + let act = new eAct.ExtendedAct(repoPath, workflowPath); act = utils.setUpActParams( act, 'push', @@ -792,7 +793,7 @@ describe('test workflow preDeploy', () => { test('automated PR - proceed with deploy', async () => { const repoPath = mockGithub.repo.getPath('testPreDeployWorkflowRepo') || ''; const workflowPath = path.join(repoPath, '.github', 'workflows', 'preDeploy.yml'); - let act = new utils.ExtendedAct(repoPath, workflowPath); + let act = new eAct.ExtendedAct(repoPath, workflowPath); act = utils.setUpActParams( act, 'push', @@ -838,7 +839,7 @@ describe('test workflow preDeploy', () => { test('not automated PR - proceed with deploy', async () => { const repoPath = mockGithub.repo.getPath('testPreDeployWorkflowRepo') || ''; const workflowPath = path.join(repoPath, '.github', 'workflows', 'preDeploy.yml'); - let act = new utils.ExtendedAct(repoPath, workflowPath); + let act = new eAct.ExtendedAct(repoPath, workflowPath); act = utils.setUpActParams( act, 'push', @@ -882,7 +883,7 @@ describe('test workflow preDeploy', () => { test('automated PR - proceed with deploy', async () => { const repoPath = mockGithub.repo.getPath('testPreDeployWorkflowRepo') || ''; const workflowPath = path.join(repoPath, '.github', 'workflows', 'preDeploy.yml'); - let act = new utils.ExtendedAct(repoPath, workflowPath); + let act = new eAct.ExtendedAct(repoPath, workflowPath); act = utils.setUpActParams( act, 'push', @@ -928,7 +929,7 @@ describe('test workflow preDeploy', () => { test('one of updateStaging steps failed - failure announced in Slack', async () => { const repoPath = mockGithub.repo.getPath('testPreDeployWorkflowRepo') || ''; const workflowPath = path.join(repoPath, '.github', 'workflows', 'preDeploy.yml'); - let act = new utils.ExtendedAct(repoPath, workflowPath); + let act = new eAct.ExtendedAct(repoPath, workflowPath); act = utils.setUpActParams( act, 'push',