aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2018-09-26 16:24:55 +0100
committerMatthew Somerville <matthew-github@dracos.co.uk>2018-10-03 12:20:44 +0100
commit4b5324221f126943f97d18a115faf9f3ed887d50 (patch)
tree88a7e6fca36ff1de60294474dc415bd91c9c9b52
parentd2939e236f7bb04ec7dd3902e69134e1b538a6fb (diff)
use postcode from ENV in front end tests
rather than hardcoding a postcode pull it from ENV to make testing a bit more flexible for use in cobrand testing
-rw-r--r--.cypress/cypress.json5
-rw-r--r--.cypress/cypress/integration/regressions.js6
-rw-r--r--.cypress/cypress/integration/responsive.js6
-rw-r--r--.cypress/cypress/integration/simple_spec.js4
4 files changed, 12 insertions, 9 deletions
diff --git a/.cypress/cypress.json b/.cypress/cypress.json
index dd3beceef..554495d4b 100644
--- a/.cypress/cypress.json
+++ b/.cypress/cypress.json
@@ -1,4 +1,7 @@
{
"baseUrl": "http://localhost:3001",
- "projectId": "y8vvs1"
+ "projectId": "y8vvs1",
+ "env": {
+ "postcode": "BS10 5EE"
+ }
}
diff --git a/.cypress/cypress/integration/regressions.js b/.cypress/cypress/integration/regressions.js
index c54bc8e9f..00e92f5ad 100644
--- a/.cypress/cypress/integration/regressions.js
+++ b/.cypress/cypress/integration/regressions.js
@@ -8,19 +8,19 @@ Cypress.Commands.add('cleanUpXHR', function() {
describe('Regression tests', function() {
it('Shows the sub-map links after clicking Try again', function() {
cy.viewport(480, 800);
- cy.visit('/around?pc=BS10+5EE&js=1');
+ cy.visit('/around?pc=' + Cypress.env('postcode') + '&js=1');
cy.get('#map_box').click(200, 200);
cy.get('#try_again').click();
cy.get('#sub_map_links').should('be.visible');
cy.cleanUpXHR();
});
it('Does not fade on new pin hover', function() {
- cy.visit('/around?pc=BS10+5EE&js=1');
+ cy.visit('/around?pc=' + Cypress.env('postcode') + '&js=1');
cy.get('#map_box').click(200, 200);
cy.get('#map_box image').last().trigger('mousemove').should('have.css', 'opacity', '1');
});
it('Does not hide the new report pin even if you click really quick', function() {
- cy.visit('/around?pc=BS10+5EE&js=1');
+ cy.visit('/around?pc=' + Cypress.env('postcode') + '&js=1');
cy.get('#map_box').click(200, 200);
cy.get('#loading-indicator').should('be.hidden');
cy.get('#map_box image').should('be.visible');
diff --git a/.cypress/cypress/integration/responsive.js b/.cypress/cypress/integration/responsive.js
index 6d1601cea..1a5540590 100644
--- a/.cypress/cypress/integration/responsive.js
+++ b/.cypress/cypress/integration/responsive.js
@@ -28,7 +28,7 @@ describe('Front page responsive design tests', function() {
describe('Around page responsive design tests', function() {
it('Shows correct things on mobile', function() {
cy.viewport(480, 800);
- cy.visit('/around?pc=BS10+5EE&js=1');
+ cy.visit('/around?pc=' + Cypress.env('postcode') + '&js=1');
cy.get('.mobile-map-banner').should('be.visible');
cy.get('#sub_map_links').should('be.visible');
cy.get('#map_links_toggle').should('not.be.visible');
@@ -41,7 +41,7 @@ describe('Around page responsive design tests', function() {
it('Shows correct things on tablet', function() {
cy.viewport(800, 800);
- cy.visit('/around?pc=BS10+5EE&js=1');
+ cy.visit('/around?pc=' + Cypress.env('postcode') + '&js=1');
cy.get('.mobile-map-banner').should('not.be.visible');
cy.get('#map_sidebar').should('be.visible');
cy.get('#side-form').should('not.be.visible');
@@ -55,7 +55,7 @@ describe('Around page responsive design tests', function() {
it('Shows correct things on desktop', function() {
cy.viewport(1024, 800);
- cy.visit('/around?pc=BS10+5EE&js=1');
+ cy.visit('/around?pc=' + Cypress.env('postcode') + '&js=1');
cy.get('.mobile-map-banner').should('not.be.visible');
cy.get('#map_sidebar').should('be.visible');
cy.get('#sub_map_links').should('be.visible');
diff --git a/.cypress/cypress/integration/simple_spec.js b/.cypress/cypress/integration/simple_spec.js
index 30f2a0218..003662d59 100644
--- a/.cypress/cypress/integration/simple_spec.js
+++ b/.cypress/cypress/integration/simple_spec.js
@@ -2,7 +2,7 @@ describe('Clicking the map', function() {
before(function(){
cy.visit('/');
cy.contains('Go');
- cy.get('[name=pc]').type('BS10 5EE');
+ cy.get('[name=pc]').type(Cypress.env('postcode'));
cy.get('[name=pc]').parents('form').submit();
});
@@ -23,7 +23,7 @@ describe('Clicking the map', function() {
describe('Clicking the "big green banner" on a map page', function() {
before(function() {
cy.visit('/');
- cy.get('[name=pc]').type('BS10 5EE');
+ cy.get('[name=pc]').type(Cypress.env('postcode'));
cy.get('[name=pc]').parents('form').submit();
cy.get('.big-green-banner').click();
});