javascript - 实习生 JS + Saucelabs : Does not start session when using firefox browser

标签 javascript firefox intern ui-testing saucelabs

我最近开始使用 Intern js 和 Saucelabs 进行 ui 测试。想要在所有浏览器中进行测试,显然 Firefox 也不排除。

这是我的 gruntfile 配置:

        runner: {
            options: {
                config: 'tests/intern',
                runType: 'runner',
                sauceAccessKey: '<my key>',
                sauceUsername: '<my username>',
                environments: [
                   /* {
                        name: 'chrome',
                        browserName: 'chrome',
                        version: [ '52.0' ],
                        platform: [ 'Windows 7', 'OS X 10.10' ]
                    },*/
                    {
                        browserName: 'firefox',
                        platform: ['Windows 8', 'OS X 10.9'],
                        marionette: true 
                    },
                    /*{
                        browserName: 'internet explorer',
                        version: [ '11.0' ],
                        platform: ['Windows 7']
                    }*/
                ]
            }
        }

这是 intern.js:

define({

    capabilities: {
        'selenium-version': '2.46.0'
    },

    maxConcurrency: 3,

    tunnel: 'SauceLabsTunnel',
    tunnelOptions: {
        drivers: ['chrome', 'firefox']
    },

    useSauceConnect: false,

    // Configuration options for the module loader; any AMD configuration options supported by the Dojo loader can be
    // used here

    // Non-functional test suite(s) to run in each browser
    suites: [  ],

    // Functional test suite(s) to run in each browser once non-functional tests are completed
    functionalSuites: [ 'tests/first' ],

    // A regular expression matching URLs to files that should not be included in code coverage analysis
    excludeInstrumentation: /^/
});

用chrome和IE测试(实际上IE8也有一些问题!!)工作正常。当使用 grunt intern 运行时,实际发生的情况是:

Listening on 0.0.0.0:9000                                                                                                                                                                                 
Tunnel started                                                                                                                                                                                            
‣ Created session chrome 40 on Windows 7 (8773c63bf5a4469e8d92db57e6f51b63)                                                                                                                               
✓ chrome 40 on Windows 7 - index - toppage (2.969s)                                                                                                                                                       
No unit test coverage for chrome 40 on Windows 7                                                                                                                                                          
>> chrome 40 on Windows 7: 0/1 tests failed                                                                                                                                                               

‣ Created session chrome 46 on OS X 10.10 (b2ffbb9a639d4515a51b758ae382a1cf)                                                                                                                              
✓ chrome 46 on OS X 10.10 - index - toppage (3.514s)                                                                                                                                                      
No unit test coverage for chrome 46 on OS X 10.10                                                                                                                                                         
>> chrome 46 on OS X 10.10: 0/1 tests failed 
>> TOTAL: tested 2 platforms, 0/2 tests failed                                                                                                                                                            
Goodbye.                                                                                                                                                                                                  
Done.  

但是当我尝试使用 Firefox(我也尝试使用旧版本)时,输出如下:

Listening on 0.0.0.0:9000                                                                                                                                                                                 
Tunnel started   

看来实习生之类的东西无法与 Firefox 启动 session 。 当我在 Saucelabs 仪表板中看到并尝试观看实时视频时,我在 Firefox 中看到什么都没有发生,除了地址栏中有 mozilla.org/... 且网页显示“无法建立安全连接” ”。一段时间后,浏览器将重新启动。这种情况发生了好几次。

隧道继续运行,没有任何反应。

请大家指导一下,是否有任何配置错误?或者配置不足?

提前致谢。

最佳答案

我认为问题可能与您的环境配置有关。我正在使用以下内容,测试在 Sauce Labs 上按预期进行。

environments: [
    { browserName: 'chrome', version: '51.0', platform: 'Windows 7' },
    { browserName: 'internet explorer', version: '11.0', platform: 'Windows 7' },
    { browserName: 'firefox', version: '45.0', platform: 'Windows 8.1' },
    { browserName: 'firefox', version: '46.0', platform: 'Windows 10' }
],

此外,我发现指定 2.50 之前的“selenium-version”也会导致错误。我建议转向以下内容:

capabilities: {
    'selenium-version': '2.53.0',
},

关于javascript - 实习生 JS + Saucelabs : Does not start session when using firefox browser,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39245658/

相关文章:

python-3.x - 如何将 Firefox cookie 导入 python 请求

css - Firefox 上的 SVG 图像模糊

javascript - 如何在浏览器上运行实习生框架

javascript - 单击下拉菜单显示 div 内容

javascript - 关于唯一 ID 的数据结构最佳实践

java - 通过 JSF 中的 java 脚本启用/禁用按钮

javascript - 为什么 Firefox 打印后不重定向?

javascript - Intern/Leadfoot 超时功能的区别

javascript - 如何将 Intern 与 TypeScript 和 webpack 结合使用?

javascript - 在Javascript中获取重力形式AJAX确认消息而不是输出