diff options
author | Struan Donald <struan@exo.org.uk> | 2018-10-03 15:36:06 +0100 |
---|---|---|
committer | Struan Donald <struan@exo.org.uk> | 2018-10-09 11:16:40 +0100 |
commit | b43277add3b4e04bf09e6f9cf640ef1d1d1d9b66 (patch) | |
tree | 23ef6b50de02abf2246c537960fc2cd50e2c0e71 /.cypress | |
parent | 675ec6e6d741be456b287479ea517cc46c4270be (diff) |
front end category tests
Check selecting a category and selecting a sub category
Diffstat (limited to '.cypress')
-rw-r--r-- | .cypress/cypress/integration/category_tests.js | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/.cypress/cypress/integration/category_tests.js b/.cypress/cypress/integration/category_tests.js new file mode 100644 index 000000000..5135ef842 --- /dev/null +++ b/.cypress/cypress/integration/category_tests.js @@ -0,0 +1,41 @@ +describe('Basic categories', function() { + before(function(){ + cy.visit('/'); + cy.contains('Go'); + cy.get('[name=pc]').type(Cypress.env('postcode')); + cy.get('[name=pc]').parents('form').submit(); + }); + + it('category dropdown contains the expected values', function() { + cy.server(); + cy.route('/report/new/ajax*').as('report-ajax'); + cy.url().should('include', '/around'); + cy.get('#map_box').click(210, 200); + cy.wait('@report-ajax'); + cy.get('[name=category]').should('not.be.visible'); + var categories = ['-- Pick a category --', 'Graffiti', 'Potholes', 'Street lighting', 'Other', 'Bins' ]; + cy.get('select:eq(3) option').each(function (obj, i) { + expect(obj[0].value).to.equal(categories[i]); + }); + cy.get('#subcategory_Bins').should('not.be.visible'); + cy.get('select:eq(3)').select('Bins'); + cy.get('#subcategory_Bins').should('be.visible'); + cy.get('select:eq(3)').select('Graffiti'); + cy.get('#subcategory_Bins').should('not.be.visible'); + }); + + it('category dropdown contains works from new page', function() { + cy.server(); + cy.route('/report/new/ajax*').as('report-ajax'); + cy.visit('/report/new?latitude=51.496194&longitude=-2.603482'); + cy.get('[name=category]').should('not.be.visible'); + var categories = ['-- Pick a category --', 'Graffiti', 'Potholes', 'Street lighting', 'Other', 'Bins' ]; + cy.get('select:eq(1) option').each(function (obj, i) { + expect(obj[0].value).to.equal(categories[i]); + }); + cy.get('#subcategory_Bins').should('not.be.visible'); + cy.get('select:eq(1)').select('Bins'); + cy.wait('@report-ajax'); + cy.get('#subcategory_Bins').should('be.visible'); + }); +}); |