-
-
Notifications
You must be signed in to change notification settings - Fork 236
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP: fixup! Protect staff name & phone fields in FMS front-end.
- Loading branch information
1 parent
34aace9
commit c8fe2e5
Showing
3 changed files
with
21 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,35 +45,36 @@ describe('Staff user tests', function() { | |
}); | ||
|
||
it('does not let staff update their name, phone or email address whilst reporting or updating', function() { | ||
// Lest CS staff forget to select 'report as another user' and type the reporter's details into their own account. | ||
// Lest CS staff forget to select 'report as another user' and type the reporter's details over their own. | ||
cy.server(); | ||
|
||
Cypress.on('uncaught:exception', function(err, runnable) { | ||
// handle IOW assets error | ||
return false; | ||
// log in and create report | ||
cy.route('/report/new/ajax*').as('report-ajax'); | ||
cy.request({ | ||
method: 'POST', | ||
url: '/auth?r=/', | ||
form: true, | ||
body: { username: '[email protected]', password_sign_in: 'password' } | ||
}); | ||
cy.visit('/'); | ||
cy.contains('Go'); | ||
cy.get('[name=pc]').type(Cypress.env('postcode')); | ||
cy.get('[name=pc]').parents('form').submit(); | ||
cy.url().should('include', '/around'); | ||
cy.get('#map_box').click(240, 249); | ||
cy.wait('@report-ajax'); | ||
|
||
// log in | ||
cy.visit('/auth'); | ||
cy.get('[name=username]').type('[email protected]'); | ||
cy.contains('Sign in with a password').click(); | ||
cy.get('[name=password_sign_in]').type('password'); | ||
cy.get('[name=sign_in_by_password]').last().click(); | ||
|
||
// Visit Borsetshire | ||
cy.visit('/report/new?latitude=51.496194&longitude=-2.603439,'); | ||
// pick category: with check to avoid race condition | ||
// but doesn't always work, so have added {force:true} as well | ||
cy.get('input[value="Flytipping"]').should('be.visible').click({force:true}); | ||
cy.nextPageReporting(); | ||
|
||
// photos & description pages | ||
cy.nextPageReporting(); | ||
cy.get('#form_title').type('Fly-tipped sofa'); | ||
cy.get('#form_detail').type('Looks like a Chesterfield.'); | ||
cy.nextPageReporting(); | ||
|
||
// about you page | ||
cy.get('#form_as').select('myself'); | ||
cy.get('[name=username]').should('be.disabled'); // (already protected) | ||
cy.get('[name=phone]').should('be.disabled'); | ||
cy.get('[name=name]').should('have.attr', 'readonly'); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters