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
255 changes: 130 additions & 125 deletions cypress/integration/submission-ui.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,13 @@ const createItemProcess = {
cy.get('section[class = "license-selector is-active"] ul li').eq(0).dblclick();
},
checkLicenseSelectionValue(value: string) {
cy.get('ds-submission-section-clarin-license select[id = "aspect_submission_StepTransformer_field_license"]').contains(value);
cy.get('ds-submission-section-clarin-license input[id = "aspect_submission_StepTransformer_field_license"]').should('have.value', value);
},
selectValueFromLicenseSelection(option: string) {
cy.get('ds-submission-section-clarin-license select[id = "aspect_submission_StepTransformer_field_license"]').select(option);
selectValueFromLicenseSelection(id: number) {
cy.get('ds-submission-section-clarin-license li[value = "' + id + '"]').click();
},
clickOnLicenseSelectionButton() {
cy.get('ds-submission-section-clarin-license input[id = "aspect_submission_StepTransformer_field_license"]').click();
},
checkResourceLicenseStatus(statusTitle: string) {
cy.get('div[id = "clarin-license-header"] button i[title = "' + statusTitle + '"]').should('be.visible');
Expand Down Expand Up @@ -264,129 +267,131 @@ describe('Create a new submission', () => {
// addEUSponsor(3);
// });

// From HERE **********
// Test type-bind
it('should be showed chosen type value', {
retries: {
runMode: 6,
openMode: 6,
},
defaultCommandTimeout: 10000
},() => {
createItemProcess.clickOnSelectionInput('dc.type');
createItemProcess.clickOnTypeSelection('Article');
});

// // Test type-bind
// it('should be showed chosen type value', {
// retries: {
// runMode: 6,
// openMode: 6,
// },
// defaultCommandTimeout: 10000
// },() => {
// createItemProcess.clickOnSelectionInput('dc.type');
// createItemProcess.clickOnTypeSelection('Article');
// });
//
// // Test CMDI input field
// it('should be visible Has CMDI file input field because user is admin', {
// retries: {
// runMode: 6,
// openMode: 6,
// },
// defaultCommandTimeout: 10000
// },() => {
// createItemProcess.checkLocalHasCMDIVisibility();
// });
//
// it('The local.hasCMDI value should be sent in the response after type change', {
// retries: {
// runMode: 6,
// openMode: 6,
// },
// defaultCommandTimeout: 10000
// },() => {
// createItemProcess.clickOnSelectionInput('dc.type');
// createItemProcess.clickOnTypeSelection('Article');
// createItemProcess.checkCheckbox('local_hasCMDI');
// createItemProcess.controlCheckedCheckbox('local_hasCMDI',true);
// createItemProcess.clickOnSave();
// cy.reload();
// createItemProcess.controlCheckedCheckbox('local_hasCMDI',true);
// });
//
// it('should change the step status after accepting/declining the distribution license', {
// retries: {
// runMode: 6,
// openMode: 6,
// },
// defaultCommandTimeout: 10000
// },() => {
// createItemProcess.checkDistributionLicenseStep();
// createItemProcess.checkDistributionLicenseToggle();
// // default status value is warnings
// createItemProcess.checkDistributionLicenseStatus('Warnings');
// // accept the distribution license agreement
// createItemProcess.clickOnDistributionLicenseToggle();
// // after accepting the status should be valid
// createItemProcess.checkDistributionLicenseStatus('Valid');
// // click on the toggle again and status should be changed to `Warnings`
// createItemProcess.clickOnDistributionLicenseToggle();
// createItemProcess.checkDistributionLicenseStatus('Warnings');
// });
//
// it('should pick up the license from the license selector', {
// retries: {
// runMode: 6,
// openMode: 6,
// },
// defaultCommandTimeout: 10000
// },() => {
// createItemProcess.checkLicenseResourceStep();
// // check default value in the license dropdown selection
// createItemProcess.checkLicenseSelectionValue('Select a License ...');
// // pop up the license selector modal
// createItemProcess.clickOnLicenseSelectorButton();
// // check if the modal was popped up
// createItemProcess.checkLicenseSelectorModal();
// // pick up the first license from the modal, it is `Public Domain Mark (PD)`
// createItemProcess.pickUpLicenseFromLicenseSelector();
// // check if the picked up license value is seen as selected value in the selection
// createItemProcess.checkLicenseSelectionValue('Public Domain Mark (PD)');
// });
//
// it('should select the license from the license selection dropdown and change status', {
// retries: {
// runMode: 6,
// openMode: 6,
// },
// defaultCommandTimeout: 10000
// },() => {
// createItemProcess.checkLicenseResourceStep();
// // check default value in the license dropdown selection
// createItemProcess.checkLicenseSelectionValue('Select a License ...');
// // check step status - it should be as warning
// createItemProcess.checkResourceLicenseStatus('Warnings');
// // select `Public Domain Mark (PD)` from the selection
// createItemProcess.selectValueFromLicenseSelection('Public Domain Mark (PD)');
// // selected value should be seen as selected value in the selection
// createItemProcess.checkLicenseSelectionValue('Public Domain Mark (PD)');
// // check step status - it should be valid
// createItemProcess.checkResourceLicenseStatus('Valid');
// });
//
// it('should show warning messages if was selected non-supported license', {
// retries: {
// runMode: 6,
// openMode: 6,
// },
// defaultCommandTimeout: 10000
// },() => {
// createItemProcess.checkLicenseResourceStep();
// // check default value in the license dropdown selection
// createItemProcess.checkLicenseSelectionValue('Select a License ...');
// // check step status - it should be as warning
// createItemProcess.checkResourceLicenseStatus('Warnings');
// // select `Select a License ...` from the selection - this license is not supported
// createItemProcess.selectValueFromLicenseSelection('Select a License ...');
// // selected value should be seen as selected value in the selection
// createItemProcess.checkLicenseSelectionValue('Select a License ...');
// // check step status - it should an error
// createItemProcess.checkResourceLicenseStatus('Errors');
// // error messages should be popped up
// createItemProcess.showErrorMustChooseLicense();
// createItemProcess.showErrorNotSupportedLicense();
// });
// Test CMDI input field
it('should be visible Has CMDI file input field because user is admin', {
retries: {
runMode: 6,
openMode: 6,
},
defaultCommandTimeout: 10000
},() => {
createItemProcess.checkLocalHasCMDIVisibility();
});

it('The local.hasCMDI value should be sent in the response after type change', {
retries: {
runMode: 6,
openMode: 6,
},
defaultCommandTimeout: 10000
},() => {
createItemProcess.clickOnSelectionInput('dc.type');
createItemProcess.clickOnTypeSelection('Article');
createItemProcess.checkCheckbox('local_hasCMDI');
createItemProcess.controlCheckedCheckbox('local_hasCMDI',true);
createItemProcess.clickOnSave();
cy.reload();
createItemProcess.controlCheckedCheckbox('local_hasCMDI',true);
});

it('should change the step status after accepting/declining the distribution license', {
retries: {
runMode: 6,
openMode: 6,
},
defaultCommandTimeout: 10000
},() => {
createItemProcess.checkDistributionLicenseStep();
createItemProcess.checkDistributionLicenseToggle();
// default status value is warnings
createItemProcess.checkDistributionLicenseStatus('Warnings');
// accept the distribution license agreement
createItemProcess.clickOnDistributionLicenseToggle();
// after accepting the status should be valid
createItemProcess.checkDistributionLicenseStatus('Valid');
// click on the toggle again and status should be changed to `Warnings`
createItemProcess.clickOnDistributionLicenseToggle();
createItemProcess.checkDistributionLicenseStatus('Warnings');
});

it('should pick up the license from the license selector', {
retries: {
runMode: 6,
openMode: 6,
},
defaultCommandTimeout: 10000
},() => {
createItemProcess.checkLicenseResourceStep();
// check default value in the license dropdown selection
createItemProcess.checkLicenseSelectionValue('Select a License ...');
// pop up the license selector modal
createItemProcess.clickOnLicenseSelectorButton();
// check if the modal was popped up
createItemProcess.checkLicenseSelectorModal();
// pick up the first license from the modal, it is `Public Domain Mark (PD)`
createItemProcess.pickUpLicenseFromLicenseSelector();
// check if the picked up license value is seen as selected value in the selection
createItemProcess.checkLicenseSelectionValue('Public Domain Mark (PD)');
});

it('should select the license from the license selection dropdown and change status', {
retries: {
runMode: 6,
openMode: 6,
},
defaultCommandTimeout: 10000
},() => {
createItemProcess.checkLicenseResourceStep();
// check default value in the license dropdown selection
createItemProcess.checkLicenseSelectionValue('Select a License ...');
// check step status - it should be as warning
createItemProcess.checkResourceLicenseStatus('Warnings');
// click on the dropdown button to list options
createItemProcess.clickOnLicenseSelectionButton();
// select `Public Domain Mark (PD)` from the selection
createItemProcess.selectValueFromLicenseSelection(2);
// // selected value should be seen as selected value in the selection
createItemProcess.checkLicenseSelectionValue('GNU General Public License, version 2');
// // check step status - it should be valid
createItemProcess.checkResourceLicenseStatus('Valid');
});

it('should show warning messages if was selected non-supported license', {
retries: {
runMode: 6,
openMode: 6,
},
defaultCommandTimeout: 10000
},() => {
createItemProcess.checkLicenseResourceStep();
// check default value in the license dropdown selection
createItemProcess.checkLicenseSelectionValue('Select a License ...');
// check step status - it should be as warning
createItemProcess.checkResourceLicenseStatus('Warnings');
// click on the dropdown button to list options
createItemProcess.clickOnLicenseSelectionButton();
// select `Select a License ...` from the selection - this license is not supported
createItemProcess.selectValueFromLicenseSelection(0);
// selected value should be seen as selected value in the selection
createItemProcess.checkLicenseSelectionValue('Select a License ...');
// check step status - it should an error
createItemProcess.checkResourceLicenseStatus('Errors');
// error messages should be popped up
createItemProcess.showErrorMustChooseLicense();
createItemProcess.showErrorNotSupportedLicense();
});

// Author field should consist of two input fields
it('Author field should consist of two input fields', {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ export class License4Selector {
id: number;
name: string;
url: string;
licenseLabel: string;
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<span id="secret-selected-license-from-license-selector" style="display: none" #licenseSelection></span>
<button id="secret-change-button" type="button" (click)="changeLicenseNameFromRef()" style="display: none">
</button>
<div class="container">
Expand Down Expand Up @@ -42,17 +43,37 @@
</div>
</div>
<div class="col-md-12">
<div class="form-group">
<select #licenseSelection [(ngModel)]="selectedLicenseFromOptionId" (change)="selectLicense()"
id="aspect_submission_StepTransformer_field_license"
class="form-control" name="license" tabindex="-1" title="">
<option [value]="'0'" selected="selected">
{{'submission.sections.clarin-license.head.license-select-default-value' | translate}}
</option>
<option *ngFor="let license of licenses4Selector" [value]="license.id" id="license_option">
{{license.name}}
</option>
</select>
<div class="form-group mb-0">
<div class="input-group">
<input type="button"
class="custom-select clarin-select-input btn text-left"
id="aspect_submission_StepTransformer_field_license"
data-toggle="dropdown"
aria-haspopup="true"
aria-expanded="false"
[value]="this.selectedLicenseName"/>
<ul class="dropdown-menu scrollable-menu"
aria-labelledby="aspect_submission_StepTransformer_field_license">
<div class="form-group has-search mb-0">
<span class="fa fa-search form-control-feedback"></span>
<input type="search"
(input)="searchInClarinLicenses($event)"
class="form-control border-top-0 border-left-0 border-right-0 no-radius shadow-none"
placeholder="Search">
</div>
<li class="dropdown-item clarin-dropdown-item pt-2" value="0" (click)="selectLicense(0)">
<b>{{'submission.sections.clarin-license.head.license-select-default-value' | translate}}</b>
</li>
<li class="dropdown-item clarin-dropdown-item pt-2"
*ngFor="let license of filteredLicenses4Selector"
(click)="selectLicense(license.id)"
[value]="license.id"
id="license_option">
<span [class]="'label label-' + license.licenseLabel">{{license.licenseLabel}}</span>
<b>{{license.name}}</b>
</li>
</ul>
</div>
</div>
</div>
<div class="col-md-12">
Expand Down
Loading