Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ import {environmentReadinessStatus} from '../../../common/environment/environmen
* @returns {vnode} - panel with actions allowed for the user to apply on the environment
*/
export const controlEnvironmentPanel = (environmentModel, item, isAllowedToControl = false) => {
const {currentTransition} = item;
const { state, currentTransition } = item;
const { userVars: {run_start_time_ms} } = item;
const {model} = environmentModel;
const {statusMessage} = environmentReadinessStatus(item, model);
return h('.flex-column.justify-center', {
Expand All @@ -48,10 +49,12 @@ export const controlEnvironmentPanel = (environmentModel, item, isAllowedToContr
]),
isAllowedToControl && h('.flex-row.flex-end.g2.items-center', [
statusMessage && h('.danger.flex-end.flex-row.flex-center', statusMessage),
controlButton(
'.btn-success.w-25', environmentModel, item, 'START', 'START_ACTIVITY', 'CONFIGURED',
Boolean(currentTransition)
),
run_start_time_ms && state !== 'RUNNING' && !currentTransition ?
h('span.warning.text-right#start_action_warning', 'Environment was in RUNNING state once already')
: controlButton(
'.btn-success.w-25', environmentModel, item, 'START', 'START_ACTIVITY', 'CONFIGURED',
Boolean(currentTransition)
),
controlButton(
'.btn-primary', environmentModel, item, 'CONFIGURE', 'CONFIGURE', '', Boolean(currentTransition)
), // button will not be displayed in any state due to OCTRL-628
Expand Down
1 change: 1 addition & 0 deletions Control/test/config/core-grpc.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ const coreGRPCServer = (config) => {
break;
case 2: // STOP
envTest.environment.state = 'CONFIGURED';
envTest.environment.userVars.run_start_time_ms = '1648121309974';
break;
case 3: // CONFIGURE
envTest.environment.state = 'CONFIGURED';
Expand Down
20 changes: 13 additions & 7 deletions Control/test/public/page-environment-mocha.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,19 +159,25 @@ describe('`pageEnvironment` test-suite', async () => {
await waitForTimeout(1000);
const configuredState = await page.evaluate(() => window.model.environment.item.payload.state);
assert.strictEqual(configuredState, 'CONFIGURED');
// click RESET
});

it('should display warning label for START button in state CONFIGURED', async () => {
await page.waitForSelector('#start_action_warning', { timeout: 5000 });
const startButtonWarning = await page.evaluate(() => document.querySelector('#start_action_warning').innerText);
assert.strictEqual(startButtonWarning, 'Environment was in RUNNING state once already');
});

it('should click RESET button to move states (CONFIGURED -> DEPLOYED)', async () => {
await page.evaluate(() => document.querySelector('#buttonToRESET').click());
await waitForTimeout(1000);
const standbyState = await page.evaluate(() => window.model.environment.item.payload.state);
assert.strictEqual(standbyState, 'DEPLOYED');
});

it('should have one button hidden for START in state DEPLOYED', async () => {
await page.waitForSelector('#buttonToSTART', {timeout: 5000});
const startButtonTitle = await page.evaluate(() => document.querySelector('#buttonToSTART').title);
const startButtonStyle = await page.evaluate(() => document.querySelector('#buttonToSTART').style);
assert.strictEqual(startButtonTitle, `'START' cannot be used in state 'DEPLOYED'`);
assert.deepStrictEqual(startButtonStyle, {0: 'display'});
it('should display warning label for START button in state DEPLOYED', async () => {
await page.waitForSelector('#start_action_warning', { timeout: 5000 });
const startButtonWarning = await page.evaluate(() => document.querySelector('#start_action_warning').innerText);
assert.strictEqual(startButtonWarning, 'Environment was in RUNNING state once already');
});

it('should have one button hidden for STOP in state DEPLOYED', async () => {
Expand Down