Skip to content

Commit

Permalink
v7 (#559)
Browse files Browse the repository at this point in the history
* v7
  • Loading branch information
mgrybyk authored Jun 18, 2021
1 parent 39f4a1c commit 7feec76
Show file tree
Hide file tree
Showing 33 changed files with 468 additions and 990 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module.exports = {
root: true,
parserOptions: {
ecmaVersion: 2017,
ecmaVersion: 2019,
},
plugins: ['prettier'],
extends: ['eslint:recommended', 'prettier', 'plugin:prettier/recommended'],
Expand Down
38 changes: 38 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Test

on:
push:
branches:
- master
pull_request:

jobs:
linux:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: ['12.x', '14.x', '16.x']
java: ['11']
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: ${{ matrix.java }}
- uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- uses: actions/cache@v2
id: cache
with:
path: '**/node_modules'
key: ${{ runner.os }}-${{ matrix.node-version }}-node_modules-${{ hashFiles('**/package-lock.json') }}
- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: npm ci
- name: Lint
run: npm run lint
- name: Test
run: npm run test
env:
CI: true
25 changes: 0 additions & 25 deletions .travis.yml

This file was deleted.

4 changes: 1 addition & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
FROM ubuntu:latest@sha256:aba80b77e27148d99c034a987e7da3a287ed455390352663418c0f2ed40417fe

ENV NODE_VERSION 8.11.2

LABEL author="Vincent Voyer <vincent@zeroload.net>"
LABEL maintainer="Serban Ghita <serbanghita@gmail.com>"

Expand Down Expand Up @@ -35,7 +33,7 @@ RUN apt-get -qqy --no-install-recommends install \
nodejs \
firefox \
google-chrome-stable \
openjdk-8-jre-headless \
openjdk-11-jre-headless \
xvfb \
xfonts-100dpi \
xfonts-75dpi \
Expand Down
9 changes: 9 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
# 7.0.0 (2021-06-18)
* BREAKING CHANGE drop nodejs 10, minimum version is 12
* BREAKING CHANGE removed callbacks for `install` and `start` commands
* BREAKING CHANGE `install` and `start` commands are Promises now!
* BREAKING CHANGE docker images are built with `jdk11`
* BREAKING CHANGE dropped support of old browser drivers and platforms
* BREAKING CHANGE change folder structure #491
* check port before starting selenium #553

# 6.24.0 (2021-06-16)
* selenium 4 support
* update default versions
Expand Down
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->


- [selenium-standalone](#selenium-standalone)
- [Install & Run](#install--run)
- [Command line interface (CLI)](#command-line-interface-cli)
Expand All @@ -14,7 +13,6 @@
<!-- END doctoc generated TOC please keep comment here to allow auto update -->

# selenium-standalone
[![Build Status](https://travis-ci.org/vvo/selenium-standalone.svg?branch=master)](https://travis-ci.org/vvo/selenium-standalone)
[![dependencies Status](https://david-dm.org/vvo/selenium-standalone/status.svg)](https://david-dm.org/vvo/selenium-standalone)
[![devDependencies Status](https://david-dm.org/vvo/selenium-standalone/dev-status.svg)](https://david-dm.org/vvo/selenium-standalone?type=dev)

Expand Down
51 changes: 16 additions & 35 deletions bin/selenium-standalone
Original file line number Diff line number Diff line change
Expand Up @@ -11,54 +11,33 @@ const path = require('path');
const selenium = require('../');
const defaultConfig = require('../lib/default-config')();

if (!process.listeners('unhandledRejection').length === 0) {
process.on('unhandledRejection', (reason) => {
console.error(reason);
});
}

const actions = {
start: function (options) {
start: async function (options) {
const killEvents = ['exit', 'SIGTERM', 'SIGINT'];
const cp = await selenium.start(options);

selenium.start(options, started);

function started(err, cp) {
if (err) {
if (cp) {
cp.kill('SIGINT');
}
throw err;
}

console.log('Selenium started');

killEvents.forEach(register);

function register(evName) {
process.on(evName, kill);
}
console.log('Selenium started');

function unregister(evName) {
process.removeListener(evName, kill);
}
killEvents.forEach((evName) => {
process.once(evName, () => cp.kill('SIGTERM'));
});

function kill() {
killEvents.forEach(unregister);
cp.kill('SIGTERM');
}
}
return cp;
},
install: function (options) {
install: async function (options) {
const ProgressBar = require('progress');
let bar;
let firstProgress = true;

// eslint-disable-next-line no-param-reassign
options.progressCb = options.silent ? null : progressCb;

selenium.install(options, installed);

function installed(err) {
if (err) {
throw err;
}
}

function progressCb(total, progress, chunk, url, reset) {
if (firstProgress) {
console.log('');
Expand All @@ -77,6 +56,8 @@ const actions = {

bar.tick(chunk);
}

await selenium.install(options);
},
};

Expand Down
4 changes: 0 additions & 4 deletions bin/start-selenium

This file was deleted.

4 changes: 2 additions & 2 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ LABEL maintainers="Serban Ghita <serbanghita@gmail.com>, David Catalan <catalan.
ENV LC_ALL=C
ENV DISPLAY=:99
ENV SELENIUM_CONSOLE_URL=http://localhost:4444/wd/hub
ENV SCREEN_GEOMETRY=1024x768x16
ENV SCREEN_GEOMETRY=1920x1080x16


# Expose Selenium web console port
Expand All @@ -29,7 +29,7 @@ RUN apt-get -qqy install \
jq \
software-properties-common \
sudo \
openjdk-8-jre-headless \
openjdk-11-jre-headless \
wget \
xvfb \
xfonts-100dpi \
Expand Down
2 changes: 1 addition & 1 deletion docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ $ docker run -it -p 4444:4444 vvoyer/selenium-standalone

* `SCREEN_GEOMETRY` Set browser window size
* Format: `<WIDTH>x<HEIGHT>x<DEPTH>`
* Default: `1024x768x16`
* Default: `1920x1080x16`
* Usage example: set screen size to 1200x1200 with 8bits depth
```
$ docker run -it -p 4444:4444 -e SCREEN_GEOMETRY="1200x1200x8" vvoyer/selenium-standalone
Expand Down
18 changes: 9 additions & 9 deletions docs/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
- [Application Programming Interface (API)](#application-programming-interface-api)
- [Sample configuration object](#sample-configuration-object)
- [Example](#example)
- [selenium.install([opts,] cb)](#seleniuminstallopts-cb)
- [selenium.start([opts,] cb)](#seleniumstartopts-cb)
- [`Error: Another Selenium process is already running`](#error-another-selenium-process-is-already-running)
- [selenium.install([opts])](#seleniuminstallopts)
- [selenium.start([opts])](#seleniumstartopts)
- [`Error: Port 4444 is already in use.`](#error-port-4444-is-already-in-use)

<!-- END doctoc generated TOC please keep comment here to allow auto update -->

Expand Down Expand Up @@ -57,7 +57,7 @@ selenium.install({
}, cb);
```

## selenium.install([opts,] cb)
## selenium.install([opts])

`opts.version` [selenium version](https://selenium-release.storage.googleapis.com/index.html) to install.

Expand All @@ -82,9 +82,9 @@ arch [sometimes](https://code.google.com/p/selenium/issues/detail?id=5116#c9).

`opts.requestOpts` can be any valid [`got` options object](https://www.npmjs.com/package/got#proxies). You can use this for example to set a timeout.

`cb(err)` called when install finished or errored.
returns `Promise<void>`

## selenium.start([opts,] cb)
## selenium.start([opts])

`opts.version` [selenium version](https://selenium-release.storage.googleapis.com/index.html) to install.

Expand All @@ -109,11 +109,11 @@ By default all drivers are loaded, you only control and change the versions or a

`opts.requestOpts` can be any valid [`got` options object](https://www.npmjs.com/package/got#proxies). You can use this for example to set a timeout.

`cb(err, child)` called when the server is running and listening, child is the [ChildProcess](https://nodejs.org/api/child_process.html#child_process_class_childprocess) instance created.
returns `Promise<ChildProcess>`

So you can `child.kill()` when you are done.
So you can `const child = await start(); child.kill()` when you are done.

#### `Error: Another Selenium process is already running`
#### `Error: Port 4444 is already in use.`

If you're getting this error, it means that you didn't shut down the server successfully the last time you started it, so it's still running in the background. You can kill it by running:

Expand Down
7 changes: 7 additions & 0 deletions docs/issuer-cerificate.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->

- [`Error: unable to get local issuer certificate`](#error-unable-to-get-local-issuer-certificate)

<!-- END doctoc generated TOC please keep comment here to allow auto update -->

### `Error: unable to get local issuer certificate`

This error might happen when you are behind a specific proxy. Then you need to set some environement variables:
Expand Down
11 changes: 8 additions & 3 deletions docs/java-versions.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->

- [Ensure you have the minimum required Java version](#ensure-you-have-the-minimum-required-java-version)

<!-- END doctoc generated TOC please keep comment here to allow auto update -->

### Ensure you have the minimum required Java version

With the release of Selenium 3+, the minimum required version of Java is 8, as [7 has ceased public updates](https://java.com/en/download/faq/java_7.xml).
With the release of Selenium 3+, the minimum required version of Java is 8.

If an older selenium version is needed, you can check the requirements on the [official Selenium changelog](https://raw.githubusercontent.com/SeleniumHQ/selenium/master/java/CHANGELOG).

Expand All @@ -9,5 +16,3 @@ Here is a reference sheet for the more recent Selenium version:
| Selenium version | Minimum Java Required |
| --- | --- |
| 3.0.0+ | Java 8 |
| 2.47.0+ | Java 7 |
| 2.22.0+ | Java 6 |
9 changes: 9 additions & 0 deletions docs/logging.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->

- [Logging](#logging)
- [Selenium Process](#selenium-process)
- [Debug Logs for Selenium Standalone Process](#debug-logs-for-selenium-standalone-process)

<!-- END doctoc generated TOC please keep comment here to allow auto update -->

### Logging

#### Selenium Process
Expand Down
7 changes: 7 additions & 0 deletions docs/run-when-system-starts.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->

- [Start Selenium whenever your (ubuntu) machine starts!](#start-selenium-whenever-your-ubuntu-machine-starts)

<!-- END doctoc generated TOC please keep comment here to allow auto update -->

### Start Selenium whenever your (ubuntu) machine starts!

After installing selenium-standalone globally, execute the following commands to run selenium-standalone when your machine starts!
Expand Down
7 changes: 7 additions & 0 deletions docs/xvfb.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->

- [Running headlessly](#running-headlessly)

<!-- END doctoc generated TOC please keep comment here to allow auto update -->

### Running headlessly

On linux,
Expand Down
16 changes: 3 additions & 13 deletions lib/check-args.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,9 @@
const debug = require('debug')('selenium-standalone:install');

const checkArgs = (fnName, _opts, _cb) => {
debug(fnName + ' called with', _opts);
const checkArgs = (fnName, opts = {}) => {
debug(fnName + ' called with', opts);

let opts = _opts;
let cb = _cb;

if (typeof opts === 'function') {
cb = opts;
opts = {};
} else {
opts = Object.assign({}, opts);
}

return { opts, cb };
return { ...opts };
};

module.exports = {
Expand Down
Loading

0 comments on commit 7feec76

Please sign in to comment.