[英]Run test using Protractor and Appium on multiple devices
我正在嘗試在多個設備上運行量角器測試。
使用Appium的台式機瀏覽器和移動瀏覽器的配置不同。 有什么辦法可以混合兩種配置?
這是我的配置文件的內容:
1.“ 1-多個桌面瀏覽器”的主要配置
// conf.js
exports.config = {
framework: 'custom',
frameworkPath: require.resolve('protractor-cucumber-framework'),
cucumberOpts: {
require: 'features/step_definitions/*.step.js',
format: "summary"
},
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['features/*.feature'],
multiCapabilities: [
{
browserName: 'firefox'
},
/* TODO Safari is randomly failing (necessary restart safari and selenium server)
{
browserName: 'safari'
},*/
{
browserName: 'chrome'
},
{
browserName: 'chrome',
// List of devices https://cs.chromium.org/chromium/src/chrome/test/chromedriver/chrome/mobile_device_list.cc
'deviceName': 'Google Nexus 5'
},
{
browserName: 'chrome',
'deviceName': 'Apple iPhone 6'
},
{
browserName: 'chrome',
'deviceName': 'Apple iPad'
},
{
browserName: 'chrome',
'deviceName': 'Samsung Galaxy S4'
}
]
};
https://github.com/aluzardo/protractor-cucumber-tests/blob/master/conf.js
2.第一個移動設備Appium的配置
// conf-appium.js
exports.config = {
framework: 'custom',
frameworkPath: require.resolve('protractor-cucumber-framework'),
cucumberOpts: {
require: 'features/step_definitions/*.step.js',
format: "pretty"
},
seleniumAddress: 'http://localhost:4723/wd/hub',
specs: ['features/*.feature'],
capabilities: {
browserName: 'chrome',
'appium-version': '1.5.3',
platformName: 'Android',
platformVersion: '5.0.2',
deviceName: '33005bd56ac6c223'
}
};
https://github.com/aluzardo/protractor-cucumber-tests/blob/master/conf-appium.js
3.第二移動設備Appium的配置
// conf-appium-1.js
exports.config = {
framework: 'custom',
frameworkPath: require.resolve('protractor-cucumber-framework'),
cucumberOpts: {
require: 'features/step_definitions/*.step.js',
format: "pretty"
},
seleniumAddress: 'http://localhost:4747/wd/hub',
specs: ['features/*.feature'],
capabilities: {
browserName: 'chrome',
'appium-version': '1.5.3',
platformName: 'Android',
platformVersion: '4.2.2',
deviceName: '30048664b980c100'
}
};
https://github.com/aluzardo/protractor-cucumber-tests/blob/master/conf-appium-1.js
目前,我的測試正在運行,但是使用不同的conf.js文件並運行了各種appium服務器實例。
我需要在端口4444上運行selenium服務器,在端口4723上運行一個appium服務器,在端口4747上運行另一個appium服務器。並使用以下命令同時運行三個腳本:
protractor conf.js & protractor conf-appium.js & protractor conf-appium-1.js
通常,測試通過是成功的,但有時會出現此錯誤:
WebDriverError: An unknown server-side error occurred while processing the command. Original error: Could not proxy. Proxy error: Could not proxy command to remote server. Original error: Error: socket hang up
有沒有適當的方法來配置量角器和appium以在多個設備中運行測試?
據我了解,您僅在瀏覽器中通過Web和移動設備運行測試,那么為什么要完全使用appium? 您可以通過簡單地調整窗口大小來運行相同的測試。
我相信除非您從自動化角度介紹本機/混合應用程序,否則它是相同的。在極少數情況下(定位符更改)可以在頁面對象內單獨處理。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.