A utility function to run Cypress tests across multiple viewports
Clone or download
Latest commit 61e83e7 Dec 19, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore first commit Dec 14, 2018
README.md Update README.md Dec 14, 2018
index.js first commit Dec 14, 2018
package.json Patch Dec 19, 2018

README.md

cy-view

  • Run tests suite across multiple viewports

Installation

Install cy-view

$ npm i --save-dev cy-view

Usage

import cyView from 'cy-view';

const devices = [
	{
		model: 'macbook-15',
		width: 1440,
		height: 900
	},
	{
		model: 'ipad-2',
		width: 768,
		height: 1024
	},
	{
		model: 'iphone-6+',
		width: 414,
		height: 736
	}
];

// Add urls to test against
const urls = [
	'https://ao.com/product/idc8t3b-indesit-eco-time-condenser-tumble-dryer-white-38191-18.aspx',
	'https://ao.com/product/zwf01483wr-zanussi-lindo300-washing-machine-white-29672-1.aspx'
];

// Tell cy-view which devices you want to test on with an array of objects structured like the devices variable above
const washingMachinePageTests = cyView(devices);

// Pass your urls variable in and your good to go!
washingMachinePageTests(urls, () => {
	it('should blah blah blah...', () => {
		...assertions here!
	});
});