@testplane/safari-commands
v1.0.0
Published
Plugin for Testplane to add/wrap browser commands for iOS safari
Downloads
4
Readme
@testplane/safari-commands
Plugin for Testplane which is intended to add/wrap browser commands in order to work properly with the iOS safari browser.
You can read more about Testplane plugins here.
Installation
npm install @testplane/safari-commands
Usage
Plugin has following configuration:
- enabled (optional)
Boolean
– enable/disable the plugin, by default plugin is enabled; - browsers (required)
Object
- the list of browsers to use for wrap commands;- commands (required)
Array
- commands which will be wrapped. - nativeElementsSize (optional)
Object
- the map of native elements sizes for the browser. Sizes in pixels without counting the pixel ratio. Can be used in order to speed up taking screenshots;- topToolbar (required)
Object
- the size of the top toolbar;- width (required)
Number
- the width of the top toolbar; - height (required)
Number
- the height of the top toolbar;
- width (required)
- bottomToolbar (required)
Object
- the size of the bottom toolbar;- width (required)
Number
- the width of the bottom toolbar; - height (required)
Number
- the height of the bottom toolbar;
- width (required)
- webview (required)
Object
- the size of the webview;- width (required)
Number
- the width of the webview; - height (required)
Number
- the height of the webview;
- width (required)
- topToolbar (required)
- commands (required)
Also there is ability to override plugin parameters by CLI options or environment variables
(see configparser).
Use testplane_safari_commands_
prefix for the environment variables and --testplane-safari-commands-
for the cli options.
Add plugin to your testplane
config file:
module.exports = {
// ...
system: {
plugins: {
'@testplane/safari-commands': {
enabled: true,
browsers: {
safari13: {
commands: [
'url',
'click',
'screenshot',
'orientation',
'swipe',
'touch',
'dragAndDrop'
],
nativeElementsSize: {
topToolbar: {
height: 47,
width: 390
},
bottomToolbar: {
height: 113,
width: 390
},
webview: {
height: 654,
width: 390
}
}
}
}
}
}
},
//...
}
Existing safari commands:
Wrappers over existing commands:
- url - wrapper over wdio "url" in order to wait until the page is completely open (used timeout from
testplane.pageLoadTimeout
or30000
ms). In appium-xcuitest-driver page is open with using thexcrun
utility -xcrun simctl openurl
which just tells the simulator to open the page and does not wait anything; - click - replaces wdio "click" in order to perform real touch click (by default it emits only events on passed element). Should be used with touch command;
- screenshot - wrapper of wdio "screenshot" in order to cut the native elements from the final image (calibration must be turned off);
- orientation - wrapper of wdio "orientation" in order to recalculate size of native elements for "screenshot" command (turns on automatically when you specify a screenshot command);
- swipe - replaces wdio "swipe" in order to perform swipe by coordinates in native context;
- touch - replaces wdio "touch" in order to perform touch click by coordinates in native context;
- dragAndDrop - replaces wdio "dragAndDrop" in order to perform drag and drop elements by coordinates in native context.
Commands to work with native elements:
- deviceClickBack - command to click back button on device, which closes the current tab and returns to the previous one.
Testing
Run mocha tests:
npm run test-unit
Run eslint codestyle verification
npm run lint