diff --git a/cypress/integration/submission-ui.spec.ts b/cypress/integration/submission-ui.spec.ts index 3e895f85012..b985d43d0ac 100644 --- a/cypress/integration/submission-ui.spec.ts +++ b/cypress/integration/submission-ui.spec.ts @@ -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'); @@ -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', { diff --git a/src/app/submission/sections/clarin-license-resource/license-4-selector.model.ts b/src/app/submission/sections/clarin-license-resource/license-4-selector.model.ts index 1e954edafc4..62aa8ddbc4d 100644 --- a/src/app/submission/sections/clarin-license-resource/license-4-selector.model.ts +++ b/src/app/submission/sections/clarin-license-resource/license-4-selector.model.ts @@ -5,4 +5,5 @@ export class License4Selector { id: number; name: string; url: string; + licenseLabel: string; } diff --git a/src/app/submission/sections/clarin-license-resource/section-license.component.html b/src/app/submission/sections/clarin-license-resource/section-license.component.html index b765eb9c88f..87e97eecd1b 100644 --- a/src/app/submission/sections/clarin-license-resource/section-license.component.html +++ b/src/app/submission/sections/clarin-license-resource/section-license.component.html @@ -1,3 +1,4 @@ +