From e5f2b386bb07ad306985a3909c02b88d9ea035b6 Mon Sep 17 00:00:00 2001 From: Abhinav Adduri Date: Mon, 17 Jul 2017 09:39:51 -0700 Subject: [PATCH] testing circle install firefox --- circle.yml | 5 +++++ package-lock.json | 27 ++++++++++++++++++++------- package.json | 5 +++-- test/frontend/driver.js | 22 ++++++++++++++++++++++ test/frontend/frontend.test.html | 7 ++++++- 5 files changed, 56 insertions(+), 10 deletions(-) create mode 100644 test/frontend/driver.js diff --git a/circle.yml b/circle.yml index f4495a1e..f244d517 100644 --- a/circle.yml +++ b/circle.yml @@ -5,6 +5,11 @@ machine: - docker - redis +dependencies: + pre: + - npm i -g get-firefox + - get-firefox --platform linux --extract --target /home/ubuntu/send + deployment: latest: branch: master diff --git a/package-lock.json b/package-lock.json index fbf213c7..a0b34cd0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -28,6 +28,11 @@ } } }, + "adm-zip": { + "version": "0.4.7", + "resolved": "https://registry.npmjs.org/adm-zip/-/adm-zip-0.4.7.tgz", + "integrity": "sha1-hgbCy/HEJs6MjsABdER/1Jtur8E=" + }, "ajv": { "version": "4.11.8", "resolved": "https://registry.npmjs.org/ajv/-/ajv-4.11.8.tgz", @@ -1376,8 +1381,7 @@ "fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", - "dev": true + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" }, "fsevents": { "version": "1.1.2", @@ -3189,8 +3193,7 @@ "os-tmpdir": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", - "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", - "dev": true + "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=" }, "outpipe": { "version": "1.1.1", @@ -3777,13 +3780,11 @@ "version": "2.6.1", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.1.tgz", "integrity": "sha1-wjOOxkPfeht/5cVPqG9XQopV8z0=", - "dev": true, "dependencies": { "glob": { "version": "7.1.2", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", - "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", - "dev": true + "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==" } } }, @@ -3833,6 +3834,18 @@ "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.1.tgz", "integrity": "sha1-e45lYZCyKOgaZq6nSEgNgozS03o=" }, + "selenium-webdriver": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/selenium-webdriver/-/selenium-webdriver-3.4.0.tgz", + "integrity": "sha1-FR90RSlNpqZsScwwB0eioX5TxSo=", + "dependencies": { + "tmp": { + "version": "0.0.30", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.30.tgz", + "integrity": "sha1-ckGdSovn1s51FI/YsyTlk6cRwu0=" + } + } + }, "semver": { "version": "5.3.0", "resolved": "https://registry.npmjs.org/semver/-/semver-5.3.0.tgz", diff --git a/package.json b/package.json index a38a02f2..856dd066 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,7 @@ "raven": "^2.1.0", "raven-js": "^3.16.0", "redis": "^2.7.1", + "selenium-webdriver": "^3.4.0", "supertest": "^3.0.0", "uglify-es": "3.0.19" }, @@ -51,8 +52,8 @@ "lint:css": "stylelint 'public/*.css'", "lint:js": "eslint .", "start": "node server/server", - "test": "mocha test/unit && mocha test/server", - "test-browser": "watchify test/frontend/frontend.bundle.js -o test/frontend/bundle.js -d", + "test": "mocha test/unit && mocha test/server && npm run test-browser && node test/frontend/driver.js", + "test-browser": "browserify test/frontend/frontend.bundle.js -o test/frontend/bundle.js -d", "version": "node scripts/version" } } diff --git a/test/frontend/driver.js b/test/frontend/driver.js new file mode 100644 index 00000000..c85d65f8 --- /dev/null +++ b/test/frontend/driver.js @@ -0,0 +1,22 @@ +var webdriver = require('selenium-webdriver'), + By = webdriver.By, + until = webdriver.until; + +var driver = new webdriver.Builder() + .forBrowser('firefox') + .build(); + +driver.get('file:///' + __dirname + '/frontend.test.html'); +driver.wait(until.titleIs('Mocha Tests'), 1000); +driver.wait(until.titleMatches(/^[0-1]$/), 10000); + +driver.getTitle().then(title => { + driver.quit().then(() => { + if (title === "0") { + process.exit(0); + } else { + throw new Error(`Frontend tests are failing. ` + + `Please open the frontend.test.html file in a browser.`); + } + }) +}) \ No newline at end of file diff --git a/test/frontend/frontend.test.html b/test/frontend/frontend.test.html index 96131143..46a88cea 100644 --- a/test/frontend/frontend.test.html +++ b/test/frontend/frontend.test.html @@ -16,7 +16,12 @@ + + \ No newline at end of file