diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 324cebc5f..4d2059bea 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -39,4 +39,10 @@ jobs:
- name: Run HTML5 Validator
run: html5validator --root _site/
+
+ - name: Serve with jekyll
+ run: bundle exec jekyll serve
+
+ - name: Cypress
+ run: npm run cypress
\ No newline at end of file
diff --git a/_includes/form/presets/selectDesign.html b/_includes/form/presets/selectDesign.html
index e413b8592..14a6ef9c2 100644
--- a/_includes/form/presets/selectDesign.html
+++ b/_includes/form/presets/selectDesign.html
@@ -2,7 +2,7 @@
{%- assign group = "select" -%}
{%- assign design_arr = "" | split: ',' -%}
{%- for design in site.data.design -%}
- {%- assign design_arr = design_arr | push: design[1].name[page.lang] -%}
+ {%- assign design_arr = design_arr | push: design[1] -%}
{%- endfor %}
{%- assign design_arr = design_arr | sort_natural -%}
@@ -10,7 +10,7 @@
{%- for design in design_arr -%}
- {{ design }}
+ {{ design.name[page.lang] }}
{%- endfor -%}
diff --git a/_pages/en/open-design.html b/_pages/en/open-design.html
index ad86f05e6..52b18dc4f 100644
--- a/_pages/en/open-design.html
+++ b/_pages/en/open-design.html
@@ -5,7 +5,7 @@
permalink: /en/open-design.html
---
-Open Design Resources
+Open Designs
Open design refers to a design for a physical or software product released under a license granting anyone permission to use, modify or redistribute it.
Search the catalog for open design resource by different levels of Canadian public .
You may also add a resource or update its data using using the Open Design Resource Form .
diff --git a/_pages/fr/design-libre.html b/_pages/fr/design-libre.html
index 87f199d8b..bc02ecfb7 100644
--- a/_pages/fr/design-libre.html
+++ b/_pages/fr/design-libre.html
@@ -5,7 +5,7 @@
permalink: /fr/design-libre.html
---
-Design libres
+Designs Libres
Un design libre est un design, que ce soit pour un produit physique ou un logiciel, dont le développement suit un processus semblable au code et logiciel libre. La licence du design permet d’y accéder librement, de créer des travaux dérivés, de modifier le design et de le redistribuer.
Consultez la liste des designs libres utilisés par les administrations publiques canadiennes.
Vous pouvez ajouter un design ou modifier ses informations en utilisant le Formulaire de Design Libre .
diff --git a/assets/js/src/designForm.js b/assets/js/src/designForm.js
index 1f1f7cf35..55badce8d 100644
--- a/assets/js/src/designForm.js
+++ b/assets/js/src/designForm.js
@@ -11,6 +11,8 @@
const designSelect = $('.page-designForm #nameselect');
const adminSelect = $('.page-designForm #adminCode');
+const URL = document.defaultView.location.origin +
+(document.defaultView.location.protocol == "http:" ? "/ore-ero" : "");
$(document).ready(function () {
$('#prbotSubmitdesignForm').click(function () {
@@ -408,7 +410,7 @@ function getConfigNew(designObject, file, ProjectName) {
function selectDesign() {
let value = designSelect.val();
- $.getJSON('../design.json', function (result) {
+ $.getJSON(URL + '/design.json', function (result) {
if (result[value]) {
addValueToFieldsDesign(result[value]);
$('#adminCode').focus();
@@ -458,7 +460,7 @@ function resetFieldsDesign() {
function selectAdmin() {
let design = designSelect.val();
let administration = adminSelect.val();
- $.getJSON('../design.json', function (result) {
+ $.getJSON(URL + '/design.json', function (result) {
if (result[design]) {
for (let i = 0; i < result[design].administrations.length; i++) {
if (result[design].administrations[i].adminCode == administration) {
diff --git a/assets/js/src/designType.js b/assets/js/src/designType.js
index e8c958d75..8f1dacede 100644
--- a/assets/js/src/designType.js
+++ b/assets/js/src/designType.js
@@ -93,6 +93,7 @@ function fillTypeFields(designTypes) {
}
$('#designType' + id).val(designType.type.en);
});
+
}
function addType(index) {
diff --git a/assets/js/src/validation.js b/assets/js/src/validation.js
index 16f2f6ec3..92c516df3 100644
--- a/assets/js/src/validation.js
+++ b/assets/js/src/validation.js
@@ -74,3 +74,7 @@ function submitInit() {
}
return valid;
}
+//Allows use of the function for testing so there isn't any real submission happening
+window.submit_init = {
+ submitInit,
+};
\ No newline at end of file
diff --git a/cypress/integration/unit-tests/licences.spec.js b/cypress/integration/unit-tests/licences.spec.js
new file mode 100644
index 000000000..ecf88b116
--- /dev/null
+++ b/cypress/integration/unit-tests/licences.spec.js
@@ -0,0 +1,18 @@
+context('Licences', () => {
+ it ('addMorelicences button should add an element to the list and show the removeMorelicences button', () => {
+ cy.visit('http://localhost:4000/ore-ero/en/open-design-form.html');
+ cy.get('#addMorelicences').find('.btn-tabs-more').click();
+ cy.get('#addMorelicences').find('ul > li').should('have.length', 2);
+ cy.get('#addMorelicences').find('.btn-tabs-more-remove').should('be.visible');
+ });
+ it ('removeMorelicences button should remove an item from the list and disappear', () => {
+ cy.get('#addMorelicences').find('.btn-tabs-more-remove').click();
+ cy.get('#addMorelicences').find('ul > li').should('have.length', 1);
+ cy.get('#addMorelicences').find('.btn-tabs-more-remove').should('be.hidden');
+ });
+
+ it ('There should be available licence options', () => {
+ cy.visit('http://localhost:4000/ore-ero/en/open-design-form.html');
+ cy.get('#licencesspdxID').children().should('have.length.greaterThan', 1);
+ });
+});
\ No newline at end of file
diff --git a/cypress/integration/unit-tests/open-design/design-form.spec.js b/cypress/integration/unit-tests/open-design/design-form.spec.js
new file mode 100644
index 000000000..c31b51687
--- /dev/null
+++ b/cypress/integration/unit-tests/open-design/design-form.spec.js
@@ -0,0 +1,315 @@
+///
+/* global cy, context, it */
+
+context('Open Design on the English Form Page', () => {
+ before(() => {
+ cy.visit("http://localhost:4000/ore-ero/en/open-design-form.html");
+ });
+
+ it('Loads the English form page', () => {
+ cy.get('#wb-cont').contains('Open Design Form');
+ });
+
+ it('Loads the script', () => {
+ cy.window().should('have.property', 'designType');
+ });
+
+
+
+ it ('Should reset all fields filled by design select if the selected option is modified', () => {
+ cy.get('#nameselect').children().eq(1).invoke('text').then((name) => {
+ cy.get('#nameselect').select(name);
+ cy.get('#nameselect').select('');
+ cy.get('#nameselect').children().first().should('be.selected');
+ cy.get('#enname').should('have.value', '');
+ cy.get('#frname').should('have.value', '');
+ cy.get('#endescriptionwhatItDoes').should('have.value', '');
+ cy.get('#frdescriptionwhatItDoes').should('have.value', '');
+ cy.get('#enhomepageURL').should('have.value', '');
+ cy.get('#frhomepageURL').should('have.value', '');
+ cy.get('#addMoredesignType').find('ul > li').should('have.length.lte', 1);
+ cy.get('#designType').children().first().should('be.selected');
+ cy.get('#addMorelicences').find('ul > li').should('have.length.lte', 1);
+ cy.get('#enlicencesURL').should('have.value', '');
+ cy.get('#frlicencesURL').should('have.value', '');
+ cy.get('#licencesspdxID').children().first().should('be.selected');
+ });
+
+ });
+
+ it ('New admin button should make new admin field appear if hidden and both new admin button and remove new admin button should hide it if shown', () => {
+ cy.get('#newAdminButton').click();
+ cy.get('#newAdmin').should('be.visible');
+ cy.get('#newAdminButton').click();
+ cy.get('#newAdmin').should('be.hidden');
+ cy.get('#newAdminButton').click();
+ cy.get('#removeNewAdminButton').click();
+ cy.get('#newAdmin').should('be.hidden');
+ });
+
+
+
+
+ it('Values should be autofilled when design name is selected', () => {
+ cy.get('#nameselect').children().eq(1).invoke('text').then((name) => {
+ cy.get('#nameselect').select(name);
+ cy.get('#enname').should('have.value', name);
+ cy.get('#frname').should('not.have.value', '');
+ cy.get('#endescriptionwhatItDoes').should('not.have.value', '');
+ cy.get('#frdescriptionwhatItDoes').should('not.have.value', '');
+ cy.get('#enhomepageURL').should('not.have.value', '');
+ cy.get('#frhomepageURL').should('not.have.value', '');
+ cy.get('#addMoredesignType').find('ul > li').each(($li, id) => {
+ let i = id == 0 ? '' : id;
+ cy.get('#designType' + i).children().first().should('not.be.selected');
+ });
+ cy.get('#addMorelicences').find('ul > li').each(($li, id) => {
+ let i = id == 0 ? '' : id;
+ cy.get('#enlicencesURL' + i).should('not.have.value', '');
+ cy.get('#frlicencesURL' + i).should('not.have.value', '');
+ cy.get('#licencesspdxID' + i).children().first().should('not.be.selected');
+ });
+ });
+});
+
+it('Should reset all fields when reset is activated', () => {
+ cy.get('#date').type('2020-02-19');
+ cy.get('#contactemail').type('Test@test.ca');
+ cy.get('#contactname').type('Test');
+ cy.get('#submitterusername').type('Test');
+ cy.get('#submitteremail').type('Test@test.ca');
+ cy.get('#frteam').type('Test');
+ cy.get('#enteam').type('Test');
+ cy.get('#frdescriptionhowItWorks').type('Test');
+ cy.get('#endescriptionhowItWorks').type('Test');
+ cy.get('#designStatus').select('Original design');
+ cy.get('#addMoredesignType').find('.btn-tabs-more').click();
+ cy.get('#addMoredesignType').find('.btn-tabs-more').click();
+ cy.get('#addMorelicences').find('.btn-tabs-more').click();
+ cy.get('#addMorelicences').find('.btn-tabs-more').click();
+ cy.get('#adminCode').children().eq(1)
+ .children().eq(1).invoke('text').then((code) => {
+ cy.get('#adminCode').select(code);
+ cy.get('#formReset').click().then(() => {
+ cy.get('#adminCode').children().first().should('be.selected');
+ cy.get('#nameselect').children().first().should('be.selected');
+ cy.get('#enname').should('have.value', '');
+ cy.get('#frname').should('have.value', '');
+ cy.get('#endescriptionwhatItDoes').should('have.value', '');
+ cy.get('#frdescriptionwhatItDoes').should('have.value', '');
+ cy.get('#frdescriptionhowItWorks').should('have.value', '');
+ cy.get('#endescriptionhowItWorks').should('have.value', '');
+ cy.get('#enhomepageURL').should('have.value', '');
+ cy.get('#frhomepageURL').should('have.value', '');
+ cy.get('#addMoredesignType').find('ul > li').should('have.length.lte', 1);
+ cy.get('#designType').children().first().should('be.selected');
+ cy.get('#addMorelicences').find('ul > li').should('have.length.lte', 1);
+ cy.get('#enlicencesURL').should('have.value', '');
+ cy.get('#frlicencesURL').should('have.value', '');
+ cy.get('#licencesspdxID').children().first().should('be.selected');
+ cy.get('#designStatus').children().first().should('be.selected');
+ cy.get('#frteam').should('have.value', '');
+ cy.get('#enteam').should('have.value', '');
+ cy.get('#date').should('have.value', '');
+ cy.get('#contactemail').should('have.value', '');
+ cy.get('#contactname').should('have.value', '');
+ cy.get('#submitteremail').should('have.value', '');
+ cy.get('#submitterusername').should('have.value', '');
+ });
+ });
+});
+it ('Should submit', () => {
+ cy.get('#nameselect').children().eq(1).invoke('text').then((name) => {
+ cy.get('#nameselect').select(name);
+ cy.get('#adminCode').children().eq(1)
+ .children().eq(1).invoke('text').then((code) => {
+ cy.get('#adminCode').select(code);
+ cy.get('#submitterusername').type('E');
+ cy.get('#submitteremail').type('E@test.ca');
+ cy.get('#contactemail').type('E@test.ca');
+ cy.get('#date').type('2020-02-19');
+ cy.window().then(win => {
+ win.submit_init.submitInit();
+ });
+ cy.get('#prbotSubmitAlertInProgress').should('be.visible');
+ });
+ });
+});
+
+it ('Should fail submit', () => {
+ cy.visit("http://localhost:4000/ore-ero/en/open-design-form.html");
+ //Wait needed because otherwise the click happens too fast and the validation doesn't really go through
+ cy.wait(1000);
+ cy.window().then(win => {
+ win.submit_init.submitInit();
+ });
+ cy.get('#errors-validation').should('exist');
+ cy.get('#errors-validation').find('ul > li').should('have.length', 15);
+});
+
+it ('Should fail submit with 1 error', () => {
+ cy.get('#nameselect').children().eq(1).invoke('text').then((name) => {
+ cy.get('#nameselect').select(name);
+ cy.get('#adminCode').children().eq(1)
+ .children().eq(1).invoke('text').then((code) => {
+ cy.get('#adminCode').select(code);
+ cy.get('#contactemail').type('Test@test.ca');
+ cy.get('#submitterusername').type('Test');
+ cy.get('#submitteremail').type('Test@test.ca');
+ cy.window().then(win => {
+ win.submit_init.submitInit();
+ });
+ cy.get('#errors-validation').find('ul > li').should('have.length', 1);
+ });
+ });
+});
+});
+
+
+context('Open Design on the French Form page', () => {
+ before(() => {
+ cy.visit('http://localhost:4000/ore-ero/fr/design-libre-formulaire.html');
+ });
+ it('Loads the French form page', () => {
+ cy.get('#wb-cont').contains('Formulaire du Design libre');
+ });
+ it('Loads the script on french page', () => {
+ cy.window().should('have.property', 'designType');
+ });
+
+
+it ('Should reset all fields filled by design select if the selected option is modified on french page', () => {
+ cy.get('#nameselect').children().eq(1).invoke('text').then((name) => {
+ cy.get('#nameselect').select(name);
+ cy.get('#nameselect').select('');
+ cy.get('#nameselect').children().first().should('be.selected');
+ cy.get('#enname').should('have.value', '');
+ cy.get('#frname').should('have.value', '');
+ cy.get('#endescriptionwhatItDoes').should('have.value', '');
+ cy.get('#frdescriptionwhatItDoes').should('have.value', '');
+ cy.get('#enhomepageURL').should('have.value', '');
+ cy.get('#frhomepageURL').should('have.value', '');
+ cy.get('#addMoredesignType').find('ul > li').should('have.length.lte', 1);
+ cy.get('#designType').children().first().should('be.selected');
+ cy.get('#addMorelicences').find('ul > li').should('have.length.lte', 1);
+ cy.get('#enlicencesURL').should('have.value', '');
+ cy.get('#frlicencesURL').should('have.value', '');
+ cy.get('#licencesspdxID').children().first().should('be.selected');
+ });
+});
+it('Values should be autofilled when design name is selected on french page', () => {
+ cy.get('#nameselect').children().eq(1).invoke('text').then((name) => {
+ cy.get('#nameselect').select(name);
+ cy.get('#enname').should('not.have.value', '');
+ cy.get('#frname').should('have.value', name);
+ cy.get('#endescriptionwhatItDoes').should('not.have.value', '');
+ cy.get('#frdescriptionwhatItDoes').should('not.have.value', '');
+ cy.get('#enhomepageURL').should('not.have.value', '');
+ cy.get('#frhomepageURL').should('not.have.value', '');
+ cy.get('#addMoredesignType').find('ul > li').each(($li, id) => {
+ let i = id == 0 ? '' : id;
+ cy.get('#designType' + i).children().first().should('not.be.selected');
+ });
+ cy.get('#addMorelicences').find('ul > li').each(($li, id) => {
+ let i = id == 0 ? '' : id;
+ cy.get('#enlicencesURL' + i).should('not.have.value', '');
+ cy.get('#frlicencesURL' + i).should('not.have.value', '');
+ cy.get('#licencesspdxID' + i).children().first().should('not.be.selected');
+ });
+ });
+});
+
+it('Should reset all fields when reset is activated on french page', () => {
+ cy.get('#date').type('2020-02-19');
+ cy.get('#contactemail').type('Test@test.ca');
+ cy.get('#contactname').type('Test');
+ cy.get('#submitterusername').type('Test');
+ cy.get('#submitteremail').type('Test@test.ca');
+ cy.get('#frteam').type('Test');
+ cy.get('#enteam').type('Test');
+ cy.get('#frdescriptionhowItWorks').type('Test');
+ cy.get('#endescriptionhowItWorks').type('Test');
+ cy.get('#designStatus').select('Design original');
+ cy.get('#addMoredesignType').find('.btn-tabs-more').click();
+ cy.get('#addMoredesignType').find('.btn-tabs-more').click();
+ cy.get('#addMorelicences').find('.btn-tabs-more').click();
+ cy.get('#addMorelicences').find('.btn-tabs-more').click();
+ cy.get('#adminCode').children().eq(1)
+ .children().eq(1).invoke('text').then((code) => {
+ cy.get('#adminCode').select(code);
+ cy.get('#formReset').click().then(() => {
+ cy.get('#adminCode').children().first().should('be.selected');
+ cy.get('#nameselect').children().first().should('be.selected');
+ cy.get('#enname').should('have.value', '');
+ cy.get('#frname').should('have.value', '');
+ cy.get('#endescriptionwhatItDoes').should('have.value', '');
+ cy.get('#frdescriptionwhatItDoes').should('have.value', '');
+ cy.get('#frdescriptionhowItWorks').should('have.value', '');
+ cy.get('#endescriptionhowItWorks').should('have.value', '');
+ cy.get('#enhomepageURL').should('have.value', '');
+ cy.get('#frhomepageURL').should('have.value', '');
+ cy.get('#addMoredesignType').find('ul > li').should('have.length.lte', 1);
+ cy.get('#designType').children().first().should('be.selected');
+ cy.get('#addMorelicences').find('ul > li').should('have.length.lte', 1);
+ cy.get('#enlicencesURL').should('have.value', '');
+ cy.get('#frlicencesURL').should('have.value', '');
+ cy.get('#licencesspdxID').children().first().should('be.selected');
+ cy.get('#designStatus').children().first().should('be.selected');
+ cy.get('#frteam').should('have.value', '');
+ cy.get('#enteam').should('have.value', '');
+ cy.get('#date').should('have.value', '');
+ cy.get('#contactemail').should('have.value', '');
+ cy.get('#contactname').should('have.value', '');
+ cy.get('#submitteremail').should('have.value', '');
+ cy.get('#submitterusername').should('have.value', '');
+ });
+ });
+});
+it ('Should submit on french page', () => {
+ cy.get('#nameselect').children().eq(1).invoke('text').then((name) => {
+ cy.get('#nameselect').select(name);
+ cy.get('#adminCode').children().eq(1)
+ .children().eq(1).invoke('text').then((code) => {
+ cy.get('#adminCode').select(code);
+ cy.get('#submitterusername').type('S');
+ cy.get('#submitteremail').type('S@test.ca');
+ cy.get('#contactemail').type('S@test.ca');
+ cy.get('#date').type('2020-02-19');
+ cy.window().then(win => {
+ win.submit_init.submitInit();
+ });
+ cy.get('#prbotSubmitAlertInProgress').should('be.visible');
+ });
+ });
+});
+
+it ('Should fail submit on french page', () => {
+ cy.visit('http://localhost:4000/ore-ero/fr/design-libre-formulaire.html');
+ //Wait needed because otherwise the click happens too fast and the validation doesn't really go through
+ cy.wait(1000)
+ cy.window().then(win => {
+ win.submit_init.submitInit();
+ });
+ cy.get('#errors-validation').should('exist');
+ cy.get('#errors-validation').find('ul > li').should('have.length', 15);
+});
+
+it ('Should fail submit with 1 error on french page', () => {
+ cy.visit('http://localhost:4000/ore-ero/fr/design-libre-formulaire.html');
+
+ cy.get('#nameselect').children().eq(1).invoke('text').then((name) => {
+ cy.get('#nameselect').select(name);
+ cy.get('#adminCode').children().eq(1)
+ .children().eq(1).invoke('text').then((code) => {
+ cy.get('#adminCode').select(code);
+ cy.get('#submitterusername').type('Test');
+ cy.get('#submitteremail').type('Test@test.ca');
+ cy.get('#contactemail').type('Test@test.ca');
+ cy.window().then(win => {
+ win.submit_init.submitInit();
+ });
+ cy.get('#errors-validation').find('ul > li').should('have.length', 1);
+ });
+ });
+});
+});
diff --git a/cypress/integration/unit-tests/open-design/design.spec.js b/cypress/integration/unit-tests/open-design/design.spec.js
new file mode 100644
index 000000000..39a326e15
--- /dev/null
+++ b/cypress/integration/unit-tests/open-design/design.spec.js
@@ -0,0 +1,136 @@
+///
+/* global cy, context, it */
+
+context('Open Design', () => {
+ it('Loads the English page', () => {
+ cy.visit('http://localhost:4000/ore-ero/en/open-design.html');
+ cy.get('#wb-cont').contains('Open Designs');
+ });
+
+ it('Dynamically filters on the English page', () => {
+ cy.visit('http://localhost:4000/ore-ero/en/open-design.html');
+ cy.get('#dataset-filter_filter')
+ .find('input')
+ .type('docker');
+
+ cy.get('#dataset-filter')
+ .find('tbody>tr')
+ .should('not.contain', 'docker');
+ });
+
+ it('Can filter for an existing element on the English page', () => {
+ cy.visit('http://localhost:4000/ore-ero/en/open-design.html');
+ cy.get('#dataset-filter')
+ .find('tbody')
+ .get('td')
+ .eq(0)
+ .invoke('text')
+ .then((expected) => {
+ cy.get('#dataset-filter_filter')
+ .find('input')
+ .type(expected);
+
+ cy.get('#dataset-filter')
+ .find('tbody>tr')
+ .should('contain', expected);
+ });
+ });
+
+
+ it('Loads the French page', () => {
+ cy.visit('http://localhost:4000/ore-ero/fr/design-libre.html');
+ cy.get('#wb-cont').contains('Designs Libres');
+ });
+
+ it('Dynamically filters on the French page', () => {
+ cy.visit('http://localhost:4000/ore-ero/fr/design-libre.html');
+ cy.get('#dataset-filter_filter')
+ .find('input')
+ .type('docker');
+
+ cy.get('#dataset-filter')
+ .find('tbody>tr')
+ .should('not.contain', 'docker');
+ });
+
+ it('Can filter for an existing element on the French page', () => {
+ cy.visit('http://localhost:4000/ore-ero/fr/design-libre.html');
+ cy.get('#dataset-filter')
+ .find('tbody')
+ .get('td')
+ .eq(0)
+ .invoke('text')
+ .then((expected) => {
+ cy.get('#dataset-filter_filter')
+ .find('input')
+ .type(expected);
+
+ cy.get('#dataset-filter')
+ .find('tbody>tr')
+ .should('contain', expected);
+ });
+ });
+
+
+});
+
+
+context('Common parts Open design', () => {
+ const selectTags = [
+ '#dt_govLevel',
+ '#dt_licence',
+ '#dt_type',
+ '#dt_status'
+ ];
+ // eslint-disable-next-line no-undef
+ beforeEach(() => {
+ cy.visit('http://localhost:4000/ore-ero/en/open-design.html');
+ });
+
+ it('should reset inputs', function() {
+ //select first element of the select
+ //should test if it's null
+ selectTags.forEach(selectTag => {
+ cy.get(`${selectTag} > option`)
+ .eq(1)
+ .then(element => {
+ cy.get(selectTag).select(element.val());
+ });
+ });
+
+ cy.get('.wb-tables-filter > .row > :nth-child(2) > .btn').click();
+
+ selectTags.forEach(selectTag => {
+ cy.get(`${selectTag} > option`)
+ .eq(0)
+ .should('be.selected');
+ });
+ });
+
+ it('should filter the first element with the right values', () => {
+ cy.get('.sorting_1')
+ .first()
+ .then(projectName => {
+ cy.get('tbody > :nth-child(1) > :nth-child(4)').then(type => {
+ cy.get(`#dt_type`).select(type.text().trim());
+ });
+ cy.get('tbody > :nth-child(1) > :nth-child(3)').then(licence => {
+ cy.get(`#dt_licence`).select(licence.text().trim());
+ });
+ cy.get('.wb-tables-filter > .row > :nth-child(1) > .btn').click();
+ cy.get(':nth-child(1) > .sorting_1').contains(projectName.text());
+ });
+ });
+
+ it('should open the correct modal', () => {
+ //25, 25 should hit the link no matter the size of the box
+ cy.get(':nth-child(1) > .sorting_1').click(25, 25);
+ cy.get(':nth-child(1) > .sorting_1').then(name => {
+ cy.get('.wb-overlay.open').contains(name.text());
+ });
+
+ // click on the close button
+ cy.get('.wb-overlay.open .btn').click();
+ cy.get('.wb-overlay').should('not.be.visible');
+ });
+ });
\ No newline at end of file
diff --git a/cypress/integration/unit-tests/open-design/designType.spec.js b/cypress/integration/unit-tests/open-design/designType.spec.js
new file mode 100644
index 000000000..109d5c88d
--- /dev/null
+++ b/cypress/integration/unit-tests/open-design/designType.spec.js
@@ -0,0 +1,61 @@
+///
+/* global cy, context, it, expect */
+
+context('Open Design Type', () => {
+
+it ('New type button should make new type field appear if hidden and both new type button and remove new type button should hide it if shown', () => {
+ cy.visit('http://localhost:4000/ore-ero/en/open-design-form.html');
+ cy.get('#newTypeButton').click();
+ cy.get('#newType').should('be.visible');
+ cy.get('#newTypeButton').click();
+ cy.get('#newType').should('be.hidden');
+ cy.get('#newTypeButton').click();
+ cy.get('#cancelnewTypeButton').click();
+ cy.get('#newType').should('be.hidden');
+ });
+
+it ('newType button and designType select should return the other to default state when clicked/changed', () => {
+ cy.visit('http://localhost:4000/ore-ero/en/open-design-form.html');
+ cy.get('#newTypeButton').click();
+ cy.get('#designType').select('Application');
+ cy.get('#newType').should('be.hidden');
+ cy.get('#newTypeButton').click();
+ cy.get('#designType').children().first().should('be.selected');
+ });
+
+ it ('New type button should make new type field appear if hidden and both new type button and remove new type button should hide it if shown on french page', () => {
+ cy.visit('http://localhost:4000/ore-ero/fr/design-libre-formulaire.html');
+ cy.get('#newTypeButton').click();
+ cy.get('#newType').should('be.visible');
+ cy.get('#newTypeButton').click();
+ cy.get('#newType').should('be.hidden');
+ cy.get('#newTypeButton').click();
+ cy.get('#cancelnewTypeButton').click();
+ cy.get('#newType').should('be.hidden');
+ });
+
+ it ('newType button and designType select should return the other to default state when clicked/changed on french page', () => {
+ cy.visit('http://localhost:4000/ore-ero/fr/design-libre-formulaire.html');
+ cy.get('#newTypeButton').click();
+ cy.get('#designType').select('Application');
+ cy.get('#newType').should('be.hidden');
+ cy.get('#newTypeButton').click();
+ cy.get('#designType').children().first().should('be.selected');
+ });
+
+ it ('addMoredesignType button should add an element to the list and show the removeMoredesignType button', () => {
+ cy.visit('http://localhost:4000/ore-ero/en/open-design-form.html');
+ cy.get('#addMoredesignType').find('.btn-tabs-more').click();
+ cy.get('#addMoredesignType').find('ul > li').should('have.length', 2);
+ cy.get('#addMoredesignType').find('.btn-tabs-more-remove').should('be.visible');
+ });
+ it ('removeMoredesignType button should remove an item from the list and disappear', () => {
+ cy.get('#addMoredesignType').find('.btn-tabs-more-remove').click();
+ cy.get('#addMoredesignType').find('ul > li').should('have.length', 1);
+ cy.get('#addMoredesignType').find('.btn-tabs-more-remove').should('be.hidden');
+ });
+
+
+
+
+});
\ No newline at end of file
diff --git a/cypress/support/index.js b/cypress/support/index.js
index 63268c1f3..98587212d 100644
--- a/cypress/support/index.js
+++ b/cypress/support/index.js
@@ -15,6 +15,5 @@
// Import commands.js using ES2015 syntax:
import './commands'
-
// Alternatively you can use CommonJS syntax:
// require('./commands')
\ No newline at end of file
diff --git a/package.json b/package.json
index 4968a9557..dd2b3c395 100644
--- a/package.json
+++ b/package.json
@@ -8,7 +8,8 @@
"open-licences": "licensee --errors-only",
"prettify": "eslint assets/js/src/** --fix",
"test": "npm run lint && npm run open-licences",
- "cypress:open": "cypress open"
+ "cypress:open": "cypress open",
+ "cypress": "cypress run"
},
"repository": {
"type": "git",