karma-safari-applescript-launcher
A karma launcher for Safari and SafariTechPreview
Maintenance Status: Stable
Installation
Install karma-safari-applescript-launcher
$ npm install --save-dev karma-safari-applescript-launcher
Usage
By default this plugin will be added to the plugins array for your karma config as it starts with karma-
. If you mess with the plugins array in your karma config you may have to include in manually:
// include just this launcher plugins: 'karma-safari-applescript-launcher' // or include a custom plugin and all karma-* plugins plugins: 'my-custom-one' 'karma-*'
Then you can add Safari
and SafariTechPreview
to your browsers array in your karma config:
browsers: 'Safari' 'SafariTechPreview'
You may also want to consider using karma-detect-browsers as that will automatically add these browsers when they are detected.
How it works
Everything in this module is done via the run-applescript module. Which runs applescript to control Safari and Safari Technology Preview on Mac OSX.
How it "starts"
When karma asks us to open the testing url we check if Safari or Safari Technology Preview is open. If it is we know not to close in when karma is finished. Then we open the url that karma asked us to open.
How it "finishes"
When karma tells to browser to "close" we close all Safari/Safari Technology Preview tabs that match the url that we were asked to open. Then we check if Safari/Safari Technology Preview was open before we started testing. If it was open, we do nothing. If it was not open we close Safari/Safari Technology Preview.
License
Apache-2.0. Copyright (c) Brightcove, Inc.