Created
January 8, 2019 10:20
-
-
Save trotzig/7937c420388165196a38723f100a92bb to your computer and use it in GitHub Desktop.
Example of using happo-plugin-scrape with a wrapper element
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const path = require('path'); | |
const { RemoteBrowserTarget } = require('happo.io'); | |
const happoScrapePlugin = require('happo-plugin-scrape'); | |
function commonWrapper(html) { | |
return ` | |
<div class="application-wrapper"> | |
<div style="width:100%" class="od-homepage">${html}</div> | |
</div> | |
`; | |
} | |
module.exports = { | |
apiKey: process.env.APIKEY, | |
apiSecret: process.env.APISECRET, | |
type: 'plain', | |
plugins: [ | |
happoScrapePlugin({ | |
pages: [ | |
{ | |
url: 'https://www.opendoor.com', | |
wrapper: commonWrapper, | |
examples: [ | |
{ | |
name: 'Navigation', | |
selector: '.od-full-header', | |
}, | |
{ | |
name: 'Sell in a few steps', | |
selector: '#how-it-works .regular-container', | |
}, | |
{ | |
name: 'Get an offer', | |
selector: '.test-default', | |
}, | |
{ | |
name: 'Locations', | |
selector: '#locations' | |
}, | |
{ | |
name: 'Footer', | |
selector: '.od-full-footer' | |
} | |
], | |
}, | |
], | |
}), | |
], | |
targets: { | |
// The first part ('firefox-desktop' in this case) is just a name we give | |
// the specific browser target. You'll see this name in the reports generated | |
// as part of a happo run. | |
edge: new RemoteBrowserTarget('edge', { | |
viewport: '1024x768', | |
}), | |
'chrome-mobile': new RemoteBrowserTarget('chrome', { | |
viewport: '400x640', | |
}), | |
chrome: new RemoteBrowserTarget('chrome', { | |
viewport: '1024x768', | |
}), | |
safari: new RemoteBrowserTarget('safari', { | |
viewport: '1024x768', | |
}), | |
'internet explorer': new RemoteBrowserTarget('internet explorer', { | |
viewport: '1024x768', | |
}), | |
}, | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment