Skip to content
This repository has been archived by the owner on Nov 24, 2018. It is now read-only.

Proposal: unit tests #188

Open
wants to merge 23 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
124f39b
replaced Ava with Jest, added some base tests
geoffdutton Aug 7, 2017
81f1238
set CHROMELESS_CHROME_PORT for circleci
geoffdutton Aug 7, 2017
38c831f
added notes about unit testing
geoffdutton Aug 7, 2017
c52ebfb
merge 1.2.0
geoffdutton Aug 7, 2017
f155d3c
moved evaluate strings to a new file for finer control
geoffdutton Aug 7, 2017
1d944aa
updated tests and merged in 1.2.0
geoffdutton Aug 7, 2017
57dcba3
remove unused function
geoffdutton Aug 7, 2017
8c0f7f9
Merge branch 'master' into jest-tests
geoffdutton Aug 8, 2017
b96bc16
attempt to fix failing test in circle ci
geoffdutton Aug 8, 2017
acd1814
check if in headless mode when testing .pdf()
geoffdutton Aug 8, 2017
eb3939f
Added more coverage, mostly to files in src/*.js
geoffdutton Aug 8, 2017
027087f
Added more coverage, mostly to files in src/*.js
geoffdutton Aug 8, 2017
a785232
added --forceExit to jest for circleci
geoffdutton Aug 8, 2017
c6a76a0
Reverted example back to original; Added coveralls badge and circleci…
geoffdutton Aug 8, 2017
6786149
Fix circleci coveralls command
geoffdutton Aug 8, 2017
84d1221
Removed coveralls circleci command, will need repo owner to set it up
geoffdutton Aug 8, 2017
dda1e27
Added much more coverage around local-runtime.ts
geoffdutton Aug 8, 2017
ab798ad
Modified the main test command to run with concurrency better
geoffdutton Aug 8, 2017
277a659
Changed npm test to use --no-cache, otherwise coverage reports are no…
geoffdutton Aug 9, 2017
efe5cb3
mocked out got and mqtt, need to work on some more coverage
geoffdutton Aug 13, 2017
82b08fa
Merge branch 'master' into jest-tests
geoffdutton Aug 13, 2017
a1ec935
Merge branch 'jest-tests' into jest-tests-remote
geoffdutton Aug 13, 2017
46902bf
added better unhandled rejection listener, covered most of remote.ts
geoffdutton Aug 13, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ jobs:
- checkout
- run: docker run -d --rm --name chrome --shm-size 1024m -p 9222:9222 --cap-add SYS_ADMIN yukinying/chrome-headless-browser
- run: npm install
- run: npm test
- run: CHROMELESS_CHROME_PORT=9222 npm test
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Chromeless [![npm version](https://badge.fury.io/js/chromeless.svg)](https://badge.fury.io/js/chromeless) [![CircleCI](https://circleci.com/gh/graphcool/chromeless.svg?style=svg)](https://circleci.com/gh/graphcool/chromeless)
# Chromeless [![npm version](https://badge.fury.io/js/chromeless.svg)](https://badge.fury.io/js/chromeless) [![CircleCI](https://circleci.com/gh/graphcool/chromeless.svg?style=svg)](https://circleci.com/gh/graphcool/chromeless) [![Coverage Status](https://coveralls.io/repos/github/geoffdutton/chromeless/badge.svg?branch=jest-tests)](https://coveralls.io/github/geoffdutton/chromeless?branch=jest-tests)

Chrome automation made simple. Runs locally or headless on AWS Lambda. (**[See Demo](https://chromeless.netlify.com/)**)

Expand Down Expand Up @@ -183,6 +183,14 @@ const chromeless = new Chromeless({
2) Run `npm install`
3) To build: `npm run build`

**Unit testing:**
1) Run `npm run launch:chrome` to start a fresh instance of Chrome
2) Run `npm test` or `npm watch:test`
3) Check the coverage report and make sure that's as close to 100% as possible

**Debugging Note:** If you use one of Intellij's IDEs, you might need to use Node v7. For whatever reason, I could not get the debugger to hit break points with Node v8 and above.


#### Linking this NPM repository

1) Go to this repository locally
Expand Down
6 changes: 3 additions & 3 deletions examples/extract-google-results.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
const { Chromeless } = require('chromeless')

async function run() {
const chromeless = new Chromeless({ remote: true })
async function run () {
const chromeless = await new Chromeless()

const links = await chromeless

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is incorrect, did you mean to commit this one?

const links = chromeless
.goto('https://www.google.com')
.type('chromeless', 'input[name="q"]')
.press(13)
Expand Down
Loading