Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Cypress tests for open design #1172

Open
wants to merge 33 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
583a19f
Doing tests on open-design
simon332114 Feb 18, 2020
c7ee3b4
Still working on it
simon332114 Feb 18, 2020
4b383fa
Fix input test
simon332114 Feb 18, 2020
f460959
Merge branch 'master' into open-design-tests
simon332114 Feb 18, 2020
7db85ce
Lightboxes test never
simon332114 Feb 18, 2020
ee10c04
Continuing tests
simon332114 Feb 18, 2020
778debb
Fix designSelect for french page + more tests
simon332114 Feb 19, 2020
7ed391a
Design select tested
simon332114 Feb 19, 2020
0cc203b
Started reset test and finished fill test
simon332114 Feb 19, 2020
f92147c
Reset test done
simon332114 Feb 19, 2020
7c47db5
Test for designSelect change
simon332114 Feb 19, 2020
297a2d5
Cleanup
simon332114 Feb 19, 2020
f6a7464
Working on design table test
simon332114 Feb 19, 2020
3c15a4f
Modal lightbox test works
simon332114 Feb 19, 2020
c1372fb
Moved tests to more right spec file
simon332114 Feb 19, 2020
cc62e64
Added licences.spec.js and more design tests
simon332114 Feb 20, 2020
1fdd3de
more design form tests and clarified context fields
simon332114 Feb 20, 2020
27fa979
Reorganised design form tests and started submission tests
simon332114 Feb 20, 2020
83a0e68
Fixed submit test
simon332114 Feb 20, 2020
cc7cd05
Fixed test
simon332114 Feb 20, 2020
64da726
Submit test finally works
simon332114 Feb 21, 2020
7e9b843
The submit test is still sending things when it shouldn't
simon332114 Feb 21, 2020
270fd97
Disabling it for now
simon332114 Feb 21, 2020
fded708
Fixed submit test
simon332114 Mar 12, 2020
dc463bb
Merge branch 'master' into open-design-tests
simon332114 Mar 24, 2020
cb21699
Added URL constant
simon332114 Mar 25, 2020
a366e23
Changed form test contexts
simon332114 Apr 27, 2020
7bb85bf
Fixed submission test by calling the submitInit method directly
simon332114 Apr 30, 2020
0f00d78
Removed form submission entirely since the test concerns validation
simon332114 Apr 30, 2020
42a1128
Merge https://github.com/canada-ca/ore-ero into open-design-tests
simon332114 Apr 30, 2020
d7f2667
Before lint is runs on it and crashes it
simon332114 Apr 30, 2020
6f9a51f
Merge branch 'master' into open-design-tests
simon332114 May 6, 2020
f02d0f3
Added to the CI build
simon332114 May 11, 2020
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
Prev Previous commit
Next Next commit
Fixed submission test by calling the submitInit method directly
simon332114 committed Apr 30, 2020
commit 7bb85bf501d47fd9ade5184428376b6868ea66e3
4 changes: 4 additions & 0 deletions assets/js/src/validation.js
Original file line number Diff line number Diff line change
@@ -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
};
28 changes: 12 additions & 16 deletions cypress/integration/unit-tests/open-design/design-form.spec.js
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@ context('Open Design on the English Form Page', () => {
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) => {
@@ -32,9 +32,9 @@ context('Open Design on the English Form Page', () => {
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('#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', () => {
@@ -47,7 +47,7 @@ context('Open Design on the English Form Page', () => {
cy.get('#newAdmin').should('be.hidden');
});




it('Values should be autofilled when design name is selected', () => {
@@ -128,13 +128,11 @@ it ('Should submit', () => {
cy.get('#submitteremail').type('E@test.ca');
cy.get('#contactemail').type('E@test.ca');
cy.get('#date').type('2020-02-19');
cy.get('#prbotSubmitdesignForm').click().then(() => {
cy.get('#prbotSubmitAlertInProgress').should('be.visible');
cy.get('#validation').submit();
cy.wait(2000);
cy.get('form').submit();
cy.window().then(win => {
win.submit_init.submitInit();
});
cy.get('#prbotSubmitAlertInProgress').should('be.visible');
});
});
});
});

@@ -194,7 +192,7 @@ it ('Should reset all fields filled by design select if the selected option is m
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('#licencesspdxID').children().first().should('be.selected');
});
});
it('Values should be autofilled when design name is selected on french page', () => {
@@ -275,12 +273,10 @@ it ('Should submit on french page', () => {
cy.get('#submitteremail').type('S@test.ca');
cy.get('#contactemail').type('S@test.ca');
cy.get('#date').type('2020-02-19');
cy.get('#prbotSubmitdesignForm').click().then(() => {
cy.get('#prbotSubmitAlertInProgress').should('be.visible');
cy.get('#validation').submit();
cy.wait(2000);
cy.get('form').submit();
cy.window().then(win => {
win.submit_init.submitInit();
});
cy.get('#prbotSubmitAlertInProgress').should('be.visible');
});
});
});
2 changes: 1 addition & 1 deletion cypress/support/index.js
Original file line number Diff line number Diff line change
@@ -15,6 +15,6 @@

// Import commands.js using ES2015 syntax:
import './commands'

import submitInit from "../assets/js/src/validation.js"
// Alternatively you can use CommonJS syntax:
// require('./commands')