diff --git a/Makefile b/Makefile index c9a0000..6eb27c6 100644 --- a/Makefile +++ b/Makefile @@ -53,6 +53,9 @@ test-e2e: # Run Django server and detach it. Then store its process id in a temporary file. { nohup ./manage.py runserver & echo $$! > e2e_server_pid.txt; } + # Check server is up + curl -I http://0.0.0.0:8000 && echo "local server running" && cat e2e_server_pid.txt + # Run end-to-end tests cd frontend && node tests-e2e/local.runner.js -c tests-e2e/browserstack.conf.js -e chrome @@ -60,4 +63,4 @@ test-e2e: kill -9 `cat e2e_server_pid.txt` ; echo avoid finishing with an error exit code rm e2e_server_pid.txt ; echo avoid finishing with an error exit code -test-all: test-unit-ci test-e2e \ No newline at end of file +test-all: test-unit-ci test-e2e diff --git a/frontend/tests-e2e/local.runner.js b/frontend/tests-e2e/local.runner.js index a05a3d4..3f7cd6f 100644 --- a/frontend/tests-e2e/local.runner.js +++ b/frontend/tests-e2e/local.runner.js @@ -1,7 +1,6 @@ #!/usr/bin/env node const browserStackCredentials = require("./browserstack.credentials.js"); -const path = require('path'); var Nightwatch = require('nightwatch'); var browserstack = require('browserstack-local'); @@ -33,4 +32,4 @@ try { console.log('There was an error while starting the test runner:\n\n'); process.stderr.write(ex.stack + '\n'); process.exit(2); -} \ No newline at end of file +} diff --git a/frontend/tests-e2e/tests/company-details-page-test.js b/frontend/tests-e2e/tests/company-details-page-test.js index 6e8ecd1..311721b 100644 --- a/frontend/tests-e2e/tests/company-details-page-test.js +++ b/frontend/tests-e2e/tests/company-details-page-test.js @@ -5,7 +5,7 @@ module.exports = { client // Get search results - .url('localhost:8000/entreprises/maconnerie/nantes-44000/maçon?distance=60') + .url('http://localhost:8000/entreprises/maconnerie/metz-57000/ma%C3%A7on?distance=60') // Wait for a first result to be visible .waitForElementPresent('#results .company-list-item:first-child', 40000) @@ -41,4 +41,4 @@ module.exports = { done(); }) } -}; \ No newline at end of file +}; diff --git a/frontend/tests-e2e/tests/home-tests.js b/frontend/tests-e2e/tests/home-tests.js index 1dd6eef..433d55a 100644 --- a/frontend/tests-e2e/tests/home-tests.js +++ b/frontend/tests-e2e/tests/home-tests.js @@ -1,9 +1,9 @@ module.exports = { 'Home page test': function (client) { client - .url('localhost:8000') + .url('http://localhost:8000') .waitForElementPresent('body', 5000) .assert.containsText('h1.introduction', 'Trouvez ici les entreprises') .end(); } -}; \ No newline at end of file +}; diff --git a/frontend/tests-e2e/tests/navigation-test.js b/frontend/tests-e2e/tests/navigation-test.js index b8a4724..154f901 100644 --- a/frontend/tests-e2e/tests/navigation-test.js +++ b/frontend/tests-e2e/tests/navigation-test.js @@ -1,7 +1,7 @@ module.exports = { 'Navigation test': function (client) { client - .url('localhost:8000') + .url('http://localhost:8000') .waitForElementPresent('body', 10000) .assert.containsText('h1.introduction', 'Trouvez ici les entreprises') .click('.rgpd-banner ul li button:first-child') @@ -25,4 +25,4 @@ module.exports = { .end(); } -}; \ No newline at end of file +}; diff --git a/frontend/tests-e2e/tests/search-macon-test.js b/frontend/tests-e2e/tests/search-macon-test.js index d82b865..4ece5b3 100644 --- a/frontend/tests-e2e/tests/search-macon-test.js +++ b/frontend/tests-e2e/tests/search-macon-test.js @@ -1,7 +1,7 @@ module.exports = { - 'Search "maçon" in "Nantes"': function (client) { + 'Search "maçon" in "Metz"': function (client) { client - .url('localhost:8000') + .url('http://localhost:8000') .waitForElementPresent('body', 10000) .assert.containsText('h1.introduction', 'Trouvez ici les entreprises') .click('.rgpd-banner ul li button:first-child') @@ -26,9 +26,9 @@ module.exports = { .waitForElementVisible('#location-input') // City select step - .setValue("#location-form-step #location-input", 'Nantes') + .setValue("#location-form-step #location-input", 'Metz') .waitForElementVisible('#location-form-step ul.suggestions') - .click('#location-form-step ul.suggestions button[data-zipcode="44000"]') + .click('#location-form-step ul.suggestions button[data-zipcode="57000"]') .click('.form-step-container .submit-container button') .waitForElementVisible('#results') @@ -36,4 +36,4 @@ module.exports = { .assert.containsText('#list-results h1', 'entreprises qui recrutent le plus en Alternance dans le métier/domaine "maçon"') .end(); } -}; \ No newline at end of file +};