foreman-tasks 2.0.3 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/js_tests.yml +27 -0
- data/.github/workflows/ruby_tests.yml +74 -0
- data/.rubocop.yml +12 -4
- data/.rubocop_todo.yml +32 -25
- data/Gemfile +5 -0
- data/app/controllers/foreman_tasks/api/tasks_controller.rb +31 -58
- data/app/controllers/foreman_tasks/concerns/parameters/triggering.rb +1 -1
- data/app/controllers/foreman_tasks/recurring_logics_controller.rb +7 -0
- data/app/helpers/foreman_tasks/foreman_tasks_helper.rb +3 -3
- data/app/models/foreman_tasks/recurring_logic.rb +4 -4
- data/app/models/foreman_tasks/task.rb +11 -0
- data/app/models/foreman_tasks/task/dynflow_task.rb +27 -33
- data/app/models/foreman_tasks/task/status_explicator.rb +1 -1
- data/app/models/foreman_tasks/triggering.rb +1 -1
- data/app/models/setting/foreman_tasks.rb +1 -1
- data/app/views/foreman_tasks/api/tasks/index.json.rabl +2 -0
- data/app/views/foreman_tasks/recurring_logics/index.html.erb +3 -1
- data/config/routes.rb +2 -1
- data/db/migrate/20200517215015_rename_bookmarks_controller.rb +2 -2
- data/db/seeds.d/30-notification_blueprints.rb +7 -7
- data/db/seeds.d/61-foreman_tasks_bookmarks.rb +1 -1
- data/lib/foreman_tasks/cleaner.rb +4 -6
- data/lib/foreman_tasks/dynflow/configuration.rb +1 -1
- data/lib/foreman_tasks/dynflow/persistence.rb +4 -6
- data/lib/foreman_tasks/engine.rb +2 -2
- data/lib/foreman_tasks/version.rb +1 -1
- data/package.json +0 -1
- data/test/controllers/api/recurring_logics_controller_test.rb +1 -1
- data/test/controllers/api/tasks_controller_test.rb +7 -7
- data/test/controllers/tasks_controller_test.rb +6 -6
- data/test/core/unit/runner_test.rb +20 -20
- data/test/core/unit/task_launcher_test.rb +8 -8
- data/test/helpers/foreman_tasks/foreman_tasks_helper_test.rb +7 -7
- data/test/helpers/foreman_tasks/tasks_helper_test.rb +3 -3
- data/test/lib/actions/middleware/keep_current_request_id_test.rb +3 -3
- data/test/support/history_tasks_builder.rb +1 -1
- data/test/tasks/generate_task_actions_test.rb +1 -1
- data/test/unit/actions/action_with_sub_plans_test.rb +2 -2
- data/test/unit/actions/bulk_action_test.rb +6 -6
- data/test/unit/actions/proxy_action_test.rb +20 -20
- data/test/unit/actions/recurring_action_test.rb +30 -32
- data/test/unit/cleaner_test.rb +24 -24
- data/test/unit/dashboard_table_filter_test.rb +5 -5
- data/test/unit/otp_manager_test.rb +2 -2
- data/test/unit/proxy_selector_test.rb +9 -9
- data/test/unit/recurring_logic_test.rb +32 -38
- data/test/unit/remote_task_test.rb +2 -2
- data/test/unit/task_groups_test.rb +4 -4
- data/test/unit/task_test.rb +18 -18
- data/test/unit/triggering_test.rb +8 -8
- data/test/unit/troubleshooting_help_generator_test.rb +6 -6
- data/test/unit/ui_notifications_test.rb +11 -11
- data/webpack/ForemanTasks/Components/TaskDetails/Components/RunningSteps.js +3 -3
- data/webpack/ForemanTasks/Components/TaskDetails/Components/Task.js +8 -157
- data/webpack/ForemanTasks/Components/TaskDetails/Components/TaskButtons.js +168 -0
- data/webpack/ForemanTasks/Components/TaskDetails/Components/TaskInfo.js +6 -7
- data/webpack/ForemanTasks/Components/TaskDetails/Components/TaskSkeleton.js +48 -0
- data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/RunningSteps.test.js +1 -1
- data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/Task.test.js +12 -70
- data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/TaskButtons.test.js +95 -0
- data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/__snapshots__/Task.test.js.snap +78 -225
- data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/__snapshots__/TaskButtons.test.js.snap +212 -0
- data/webpack/ForemanTasks/Components/TaskDetails/Components/__tests__/__snapshots__/TaskInfo.test.js.snap +8 -4
- data/webpack/ForemanTasks/Components/TaskDetails/TaskDetails.js +87 -70
- data/webpack/ForemanTasks/Components/TaskDetails/TaskDetailsActions.js +48 -125
- data/webpack/ForemanTasks/Components/TaskDetails/TaskDetailsConstants.js +3 -16
- data/webpack/ForemanTasks/Components/TaskDetails/TaskDetailsSelectors.js +55 -29
- data/webpack/ForemanTasks/Components/TaskDetails/__tests__/TaskDetails.fixtures.js +2 -2
- data/webpack/ForemanTasks/Components/TaskDetails/__tests__/TaskDetails.test.js +6 -0
- data/webpack/ForemanTasks/Components/TaskDetails/__tests__/TaskDetailsActions.test.js +2 -18
- data/webpack/ForemanTasks/Components/TaskDetails/__tests__/__snapshots__/TaskDetails.test.js.snap +77 -27
- data/webpack/ForemanTasks/Components/TaskDetails/__tests__/__snapshots__/TaskDetailsActions.test.js.snap +14 -101
- data/webpack/ForemanTasks/Components/TaskDetails/index.js +6 -3
- data/webpack/ForemanTasks/Components/common/urlHelpers.js +7 -0
- data/webpack/ForemanTasks/ForemanTasksReducers.js +0 -2
- data/webpack/__mocks__/foremanReact/common/helpers.js +2 -0
- data/webpack/__mocks__/foremanReact/redux/API/APISelectors.js +10 -0
- data/webpack/__mocks__/foremanReact/redux/API/index.js +10 -0
- data/webpack/__mocks__/foremanReact/redux/middlewares/IntervalMiddleware.js +5 -0
- metadata +17 -14
- data/.travis.yml +0 -7
- data/script/travis_run_js_tests.sh +0 -7
- data/webpack/ForemanTasks/Components/TaskDetails/TaskDetailsReducer.js +0 -38
- data/webpack/ForemanTasks/Components/TaskDetails/__tests__/TaskDetailsReducer.test.js +0 -33
- data/webpack/ForemanTasks/Components/TaskDetails/__tests__/__snapshots__/TaskDetailsReducer.test.js.snap +0 -26
- data/webpack/ForemanTasks/Components/TaskDetails/__tests__/__snapshots__/integration.test.js.snap +0 -122
- data/webpack/ForemanTasks/Components/TaskDetails/__tests__/integration.test.js +0 -72
- data/webpack/__mocks__/foremanReact/redux/API.js +0 -7
@@ -1,72 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
|
3
|
-
import { API } from 'foremanReact/redux/API';
|
4
|
-
import { IntegrationTestHelper } from '@theforeman/test';
|
5
|
-
|
6
|
-
import TaskDetails, { reducers } from '../index';
|
7
|
-
import { selectForemanTasks } from '../../../ForemanTasksSelectors';
|
8
|
-
import { minProps } from './TaskDetails.fixtures';
|
9
|
-
|
10
|
-
jest.mock('../../../ForemanTasksSelectors');
|
11
|
-
jest.mock('foremanReact/redux/API');
|
12
|
-
selectForemanTasks.mockImplementation(state => state);
|
13
|
-
describe('TaskDetails integration test', () => {
|
14
|
-
beforeEach(() => {
|
15
|
-
jest.useFakeTimers();
|
16
|
-
const expectedIntervalId = 1;
|
17
|
-
jest.useFakeTimers();
|
18
|
-
setInterval.mockImplementation(() => expectedIntervalId);
|
19
|
-
delete window.location;
|
20
|
-
window.location = new URL(
|
21
|
-
'https://foreman.com/foreman_tasks/tasks/a15dd820-32f1-4ced-9ab7-c0fab8234c47/'
|
22
|
-
);
|
23
|
-
});
|
24
|
-
it('should flow', async () => {
|
25
|
-
window.location.reload = jest.fn();
|
26
|
-
|
27
|
-
API.get.mockImplementationOnce();
|
28
|
-
const integrationTestHelper = new IntegrationTestHelper(reducers);
|
29
|
-
|
30
|
-
const component = integrationTestHelper.mount(
|
31
|
-
<TaskDetails {...minProps} id="test" />
|
32
|
-
);
|
33
|
-
integrationTestHelper.takeStoreSnapshot('initial state');
|
34
|
-
|
35
|
-
const reloadButton = component.find('.reload-button').at(0);
|
36
|
-
reloadButton.simulate('click');
|
37
|
-
await IntegrationTestHelper.flushAllPromises();
|
38
|
-
|
39
|
-
integrationTestHelper.takeActionsSnapshot(
|
40
|
-
'task details reload start with error'
|
41
|
-
);
|
42
|
-
|
43
|
-
reloadButton.simulate('click');
|
44
|
-
await IntegrationTestHelper.flushAllPromises();
|
45
|
-
jest.advanceTimersByTime(1);
|
46
|
-
integrationTestHelper.takeActionsSnapshot('task details reload stop');
|
47
|
-
jest.useRealTimers();
|
48
|
-
});
|
49
|
-
|
50
|
-
it('should change the data after reload', async () => {
|
51
|
-
API.get.mockImplementationOnce(() => ({
|
52
|
-
data: { label: 'new-label' },
|
53
|
-
}));
|
54
|
-
const integrationTestHelper = new IntegrationTestHelper(reducers);
|
55
|
-
|
56
|
-
const component = integrationTestHelper.mount(
|
57
|
-
<TaskDetails {...minProps} id="test" />
|
58
|
-
);
|
59
|
-
|
60
|
-
const reloadButton = component.find('.reload-button').at(0);
|
61
|
-
reloadButton.simulate('click');
|
62
|
-
|
63
|
-
await IntegrationTestHelper.flushAllPromises();
|
64
|
-
integrationTestHelper.takeActionsSnapshot(
|
65
|
-
'task details reload start without error'
|
66
|
-
);
|
67
|
-
integrationTestHelper.takeStoreAndLastActionSnapshot(
|
68
|
-
'task details data should change'
|
69
|
-
);
|
70
|
-
jest.useRealTimers();
|
71
|
-
});
|
72
|
-
});
|