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

[WIP] Proxy service updates #376

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 0 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@
dist/
package.json
package-lock.json
serverless/
8 changes: 4 additions & 4 deletions examples/extract-google-results.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ async function run() {
.wait('#resultStats')
.evaluate(() => {
// this will be executed in headless chrome
const links = [].map.call(
document.querySelectorAll('.g h3 a'),
a => ({title: a.innerText, href: a.href})
)
const links = [].map.call(document.querySelectorAll('.g h3 a'), a => ({
title: a.innerText,
href: a.href,
}))
return JSON.stringify(links)
})
// you can still use the method chaining API after evaluating
Expand Down
22 changes: 10 additions & 12 deletions examples/mocha-chai-test-example.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,39 +5,37 @@ const { expect } = require('chai')
// to run this example just run
// mocha path/to/this/file

describe('When searching on google', function () {
it('shows results', async function () {
this.timeout(10000); //we need to increase the timeout or else mocha will exit with an error
describe('When searching on google', function() {
it('shows results', async function() {
this.timeout(10000) //we need to increase the timeout or else mocha will exit with an error
const chromeless = new Chromeless()

await chromeless.goto('https://google.com')
await chromeless
.goto('https://google.com')
.wait('input[name="q"]')
.type('chromeless github', 'input[name="q"]')
.press(13) // press enter
.wait('#resultStats')


const result = await chromeless.exists('a[href*="graphcool/chromeless"]')


expect(result).to.be.true
await chromeless.end()
})
})

describe('When clicking on the image of the demo playground', function () {
it('should redirect to the demo', async function () {
this.timeout(10000); //we need to increase the timeout or else mocha will exit with an error
describe('When clicking on the image of the demo playground', function() {
it('should redirect to the demo', async function() {
this.timeout(10000) //we need to increase the timeout or else mocha will exit with an error
const chromeless = new Chromeless()
await chromeless.goto('https://github.com/graphcool/chromeless')
await chromeless
.goto('https://github.com/graphcool/chromeless')
.wait('a[href="https://chromeless.netlify.com/"]')
.click('a[href="https://chromeless.netlify.com/"]')
.wait('#root')


const url = await chromeless.evaluate(url => window.location.href)


expect(url).to.match(/^https\:\/\/chromeless\.netlify\.com/)
await chromeless.end()
})
Expand Down
18 changes: 9 additions & 9 deletions examples/mouse-event-example.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
const { Chromeless } = require('chromeless')

async function run() {
const chromeless = new Chromeless()
const chromeless = new Chromeless()

const screenshot = await chromeless
.goto('https://www.google.com')
.mousedown('input[name="btnI"]')
.mouseup('input[name="btnI"]')
.wait('.latest-doodle')
.screenshot()
const screenshot = await chromeless
.goto('https://www.google.com')
.mousedown('input[name="btnI"]')
.mouseup('input[name="btnI"]')
.wait('.latest-doodle')
.screenshot()

console.log(screenshot)
console.log(screenshot)

await chromeless.end()
await chromeless.end()
}

run().catch(console.error.bind(console))
5 changes: 2 additions & 3 deletions examples/twitter.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const { Chromeless } = require('chromeless')

const twitterUsername = "xxx"
const twitterPassword = "xxx"
const twitterUsername = 'xxx'
const twitterPassword = 'xxx'

async function run() {
const chromeless = new Chromeless()
Expand All @@ -18,4 +18,3 @@ async function run() {
}

run().catch(console.error.bind(console))

Loading