Skip to content
This repository has been archived by the owner on May 25, 2021. It is now read-only.

Commit

Permalink
fix e2e browserstack tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lexoyo committed Jun 30, 2020
1 parent 754fc7a commit 2bdd381
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 14 deletions.
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,14 @@ 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

# Kill Django server using its process id.
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
test-all: test-unit-ci test-e2e
3 changes: 1 addition & 2 deletions frontend/tests-e2e/local.runner.js
Original file line number Diff line number Diff line change
@@ -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');
Expand Down Expand Up @@ -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);
}
}
4 changes: 2 additions & 2 deletions frontend/tests-e2e/tests/company-details-page-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -41,4 +41,4 @@ module.exports = {
done();
})
}
};
};
4 changes: 2 additions & 2 deletions frontend/tests-e2e/tests/home-tests.js
Original file line number Diff line number Diff line change
@@ -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();
}
};
};
4 changes: 2 additions & 2 deletions frontend/tests-e2e/tests/navigation-test.js
Original file line number Diff line number Diff line change
@@ -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')
Expand All @@ -25,4 +25,4 @@ module.exports = {

.end();
}
};
};
10 changes: 5 additions & 5 deletions frontend/tests-e2e/tests/search-macon-test.js
Original file line number Diff line number Diff line change
@@ -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')
Expand All @@ -26,14 +26,14 @@ 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')

// Check text
.assert.containsText('#list-results h1', 'entreprises qui recrutent le plus en Alternance dans le métier/domaine "maçon"')
.end();
}
};
};

0 comments on commit 2bdd381

Please sign in to comment.