|
1 |
| -describe('Minimal test before testing details', () => { |
2 |
| - it('Click through wizard and submit the form', () => { |
| 1 | +describe('Minimal test, to check the setup before testing details', () => { |
| 2 | + it('Click through wizard + submit the form + decrypt formData', () => { |
3 | 3 | cy.visit('/?token=demoToken')
|
4 | 4 | cy.log('In case of a dev build it might take some time to jit compile…')
|
5 |
| - cy.log('The next test might fail, when the id is taken by another property with the same name') |
6 |
| - // TODO can we change the property name to something namespaced by the form? |
| 5 | + cy.log('The next test might fail, when the id is taken by another property with the same name. This sometimes happens with the combination of jsonforms and next dev builds.') |
| 6 | + /** TODO We need proper test selectors from jsonforms inputs. |
| 7 | + * - selectors should be stable in next dev builds |
| 8 | + * - selectors should be uniq when properties are reused at different places or we always need select the parent component (form) first |
| 9 | + **/ |
7 | 10 | cy.get('input[id="#/properties/firstName-input"]', {timeout: 30000})
|
8 | 11 | .type('Max')
|
9 | 12 |
|
10 | 13 | cy.log('Visit wizards last form step before submission')
|
11 | 14 | cy.visit('/?token=demoToken&step=3')
|
12 | 15 | cy.get('button[title="proceed to next step"]').click()
|
13 |
| - |
14 | 16 | cy.get('main').contains('Almost done')
|
15 |
| - // TODO we need proper selectors for the submit buttons |
| 17 | + |
| 18 | + cy.get('button[title="submit"]').first().click() |
| 19 | + cy.get('main').contains('Successfully submitted') |
| 20 | + |
| 21 | + cy.log('We expect, the test key is imported (gpg --import backend/data/keys/test.sec.gpg)') // TODO we should use a separate keyring |
| 22 | + cy.exec('(cd ../../backend/data/upload/demoToken/; gpg --decrypt --passphrase "test" "$(ls -t formData* | head -n1)")') |
| 23 | + .then($result => { |
| 24 | + const formData = JSON.parse($result.stdout) |
| 25 | + cy.log(formData) |
| 26 | + }) |
16 | 27 | })
|
17 | 28 | })
|
0 commit comments