Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: electron-userland/spectron
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 74f87c1d93482072d94c9cb0947d989f1860ebc8
Choose a base ref
...
head repository: electron-userland/spectron
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 0e91e2b31034e45ac27942b19a79ce16411c9ccd
Choose a head ref

Commits on Jul 11, 2019

  1. Bump electron from 5.0.1 to 5.0.6 (#381)

    Bumps [electron](https://github.com/electron/electron) from 5.0.1 to 5.0.6.
    - [Release notes](https://github.com/electron/electron/releases)
    - [Commits](electron/electron@v5.0.1...v5.0.6)
    
    Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
    dependabot-preview[bot] authored and malept committed Jul 11, 2019
    Copy the full SHA
    5f5a09b View commit details
  2. Bump check-for-leaks from 1.2.0 to 1.2.1 (#376)

    Bumps [check-for-leaks](https://github.com/zeke/check-for-leaks) from 1.2.0 to 1.2.1.
    - [Release notes](https://github.com/zeke/check-for-leaks/releases)
    - [Commits](zeke/check-for-leaks@v1.2.0...v1.2.1)
    
    Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
    dependabot-preview[bot] authored and malept committed Jul 11, 2019
    Copy the full SHA
    3fac344 View commit details
  3. [Security] Bump extend from 3.0.1 to 3.0.2 (#377)

    Bumps [extend](https://github.com/justmoon/node-extend) from 3.0.1 to 3.0.2. **This update includes security fixes.**
    - [Release notes](https://github.com/justmoon/node-extend/releases)
    - [Changelog](https://github.com/justmoon/node-extend/blob/master/CHANGELOG.md)
    - [Commits](justmoon/node-extend@v3.0.1...v3.0.2)
    
    Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
    dependabot-preview[bot] authored and malept committed Jul 11, 2019
    Copy the full SHA
    3a89744 View commit details
  4. [Security] Bump lodash from 4.17.11 to 4.17.14 (#378)

    Bumps [lodash](https://github.com/lodash/lodash) from 4.17.11 to 4.17.14. **This update includes security fixes.**
    - [Release notes](https://github.com/lodash/lodash/releases)
    - [Commits](lodash/lodash@4.17.11...4.17.14)
    
    Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
    dependabot-preview[bot] authored and malept committed Jul 11, 2019
    Copy the full SHA
    b6022c3 View commit details
  5. Copy the full SHA
    05d0071 View commit details
  6. Copy the full SHA
    083ebd0 View commit details
  7. Bump temp from 0.8.3 to 0.9.0 (#379)

    Bumps [temp](https://github.com/bruce/node-temp) from 0.8.3 to 0.9.0.
    - [Release notes](https://github.com/bruce/node-temp/releases)
    - [Commits](bruce/node-temp@v0.8.3...v0.9.0)
    
    Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
    dependabot-preview[bot] authored and malept committed Jul 11, 2019
    Copy the full SHA
    1965dae View commit details

Commits on Jul 15, 2019

  1. Bump husky from 0.14.3 to 3.0.0 (#375)

    Bumps [husky](https://github.com/typicode/husky) from 0.14.3 to 3.0.0.
    - [Release notes](https://github.com/typicode/husky/releases)
    - [Changelog](https://github.com/typicode/husky/blob/master/CHANGELOG.md)
    - [Commits](typicode/husky@v0.14.3...v3.0.0)
    
    Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
    dependabot-preview[bot] authored and codebytere committed Jul 15, 2019
    Copy the full SHA
    9fdb960 View commit details
  2. Bump typescript from 2.8.4 to 3.5.3 (#383)

    Bumps [typescript](https://github.com/Microsoft/TypeScript) from 2.8.4 to 3.5.3.
    - [Release notes](https://github.com/Microsoft/TypeScript/releases)
    - [Commits](microsoft/TypeScript@v2.8.4...v3.5.3)
    
    Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
    dependabot-preview[bot] authored and codebytere committed Jul 15, 2019
    Copy the full SHA
    101d5d1 View commit details
  3. Bump mocha from 5.2.0 to 6.1.4 (#384)

    Bumps [mocha](https://github.com/mochajs/mocha) from 5.2.0 to 6.1.4.
    - [Release notes](https://github.com/mochajs/mocha/releases)
    - [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md)
    - [Commits](mochajs/mocha@v5.2.0...v6.1.4)
    
    Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
    dependabot-preview[bot] authored and codebytere committed Jul 15, 2019
    Copy the full SHA
    29a2129 View commit details
  4. feat: add support for webContents.executeJavaScript (#366)

    * webContents.executeJavaScript now works as intended
    
    * Document difference with webContents.executeJavaScript between spectron and electron
    
    * tests for webContents.executeJavaScript
    
    * fix lint error
    
    * var to const
    magne4000 authored and codebytere committed Jul 15, 2019
    Copy the full SHA
    474333e View commit details

Commits on Aug 5, 2019

  1. Upgrade for Electron v6 support (#373)

    * Upgrade for Electron v6 support
    
    * Add xvfb service
    npezza93 authored and codebytere committed Aug 5, 2019
    Copy the full SHA
    e033789 View commit details
  2. chore: bump husky from 3.0.0 to 3.0.2 (#402)

    Bumps [husky](https://github.com/typicode/husky) from 3.0.0 to 3.0.2.
    - [Release notes](https://github.com/typicode/husky/releases)
    - [Changelog](https://github.com/typicode/husky/blob/master/CHANGELOG.md)
    - [Commits](typicode/husky@v3.0.0...v3.0.2)
    
    Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
    dependabot-preview[bot] authored and codebytere committed Aug 5, 2019
    Copy the full SHA
    bb36880 View commit details
  3. chore: bump mocha from 6.1.4 to 6.2.0 (#393)

    Bumps [mocha](https://github.com/mochajs/mocha) from 6.1.4 to 6.2.0.
    - [Release notes](https://github.com/mochajs/mocha/releases)
    - [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md)
    - [Commits](mochajs/mocha@v6.1.4...v6.2.0)
    
    Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
    dependabot-preview[bot] authored and codebytere committed Aug 5, 2019
    Copy the full SHA
    7b25759 View commit details
  4. chore: bump request from 2.87.0 to 2.88.0 (#389)

    Bumps [request](https://github.com/request/request) from 2.87.0 to 2.88.0.
    - [Release notes](https://github.com/request/request/releases)
    - [Changelog](https://github.com/request/request/blob/master/CHANGELOG.md)
    - [Commits](request/request@v2.87.0...v2.88.0)
    
    Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
    dependabot-preview[bot] authored and codebytere committed Aug 5, 2019
    Copy the full SHA
    2e32777 View commit details
  5. chore: fix broken badges

    codebytere committed Aug 5, 2019
    Copy the full SHA
    6f988e0 View commit details

Commits on Aug 7, 2019

  1. Copy the full SHA
    404b5ab View commit details

Commits on Aug 26, 2019

  1. chore: bump eslint-utils from 1.3.1 to 1.4.2 (#422)

    Bumps [eslint-utils](https://github.com/mysticatea/eslint-utils) from 1.3.1 to 1.4.2.
    - [Release notes](https://github.com/mysticatea/eslint-utils/releases)
    - [Commits](mysticatea/eslint-utils@v1.3.1...v1.4.2)
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored and malept committed Aug 26, 2019
    Copy the full SHA
    2671c9b View commit details

Commits on Sep 10, 2019

  1. chore: bump tslint from 5.18.0 to 5.20.0

    Bumps [tslint](https://github.com/palantir/tslint) from 5.18.0 to 5.20.0.
    - [Release notes](https://github.com/palantir/tslint/releases)
    - [Changelog](https://github.com/palantir/tslint/blob/master/CHANGELOG.md)
    - [Commits](palantir/tslint@5.18.0...5.20.0)
    
    Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
    dependabot-preview[bot] authored Sep 10, 2019
    Copy the full SHA
    1a34fe2 View commit details

Commits on Oct 10, 2019

  1. chore: bump typescript from 3.5.3 to 3.6.4

    Bumps [typescript](https://github.com/Microsoft/TypeScript) from 3.5.3 to 3.6.4.
    - [Release notes](https://github.com/Microsoft/TypeScript/releases)
    - [Commits](microsoft/TypeScript@v3.5.3...v3.6.4)
    
    Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
    dependabot-preview[bot] authored Oct 10, 2019
    Copy the full SHA
    1c1b466 View commit details
  2. Syntax issue on line 58

    kant authored Oct 10, 2019
    Copy the full SHA
    4c7c29c View commit details

Commits on Oct 14, 2019

  1. chore: bump husky from 3.0.2 to 3.0.9

    Bumps [husky](https://github.com/typicode/husky) from 3.0.2 to 3.0.9.
    - [Release notes](https://github.com/typicode/husky/releases)
    - [Changelog](https://github.com/typicode/husky/blob/master/CHANGELOG.md)
    - [Commits](typicode/husky@v3.0.2...v3.0.9)
    
    Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
    dependabot-preview[bot] authored Oct 14, 2019
    Copy the full SHA
    b3922b4 View commit details

Commits on Oct 21, 2019

  1. chore: bump mocha from 6.2.0 to 6.2.2

    Bumps [mocha](https://github.com/mochajs/mocha) from 6.2.0 to 6.2.2.
    - [Release notes](https://github.com/mochajs/mocha/releases)
    - [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md)
    - [Commits](mochajs/mocha@v6.2.0...v6.2.2)
    
    Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
    dependabot-preview[bot] authored Oct 21, 2019
    Copy the full SHA
    ed6088f View commit details

Commits on Oct 22, 2019

  1. Merge pull request #454 from kant/patch-1

    Syntax issue on line 58
    John Kleinschmidt authored Oct 22, 2019
    Copy the full SHA
    dbca033 View commit details
  2. Merge pull request #432 from electron-userland/dependabot/npm_and_yar…

    …n/tslint-5.20.0
    
    chore: bump tslint from 5.18.0 to 5.20.0
    John Kleinschmidt authored Oct 22, 2019
    Copy the full SHA
    4e74be3 View commit details
  3. Merge pull request #453 from electron-userland/dependabot/npm_and_yar…

    …n/typescript-3.6.4
    
    chore: bump typescript from 3.5.3 to 3.6.4
    John Kleinschmidt authored Oct 22, 2019
    Copy the full SHA
    af7e16a View commit details
  4. Merge pull request #459 from electron-userland/dependabot/npm_and_yar…

    …n/mocha-6.2.2
    
    chore: bump mocha from 6.2.0 to 6.2.2
    John Kleinschmidt authored Oct 22, 2019
    Copy the full SHA
    4783c43 View commit details
  5. Merge pull request #455 from electron-userland/dependabot/npm_and_yar…

    …n/husky-3.0.9
    
    chore: bump husky from 3.0.2 to 3.0.9
    John Kleinschmidt authored Oct 22, 2019
    Copy the full SHA
    d7f65aa View commit details

Commits on Oct 23, 2019

  1. chore: upgrade to Electron 7.0.0 (#462)

    * chore: upgrade to Electron 7.0.0
    
    * Update package-lock.json
    John Kleinschmidt authored Oct 23, 2019
    Copy the full SHA
    cd733c4 View commit details
  2. 8.0.0

    John Kleinschmidt committed Oct 23, 2019
    Copy the full SHA
    d6772f0 View commit details

Commits on Jan 24, 2020

  1. Update for 8.0.0-beta.7 (#530)

    * chore: update for 8.0.0-beta.7
    
    * fix: hack the rpath
    
    Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
    VerteDinde and MarshallOfSound committed Jan 24, 2020
    Copy the full SHA
    8c0e7c0 View commit details
  2. Copy the full SHA
    1fdf081 View commit details

Commits on Feb 4, 2020

  1. chore: bump temp from 0.9.0 to 0.9.1 (#470)

    Bumps [temp](https://github.com/bruce/node-temp) from 0.9.0 to 0.9.1.
    - [Release notes](https://github.com/bruce/node-temp/releases)
    - [Commits](https://github.com/bruce/node-temp/commits)
    
    Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
    dependabot-preview[bot] authored Feb 4, 2020
    Copy the full SHA
    ca3dfff View commit details
  2. chore: bump typescript from 3.6.4 to 3.7.5 (#524)

    Bumps [typescript](https://github.com/Microsoft/TypeScript) from 3.6.4 to 3.7.5.
    - [Release notes](https://github.com/Microsoft/TypeScript/releases)
    - [Commits](microsoft/TypeScript@v3.6.4...v3.7.5)
    
    Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
    dependabot-preview[bot] authored Feb 4, 2020
    Copy the full SHA
    598bbb9 View commit details
  3. chore: bump tslint from 5.20.0 to 6.0.0 (#527)

    Bumps [tslint](https://github.com/palantir/tslint) from 5.20.0 to 6.0.0.
    - [Release notes](https://github.com/palantir/tslint/releases)
    - [Changelog](https://github.com/palantir/tslint/blob/master/CHANGELOG.md)
    - [Commits](palantir/tslint@5.20.0...6.0.0)
    
    Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
    dependabot-preview[bot] authored Feb 4, 2020
    Copy the full SHA
    7adad33 View commit details
  4. chore: bump husky from 3.0.9 to 4.2.1 (#531)

    Bumps [husky](https://github.com/typicode/husky) from 3.0.9 to 4.2.1.
    - [Release notes](https://github.com/typicode/husky/releases)
    - [Changelog](https://github.com/typicode/husky/blob/master/CHANGELOG.md)
    - [Commits](typicode/husky@v3.0.9...v4.2.1)
    
    Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
    dependabot-preview[bot] authored Feb 4, 2020
    Copy the full SHA
    f9e5956 View commit details
  5. chore: move @types/webdriverio to dependencies from devDependencies (#…

    …503)
    
    The Spectron type declaration file depends on a type from @types/webdriverio, therefore it should be a productive dependency.
    
    Co-authored-by: John Kleinschmidt <jkleinsc@github.com>
    Toromyx and John Kleinschmidt authored Feb 4, 2020
    Copy the full SHA
    0813411 View commit details
  6. chore: bump mocha from 6.2.2 to 7.0.1 (#532)

    Bumps [mocha](https://github.com/mochajs/mocha) from 6.2.2 to 7.0.1.
    - [Release notes](https://github.com/mochajs/mocha/releases)
    - [Changelog](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md)
    - [Commits](mochajs/mocha@v6.2.2...v7.0.1)
    
    Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
    
    Co-authored-by: John Kleinschmidt <jkleinsc@github.com>
    dependabot-preview[bot] and John Kleinschmidt authored Feb 4, 2020
    Copy the full SHA
    d85b90d View commit details
  7. chore: bump electron from 8.0.0-beta.7 to 8.0.0 (#536)

    Bumps [electron](https://github.com/electron/electron) from 8.0.0-beta.7 to 8.0.0.
    - [Release notes](https://github.com/electron/electron/releases)
    - [Changelog](https://github.com/electron/electron/blob/master/docs/breaking-changes.md)
    - [Commits](electron/electron@v8.0.0-beta.7...v8.0.0)
    
    Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
    dependabot-preview[bot] authored Feb 4, 2020
    Copy the full SHA
    f3ee128 View commit details
  8. chore: Update for Electron 8.0.0 stable (#537)

    * Update for Electron 8.0.0 stable
    John Kleinschmidt authored Feb 4, 2020
    Copy the full SHA
    aa7a137 View commit details

Commits on Feb 8, 2020

  1. Copy the full SHA
    81c0bee View commit details

Commits on Mar 13, 2020

  1. chore: [security] bump acorn from 5.7.3 to 5.7.4

    Bumps [acorn](https://github.com/acornjs/acorn) from 5.7.3 to 5.7.4. **This update includes a security fix.**
    - [Release notes](https://github.com/acornjs/acorn/releases)
    - [Commits](acornjs/acorn@5.7.3...5.7.4)
    
    Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
    dependabot-preview[bot] authored and malept committed Mar 13, 2020
    Copy the full SHA
    336d866 View commit details

Commits on May 19, 2020

  1. Fix argument ordering issue when number of arguments exceeds 10. Adde…

    …d test for issue. (#588)
    
    Co-authored-by: Jason Hiser <jdhiser@gmail.com>
    jdhiser and jdhiser authored May 19, 2020
    Copy the full SHA
    9c21121 View commit details
  2. feat: Add type definition for client.auditAccessibility method (#563)

    * feat: Add type definition for client.auditAccessibility method
    
    * fix: Linting error, replace Array<> by []
    megahertz authored May 19, 2020
    Copy the full SHA
    732fe76 View commit details
  3. chore: bump electron from 8.0.0 to 9.0.0 (#611)

    * chore: bump electron from 8.0.0 to 9.0.0
    
    Bumps [electron](https://github.com/electron/electron) from 8.0.0 to 9.0.0.
    - [Release notes](https://github.com/electron/electron/releases)
    - [Changelog](https://github.com/electron/electron/blob/master/docs/breaking-changes.md)
    - [Commits](electron/electron@v8.0.0...v9.0.0)
    
    Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
    
    * Update for electron v9.0.0
    
    * chore: bump typescript from 3.7.5 to 3.9.2
    
    Bumps [typescript](https://github.com/Microsoft/TypeScript) from 3.7.5 to 3.9.2.
    - [Release notes](https://github.com/Microsoft/TypeScript/releases)
    - [Commits](microsoft/TypeScript@v3.7.5...v3.9.2)
    
    Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
    
    * chore: bump husky from 4.2.1 to 4.2.5
    
    Bumps [husky](https://github.com/typicode/husky) from 4.2.1 to 4.2.5.
    - [Release notes](https://github.com/typicode/husky/releases)
    - [Changelog](https://github.com/typicode/husky/blob/master/CHANGELOG.md)
    - [Commits](typicode/husky@v4.2.1...v4.2.5)
    
    Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
    
    * v11.0.0
    
    Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
    Co-authored-by: John Kleinschmidt <jkleinsc@github.com>
    dependabot-preview[bot] and John Kleinschmidt authored May 19, 2020
    Copy the full SHA
    0e91e2b View commit details
Showing with 2,363 additions and 1,074 deletions.
  1. +40 −0 .github/workflows/ci.yml
  2. +5 −12 .travis.yml
  3. +31 −10 README.md
  4. +0 −28 appveyor.yml
  5. +30 −13 lib/api.js
  6. +34 −0 lib/application.js
  7. +1 −1 lib/chrome-driver.js
  8. +1 −1 lib/launcher.js
  9. +13 −0 lib/rpath-fix.js
  10. +67 −0 lib/spectron.d.ts
  11. +2,031 −983 package-lock.json
  12. +15 −10 package.json
  13. +0 −13 script/travis-build.sh
  14. +21 −1 test/application-test.js
  15. +1 −1 test/commands-test.js
  16. +2 −0 test/fixtures/app/main.js
  17. +57 −0 test/many-args.js
  18. +14 −1 test/multi-window-test.js
40 changes: 40 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: CI

on:
push:
branches:
- master
tags:
- v[0-9]+.[0-9]+.[0-9]+*
pull_request:

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest, macOS-latest]
node-version: [12.x]

steps:
- name: Fix git checkout line endings
run: git config --global core.autocrlf input
- uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Get npm cache directory
id: npm-cache
run: |
echo "::set-output name=dir::$(npm config get cache)"
- uses: actions/cache@v1
with:
path: ${{ steps.npm-cache.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install
run: npm ci
- name: Test
run: npm test
17 changes: 5 additions & 12 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,14 @@
os:
- linux
- osx

os: linux
language: node_js

node_js:
- '8'
node_js: '12'
cache: npm

branches:
only:
- master

script: ./script/travis-build.sh

cache:
directories:
- node_modules
services:
- xvfb

notifications:
email:
41 changes: 31 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
# <img src="https://cloud.githubusercontent.com/assets/378023/15063284/cf544f2c-1383-11e6-9336-e13bd64b1694.png" width="60px" align="center" alt="Spectron icon"> Spectron

[![Linux Build Status](https://travis-ci.org/electron/spectron.svg?branch=master)](https://travis-ci.org/electron/spectron)
[![Windows Build Status](https://ci.appveyor.com/api/projects/status/iv8xd919q6b44pap/branch/master?svg=true)](https://ci.appveyor.com/project/kevinsawicki/spectron/branch/master)
<br>
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](http://standardjs.com/)
[![dependencies](https://img.shields.io/david/electron/spectron.svg)](https://david-dm.org/electron/spectron)
<br>
[![license:mit](https://img.shields.io/badge/license-mit-blue.svg)](https://opensource.org/licenses/MIT)
[![npm:](https://img.shields.io/npm/v/spectron.svg)](https://www.npmjs.com/package/spectron)
[![downloads](https://img.shields.io/npm/dm/spectron.svg)](https://www.npmjs.com/package/spectron)
[![Windows Build Status](https://ci.appveyor.com/api/projects/status/iv8xd919q6b44pap/branch/master?svg=true)](https://ci.appveyor.com/project/kevinsawicki/spectron/branch/master) [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](http://standardjs.com/)
[![dependencies](https://img.shields.io/david/electron/spectron.svg)](https://david-dm.org/electron/spectron) [![license:mit](https://img.shields.io/badge/license-mit-blue.svg)](https://opensource.org/licenses/MIT) [![npm:](https://img.shields.io/npm/v/spectron.svg)](https://www.npmjs.com/package/spectron) [![downloads](https://img.shields.io/npm/dm/spectron.svg)](https://www.npmjs.com/package/spectron)

Easily test your [Electron](http://electron.atom.io) apps using
[ChromeDriver](https://sites.google.com/a/chromium.org/chromedriver) and
@@ -33,6 +26,10 @@ For given versions of Electron you must depend on a very specific version range
| `^3.0.0` | `^5.0.0` |
| `^4.0.0` | `^6.0.0` |
| `^5.0.0` | `^7.0.0` |
| `^6.0.0` | `^8.0.0` |
| `^7.0.0` | `^9.0.0` |
| `^8.0.0` | `^10.0.0`|
| `^9.0.0` | `^11.0.0`|

Learn more from [this presentation](https://speakerdeck.com/kevinsawicki/testing-your-electron-apps-with-chromedriver).

@@ -61,7 +58,7 @@ touch test/spec.js
cd test
```

Then simply include the following your first `spec.js`.
Then simply include the following in your first `spec.js`.

```js
const Application = require('spectron').Application
@@ -305,6 +302,18 @@ app.webContents.savePage('/Users/kevin/page.html', 'HTMLComplete')
})
```

##### executeJavaScript
The async `executeJavaScript` API is supported but instead of taking a callback it
returns a `Promise` that will resolve with the result of the last statement of the
script.

```js
app.webContents.executeJavaScript('1 + 2')
.then(function (result) {
console.log(result) // prints 3
})
```

#### mainProcess

The `mainProcess` property is an alias for `require('electron').remote.process`.
@@ -452,6 +461,18 @@ Focus a window using its index from the `windowHandles()` array.
app.client.windowByIndex(1)
```

#### client.switchWindow(urlOrTitleToMatch)

Focus a window using its URL or title.

```js
// switch via url match
app.client.switchWindow('google.com')

// switch via title match
app.client.switchWindow('Next-gen WebDriver test framework')
```

### Accessibility Testing

Spectron bundles the [Accessibility Developer Tools](https://github.com/GoogleChrome/accessibility-developer-tools)
28 changes: 0 additions & 28 deletions appveyor.yml

This file was deleted.

43 changes: 30 additions & 13 deletions lib/api.js
Original file line number Diff line number Diff line change
@@ -313,19 +313,16 @@ Api.prototype.addCapturePageSupport = function () {
var self = this

app.client.addCommand('browserWindow.capturePage', function (rect) {
return this.executeAsync(function (rect, requireName, done) {
return this.executeAsync(async function (rect, requireName, done) {
var args = []
if (rect != null) args.push(rect)
args.push(function (image) {
if (image != null) {
done(image.toPNG().toString('base64'))
} else {
done(image)
}
})

var browserWindow = window[requireName]('electron').remote.getCurrentWindow()
browserWindow.capturePage.apply(browserWindow, args)
const image = await browserWindow.capturePage.apply(browserWindow, args)
if (image != null) {
done(image.toPNG().toString('base64'))
} else {
done(image)
}
}, rect, self.requireName).then(getResponseValue).then(function (image) {
return Buffer.from(image, 'base64')
})
@@ -342,7 +339,8 @@ Api.prototype.addWebContentsApis = function (api) {
app.webContents = {}

const asyncApis = {
'webContents.savePage': true
'webContents.savePage': true,
'webContents.executeJavaScript': true
}

Object.keys(api).filter(function (name) {
@@ -361,16 +359,18 @@ Api.prototype.addWebContentsApis = function (api) {
})

this.addSavePageSupport()
this.addExecuteJavaScriptSupport()
}

Api.prototype.addSavePageSupport = function () {
var app = this.app
var self = this

app.client.addCommand('webContents.savePage', function (fullPath, saveType) {
return this.executeAsync(function (fullPath, saveType, requireName, done) {
return this.executeAsync(async function (fullPath, saveType, requireName, done) {
var webContents = window[requireName]('electron').remote.getCurrentWebContents()
webContents.savePage(fullPath, saveType, done)
await webContents.savePage(fullPath, saveType)
done()
}, fullPath, saveType, self.requireName).then(getResponseValue).then(function (rawError) {
if (rawError) {
var error = new Error(rawError.message)
@@ -385,6 +385,23 @@ Api.prototype.addSavePageSupport = function () {
}
}

Api.prototype.addExecuteJavaScriptSupport = function () {
const app = this.app
const self = this

app.client.addCommand('webContents.executeJavaScript', function (code, useGesture) {
return this.executeAsync(async function (code, useGesture, requireName, done) {
const webContents = window[requireName]('electron').remote.getCurrentWebContents()
const result = await webContents.executeJavaScript(code, useGesture)
done(result)
}, code, useGesture, self.requireName).then(getResponseValue)
})

app.webContents.executeJavaScript = function () {
return app.client['webContents.executeJavaScript'].apply(app.client, arguments)
}
}

Api.prototype.addProcessApis = function (api) {
var app = this.app
app.rendererProcess = {}
34 changes: 34 additions & 0 deletions lib/application.js
Original file line number Diff line number Diff line change
@@ -225,6 +225,40 @@ Application.prototype.addCommands = function () {
})
})

/**
* Utility from webdriverio v5
* https://github.com/webdriverio/webdriverio/blob/v5.9.4/packages/webdriverio/src/commands/browser/switchWindow.js
*/
this.client.addCommand('switchWindow', async function (urlOrTitleToMatch) {
if (typeof urlOrTitleToMatch !== 'string' && !(urlOrTitleToMatch instanceof RegExp)) {
throw new TypeError('Invalid parameter urlOrTitleToMatch: expected a string or a RegExp')
}

const tabs = await this.windowHandles().then(getResponseValue)

for (const tab of tabs) {
await this.window(tab)

/**
* check if url matches
*/
const url = await this.getUrl()
if (url.match(urlOrTitleToMatch)) {
return tab
}

/**
* check title
*/
const title = await this.getTitle()
if (title.match(urlOrTitleToMatch)) {
return tab
}
}

throw new Error(`No window found with title or url matching "${urlOrTitleToMatch}"`)
})

this.client.addCommand('waitUntilWindowLoaded', function (timeout) {
return this.waitUntil(function () {
return this.webContents.isLoading().then(function (loading) {
2 changes: 1 addition & 1 deletion lib/chrome-driver.js
Original file line number Diff line number Diff line change
@@ -120,7 +120,7 @@ ChromeDriver.prototype.isRunning = function (callback) {
request(requestOptions, function (error, response, body) {
if (error) return callback(cb)
if (response.statusCode !== 200) return callback(cb)
callback(body && body.status === 0)
callback(body && body.value.ready)
})
}

2 changes: 1 addition & 1 deletion lib/launcher.js
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@ process.argv.slice(2).forEach(function (arg) {
if (name === '--spectron-path') {
executablePath = value
} else if (name.indexOf('--spectron-arg') === 0) {
appArgs.push(value)
appArgs[Number(name.substring(14))] = value
} else if (name.indexOf('--spectron-env') === 0) {
process.env[name.substring(15)] = value
} else if (name.indexOf('--spectron-') !== 0) {
13 changes: 13 additions & 0 deletions lib/rpath-fix.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
if (process.platform !== 'darwin') process.exit(0)

const cp = require('child_process')
const path = require('path')

const pathToChromedriver = require.resolve('electron-chromedriver/chromedriver')
const pathToChromedriverBin = path.resolve(pathToChromedriver, '..', 'bin', 'chromedriver')

const result = cp.spawnSync('install_name_tool', ['-add_rpath', '@executable_path/.', pathToChromedriverBin], {})
if (result.status !== 0) {
if (result.stderr.includes('file already has LC_RPATH')) process.exit(0)
process.exit(result.status)
}
Loading