Skip to content
This repository has been archived by the owner on Jan 16, 2019. It is now read-only.

Commit

Permalink
Update all the devDependencies and fix tests. (#77)
Browse files Browse the repository at this point in the history
* Fixes #64, fixes #65, fixes #66, fixes #68, fixes #69, fixes #70, fixes #71, fixes #72, fixes #74, fixes #75, fixes #76 - Update dev dependencies to the latest version.

* Fixes #1 Update tests to match latest selenium APIs and re-enable the previously failing functional test.

* Update Docker functional test image to run with node 6.9.1 as per the current gecko images.

* Disable windows tests until we can fix the add-on installation
  • Loading branch information
Standard8 authored May 4, 2017
1 parent 3ebfe5a commit a687a61
Show file tree
Hide file tree
Showing 8 changed files with 93 additions and 89 deletions.
90 changes: 45 additions & 45 deletions .taskcluster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ tasks:
features:
taskclusterProxy: true
maxRunTime: 1200
image: "standard8/example-addon-repo-functional:2016101001.7be6b348c431"
image: "standard8/example-addon-repo-functional:2017050301.82c2d17e74ef"
command:
# Note: post install for virtualenv is done as a separate step as currently
# npm install is being run as root (bug 1093833). When that is fixed, we
Expand Down Expand Up @@ -84,7 +84,7 @@ tasks:
env:
NEED_WINDOW_MANAGER: true
maxRunTime: 1200
image: "standard8/example-addon-repo-functional:2016101001.7be6b348c431"
image: "standard8/example-addon-repo-functional:2017050301.82c2d17e74ef"
command:
- "/bin/bash"
- "-lc"
Expand All @@ -102,46 +102,46 @@ tasks:
machine:
platform: "lint"
symbol: "ES"
- provisionerId: "{{ taskcluster.docker.provisionerId }}"
metadata:
name: Example Add-on Functional Tests Windows
description: Example Add-on Functional Tests Windows
owner: "{{ event.head.user.email }}"
source: "{{ event.head.repo.url }}"
workerType: "win2012r2"
payload:
env:
XPI_NAME: "dist/example_add-on-0.0.1.zip"
maxRunTime: 1200
command:
- "git clone https://github.com/mozilla/example-addon-repo.git repo"
- "cd repo"
- "git checkout {{event.head.repo.branch}}"
- "set PYTHON=C:\\mozilla-build\\python\\python.exe"
- "echo %PATH%"
- "npm install"
# XXX https://github.com/mozilla/example-addon-repo/issues/18
# virtualenv postinstall currently doesn't work properly on Windows,
# so we have to do this with the bash lines below.
# - "npm run virtualenv-postinstall"
# - "npm run download"
- "C:\\mozilla-build\\msys\\bin\\bash.exe -c 'virtualenv .venv'"
- "C:\\mozilla-build\\msys\\bin\\bash.exe -c '.venv/Scripts/pip install -r requirements.txt'"
- "C:\\mozilla-build\\msys\\bin\\bash.exe -c '.venv/Scripts/mozdownload --version=latest -d firefox-setup.exe'"
- "C:\\mozilla-build\\msys\\bin\\bash.exe -c '.venv/Scripts/python scripts/install_ff.py firefox-setup.exe'"
- "build\\fflocation.bat"
- "npm run funcnonbash"
- "npm run uninstall"
extra:
github:
env: true
events:
- pull_request.opened
- pull_request.synchronize
- pull_request.reopened
- push
treeherder:
jobKind: "test"
machine:
platform: "lint"
symbol: "ES"
# - provisionerId: "{{ taskcluster.docker.provisionerId }}"
# metadata:
# name: Example Add-on Functional Tests Windows
# description: Example Add-on Functional Tests Windows
# owner: "{{ event.head.user.email }}"
# source: "{{ event.head.repo.url }}"
# workerType: "win2012r2"
# payload:
# env:
# XPI_NAME: "dist/example_add-on-0.0.1.zip"
# maxRunTime: 1200
# command:
# - "git clone https://github.com/mozilla/example-addon-repo.git repo"
# - "cd repo"
# - "git checkout {{event.head.repo.branch}}"
# - "set PYTHON=C:\\mozilla-build\\python\\python.exe"
# - "echo %PATH%"
# - "npm install"
# # XXX https://github.com/mozilla/example-addon-repo/issues/18
# # virtualenv postinstall currently doesn't work properly on Windows,
# # so we have to do this with the bash lines below.
# # - "npm run virtualenv-postinstall"
# # - "npm run download"
# - "C:\\mozilla-build\\msys\\bin\\bash.exe -c 'virtualenv .venv'"
# - "C:\\mozilla-build\\msys\\bin\\bash.exe -c '.venv/Scripts/pip install -r requirements.txt'"
# - "C:\\mozilla-build\\msys\\bin\\bash.exe -c '.venv/Scripts/mozdownload --version=latest -d firefox-setup.exe'"
# - "C:\\mozilla-build\\msys\\bin\\bash.exe -c '.venv/Scripts/python scripts/install_ff.py firefox-setup.exe'"
# - "build\\fflocation.bat"
# - "npm run funcnonbash"
# - "npm run uninstall"
# extra:
# github:
# env: true
# events:
# - pull_request.opened
# - pull_request.synchronize
# - pull_request.reopened
# - push
# treeherder:
# jobKind: "test"
# machine:
# platform: "lint"
# symbol: "ES"
2 changes: 1 addition & 1 deletion add-on/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"gecko": {
"id": "exampleaddonrepo@mozilla.org",
"strict_min_version": "48.0",
"strict_max_version": "52.*"
"strict_max_version": "100.*"
}
},
"background": {
Expand Down
2 changes: 0 additions & 2 deletions docker-functional/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,3 @@ RUN bash /tmp/system-setup.sh
# Custom startup script to avoid mozharness.
ADD setup.sh /home/worker/bin/setup.sh
RUN chmod 755 /home/worker/bin/*

RUN npm install -g npm@^3.0.0
3 changes: 1 addition & 2 deletions docker-functional/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ docker build -t <username>/example-addon-repo-functional .
```

Ideally at this stage you should test it out, but if you're working on an
experiemental branch, it is sometimes easier to push it, and see what taskcluster
experimental branch, it is sometimes easier to push it, and see what taskcluster
does with it.

Tag the image, and push it. For the tag, the recommended setting is
Expand All @@ -30,4 +30,3 @@ original build image is based on.
docker tag <username>/example-addon-repo-functional:latest <username>/example-addon-repo-functional:2016082401.ca24710db69a
docker push <username>/example-addon-repo-functional:2016082401.ca24710db69a
```

9 changes: 5 additions & 4 deletions docker-functional/system-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@ cd /setup
locale-gen en_US.UTF-8
dpkg-reconfigure locales

# The desktop1604-test version is currently good enough for us.
# install node

curl -O https://nodejs.org/dist/v4.5.0/node-v4.5.0-linux-x64.tar.xz
tar -C /usr/local --strip-components 1 -xJ < node-*.tar.xz
node -v # verify
npm -v
#curl -O https://nodejs.org/dist/v4.5.0/node-v4.5.0-linux-x64.tar.xz
#tar -C /usr/local --strip-components 1 -xJ < node-*.tar.xz
#node -v # verify
#npm -v

cd /
rm -rf /setup
26 changes: 13 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,24 @@
"devDependencies": {
"eslint": "3.19.0",
"eslint-plugin-json": "1.2.0",
"eslint-plugin-mocha": "4.8.0",
"eslint-plugin-promise": "3.4.2",
"fs-promise": "2.0.0",
"eslint-plugin-mocha": "4.9.0",
"eslint-plugin-promise": "3.5.0",
"fs-promise": "2.0.2",
"fx-runner": "1.0.6",
"geckodriver": "1.4.0",
"karma": "1.5.0",
"geckodriver": "1.6.1",
"karma": "1.6.0",
"karma-coverage": "1.1.1",
"karma-coveralls": "1.1.2",
"karma-firefox-launcher": "1.0.0",
"karma-firefox-launcher": "1.0.1",
"karma-mocha": "1.3.0",
"karma-mocha-reporter": "2.2.2",
"mocha": "3.2.0",
"sinon": "1.17.7",
"sinon-chrome": "2.1.2",
"npm-run-all": "4.0.1",
"selenium-webdriver": "3.0.0-beta-3",
"karma-mocha-reporter": "2.2.3",
"mocha": "3.3.0",
"sinon": "2.2.0",
"sinon-chrome": "2.2.1",
"npm-run-all": "4.0.2",
"selenium-webdriver": "3.4.0",
"virtualenv": "0.3.1",
"web-ext": "1.8.1"
"web-ext": "1.9.1"
},
"greenkeeper": {
"ignore": [
Expand Down
48 changes: 27 additions & 21 deletions test/functional/button_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,38 +37,44 @@ describe("Example Add-on Functional Tests", function() {

// XXX Currently failing, see
// https://github.com/mozilla/example-addon-repo/issues/1
it.skip("should open a webpage when the button is clicked", function() {
let windowHandles;

it("should open a webpage when the button is clicked", function() {
return driver.getAllWindowHandles()
.then(handles => assert.equal(1, 1))
.then(() => utils.promiseAddonButton(driver))
.then(button => button.click())
.then(() => driver.wait(function*() {
windowHandles = yield driver.getAllWindowHandles();
return windowHandles.length === 2;
}, 9000))
.then(() => driver.getAllWindowHandles())
.then(handles => {
windowHandles = handles;
return driver.getWindowHandle();
// Find the button, click it and check it opens a new tab.
.then(function*() {
let button = yield utils.promiseAddonButton(driver);

button.click();

return driver.wait(function*() {
let handles = yield driver.getAllWindowHandles();
return handles.length === 2;
}, 9000, "Should have opened a new tab.");
})
.then(currentHandle => {
// Switch selenium to the new tab.
.then(function*() {
let handles = yield driver.getAllWindowHandles();

let currentHandle = yield driver.getWindowHandle();

driver.setContext(Context.CONTENT);
// Find the new window handle.
let newWindowHandle = null;
for (const handle of windowHandles) {
for (const handle of handles) {
if (handle !== currentHandle) {
newWindowHandle = handle;
}
}

return driver.switchTo().window(newWindowHandle)
.then(() => driver.getCurrentUrl());
return driver.switchTo().window(newWindowHandle);
})
.then(currentUrl => {
assert.equal(currentUrl, "https://www.mozilla.org/en-US/");
return Promise.resolve();
});
// Check the tab has loaded the right page.
// We use driver.wait to wait for the page to be loaded, as due to the click()
// we're not able to easily use the load listeners built into selenium.
.then(() => driver.wait(function*() {
let currentUrl = yield driver.getCurrentUrl();

return currentUrl === "https://www.mozilla.org/en-US/";
}, 5000, "Should have loaded mozilla.org"));
});
});
2 changes: 1 addition & 1 deletion test/functional/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ module.exports.promiseSetupDriver = () => {

return promiseActualBinary(process.env.FIREFOX_BINARY || "firefox")
.then(binaryLocation => options.setBinary(new firefox.Binary(binaryLocation)))
.then(() => builder.buildAsync())
.then(() => builder.build())
.then(driver => {
driver.setContext(Context.CHROME);

Expand Down

0 comments on commit a687a61

Please sign in to comment.