2017-03-17 104 views
0

如何使用Web組件測試器在BrowserStack上測試聚合物元素?我發現this demo但會話超時。使用BrowserStack測試聚合物

+0

我試過這個命令,並能夠運行樣本測試。 1. npm install 2. npm install bower 3. BROWSERSTACK_KEY = BROWSERSTACK_USER = node_modules/.bin/gulp wct:browserstack –

回答

0

我終於設法通過使用這一配置wct.conf.js來解決這個問題:

var path = require('path'); 

var ret = { 
    'webserver': { 
    'pathMappings': [] 
    } 
}; 

var mapping = {}; 
var rootPath = (__dirname).split(path.sep).slice(-1)[0]; 

mapping['/components/' + rootPath + 
'/app/bower_components'] = 'bower_components'; 

ret.webserver.pathMappings.push(mapping); 

/** 
* Adds BrowserStack config 
*/ 
function configBrowserStack(config) { 
    var user = process.env.BROWSERSTACK_USER; 
    var key = process.env.BROWSERSTACK_ACCESSKEY; 
    if (!user || !key) { 
    throw new Error('Missing BrowserStack credentials. Did you forget to set BROWSERSTACK_USER and/or BROWSERSTACK_KEY?'); 
    } 

    var url = process.env.BROWSERSTACK_URL 
    || 'https://' + user + ':' + key + '@hub.browserstack.com/wd/hub'; 

    var ALL_BROWSERS = require(__dirname + '/default-browserstack-browsers.json'); 
    var browsers = ALL_BROWSERS.map(function(b) { 
    b['browserstack.local'] = process.env.BROWSERSTACK_LOCAL; 
    b['browserstack.localidentifier'] = process.env.BROWSERSTACK_LOCAL_IDENTIFIER; 
    b['browserstack.build'] = process.env.BROWSERSTACK_BUILD; 
    b['url'] = url; 
    return b; 
    }); 

    config.activeBrowsers = config.activeBrowsers || []; 
    config.activeBrowsers = config.activeBrowsers.concat(browsers); 
} 

configBrowserStack(ret); 

module.exports = ret;