Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
1 contributor

Users who have contributed to this file

108 lines (93 sloc) 3.35 KB

Options

This plugin uses the options and options documentation from webdriver-image-comparison.

NOTE: Clicking on the links will open a new TAB

Plugin options

Plugin options are the options that can be set when the plugin is instantiated and can be found here. An example can be find below:

// wdio.conf.js
exports.config = {
    // ...
    // ========================
    // Native app compare setup
    // ========================
    services: [ 
        ['image-comparison', 
        // The options
        {
            // Some options, see the docs for more
            baselineFolder: join(process.cwd(), './tests/sauceLabsBaseline/'),
            formatImageName: '{tag}-{logName}-{width}x{height}',
            screenshotPath: join(process.cwd(), '.tmp/'),
            savePerInstance: true,
            autoSaveBaseline: true,
            blockOutStatusBar: true,
            blockOutToolBar: true,
            // ... more options
        }], 
    ],
    // ...
};

Method options

Methods options are the options that can be set per method. If the option has the same key as an options that has been set during the instantiation of the plugin, this method option will override the plugin option value. They can be found here.

An example for all methods can be found below:

describe('Example', () => {
  beforeEach(async () => {
    await browser.url();
  });
  
  it('should save some screenshots', () => {
  	// Save a screen
  	browser.saveScreen('examplePaged', {
  		disableCSSAnimation: true,
  		hideScrollBars: true,
  	});
  	
  	// Save an element
  	browser.saveElement($('.uk-button:nth-child(1)'), 'firstButtonElement', {
  		resizeDimensions: { 
  			top: 10, 
  			right: 5, 
  			bottom: 30, 
  			left: 10,
  		}
  	});
  	
  	// Save a full page screens
  	browser.saveFullPageScreen('fullPage', {
  		fullPageScrollTimeout: 3000,
  	});
  });
  
  it('should compare successful with a baseline', () => {
  	// Check a screen
  	expect(browser.checkScreen('examplePaged', {
  		blockOut: [ {
  				height: 10, 
  				width: 5, 
  				x: 40, 
  				y: 65
  			},{
  				height: 250, 
  				width: 500,
  				x: 0,
  				y: 35
  			},
  		],
  		ignoreAlpha: true,
  		blockOutStatusBar: true,
  	})).toEqual(0);
  	
  	// Check an element
  	expect(browser.checkElement($('.uk-button:nth-child(1)'), 'firstButtonElement', {
  		ignoreAntialiasing: true,
  		
  	})).toEqual(0);
  	
  	// Check a full page screens
  	expect(browser.checkFullPageScreen('fullPage', {
  		ignoreColors: true,
  	})).toEqual(0);
	});
});

Compare options

Compare options are the options that can be set during instantiation of the plugin or per method. If the options has the same key as an option that has been set during the instantiation of the plugin, the method compare option will override the plugin compare option value. They can be found here. The usage can be found above in the plugin and method examples.

You can’t perform that action at this time.