Skip to content

Commit

Permalink
test: add test to check SP changes & file upload
Browse files Browse the repository at this point in the history
  • Loading branch information
csm-thu committed Jan 6, 2022
1 parent 66d2425 commit 0fd4375
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion cypress/integration/brewery/FileParameters-tests.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@
import 'cypress-file-upload';
import utils from '../../commons/TestUtils';

import { SCENARIO_NAME, DATASET, RUN_TEMPLATE } from '../../commons/constants/brewery/TestConstants';
import {
BASIC_PARAMETERS_CONST,
SCENARIO_NAME,
DATASET,
RUN_TEMPLATE,
} from '../../commons/constants/brewery/TestConstants';
import { Scenarios, ScenarioManager, ScenarioParameters, Login } from '../../commons/actions';
import { BreweryParameters } from '../../commons/actions/brewery';

Expand Down Expand Up @@ -42,16 +47,31 @@ describe('Simple operations on a file parameter', () => {
let firstScenarioName;
let firstScenarioId;
it('can upload a file and run the scenario', () => {
const currencySymbol = utils.randomEnum(BASIC_PARAMETERS_CONST.ENUM);
const currencyName = utils.randomStr(8);
const currencyValue = utils.randomNmbr(BASIC_PARAMETERS_CONST.NUMBER.MIN, BASIC_PARAMETERS_CONST.NUMBER.MAX);
firstScenarioName = forgeScenarioName();
scenarioNamesToDelete.push(firstScenarioName);
Scenarios.createScenario(firstScenarioName, true, SCENARIO_DATASET, SCENARIO_RUN_TEMPLATE).then((value) => {
firstScenarioId = value.scenarioCreatedId;
});

ScenarioParameters.edit();
BreweryParameters.switchToBasicTypesTab();
BreweryParameters.getCurrencyNameInput().click().clear().type(currencyName);
BreweryParameters.getCurrencyValueInput().click().clear().type(currencyValue);
BreweryParameters.getCurrencyTextField().type(currencySymbol + ' {enter}');
BreweryParameters.switchToDatasetPartsTab();
BreweryParameters.uploadExampleDatasetPart1(FILE_PATH_1);

ScenarioParameters.updateAndLaunch();
BreweryParameters.getExampleDatasetPart1DownloadButton().should('have.text', FILE_PATH_1);
BreweryParameters.switchToBasicTypesTab();
BreweryParameters.getCurrencyNameInput().should('value', currencyName);
BreweryParameters.getCurrencyValueInput().should('value', currencyValue);
ScenarioParameters.getInputValue(BreweryParameters.getCurrencyInput()).then((value) => {
expect(BASIC_PARAMETERS_CONST.ENUM[value], currencySymbol);
});
});

it('can upload a file, delete it and run the scenario', () => {
Expand Down

0 comments on commit 0fd4375

Please sign in to comment.