首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >电子应用程序在测试执行服务器上不完全可见

电子应用程序在测试执行服务器上不完全可见
EN

Stack Overflow用户
提问于 2021-06-17 11:03:20
回答 1查看 210关注 0票数 0

我一直有一些问题,成功地执行我的黄瓜方案,因为,由于一些未知的原因,我们正在测试的电子应用程序没有完全显示(表中缺少一列在右边)。出于某种原因,这种情况只发生在我们的windows测试执行服务器上,而不是在我的本地笔记本上。服务器解析为1920x1080。测试通过Azure DevOps Server管道启动。

我们测试的电子应用程序通过谱与黄瓜-js框架的类型记录。

代码语言:javascript
复制
import * as path from 'path';

import { Application } from 'spectron';

import * as settings from './globalvars';

export const SUT = new Application({
  path: `${settings.sutExecutablePath}`,
  args: [path.join(__dirname, '../'), '--headless', '--window-size=1920,1080'],
  env: {
    RUNNING_IN_SPECTRON: true,
    XXXXXX_DEV_TOOLS: false,
    SPECTRON_AUTOMATION_VARS: settings.testDataIndex
  },
  chromeDriverArgs: ['--headless', '--window-size=1920,1080', 'resolution=1920x1080', 'resolution: 1920x1080', '--width=1920', '--height=1080'],
  chromeDriverLogPath: path.join(settings.reportPath, 'chromedriver.log'),
  waitTimeout: settings.spectronDefaultImplicitWaitTimeout
});

我一直在胡闹:

更改窗口大小maximized

  • adding chromeDriverArgs

  • ....

参数wo webdriverOptions的窗口大小

这些更改似乎对应用程序的启动方式没有任何影响,事实上,更改窗口大小或最大限度地启动它对我的笔记本电脑也没有任何影响。

这是色驱动程序日志的片段。必须把它编辑一下,但还是有用的。

代码语言:javascript
复制
[1623923272.920][INFO]: Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
[1623923272.989][INFO]: [c56aabc7011e3a87307e2b8d55b9f003] COMMAND InitSession {
   "capabilities": {
      "alwaysMatch": {
         "goog:chromeOptions": {
            "args": [ "spectron-path=c:\\xxxx\\xxxx\\win-unpacked\\xxxxxx.exe", "spectron-arg0=C:\\git\\xxxxx\\02-sxxxx\\", "spectron-env-RUNNING_IN_SPECTRON=true", "spectron-env-xxxxx_DEV_TOOLS=false", "spectron-env-SPECTRON_AUTOMATION_VARS=C:\\git\\xxxx.xxxxxx\\automation-vars.json", "--window-size=800,600" ],
            "binary": "C:\\git\\xxxx\\02-xxxxxx\\node_modules\\spectron\\lib\\launcher.bat",
            "windowTypes": [ "app", "webview" ]
         }
      },
      "firstMatch": [ {

      } ]
   },
   "desiredCapabilities": {
      "goog:chromeOptions": {
         "args": [ "spectron-path=c:\\xxxxx\\xxxxxxx\\win-unpacked\\xxxxxx.exe", "spectron-arg0=C:\\git\\xxxxxx\\02-xxxxxxx\\", "spectron-env-RUNNING_IN_SPECTRON=true", "spectron-env-xxxxxxxx_DEV_TOOLS=false", "spectron-env-SPECTRON_AUTOMATION_VARS=C:\\git\\xxxxxx\\automation-vars.json", "--window-size=800,600" ],
         "binary": "C:\\git\\xxxxx\\02-xxxxxxxxxxxmodules\\spectron\\lib\\launcher.bat",
         "windowTypes": [ "app", "webview" ]
      }
   }
}

[1623923272.994][INFO]: Launching chrome: "C:\git\xxxxxxxx\02-xxxxxxx\node_modules\spectron\lib\launcher.bat" --disable-background-networking --disable-client-side-phishing-detection --disable-default-apps --disable-hang-monitor --disable-popup-blocking --disable-prompt-on-repost --disable-sync --enable-automation --enable-blink-features=ShadowDOMV0 --enable-logging --log-level=0 --no-first-run --no-service-autorun --password-store=basic --remote-debugging-port=0 --spectron-arg0="C:\git\xxxxxxxxx\02-xxxxxxx\\" --spectron-env-running_in_spectron=true --spectron-env-xxxxx_dev_tools=false --spectron-env-spectron_automation_vars="C:\git\xxxxxxxx\automation-vars.json" --spectron-path="c:\bxxxxxxx\xxxxxxxxxx\win-unpacked\xxxxxxx.exe" --test-type=webdriver --use-mock-keychain --user-data-dir="C:\Users\xxxxx\AppData\Local\Temp\scoped_dir33580_700219467" --window-size=800,600 data:,
[1623923273.323][DEBUG]: DevTools HTTP Request: http://localhost:54323/json/version
[1623923273.637][DEBUG]: DevTools HTTP Response: {

   "Browser": "Chrome/87.0.4280.141",

   "Protocol-Version": "1.3",

   "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) xxxxxxxx/1.0.0-alpha.2022 Chrome/87.0.4280.141 Electron/11.2.2 Safari/537.36",

   "V8-Version": "8.7.220.31",

   "WebKit-Version": "537.36 (@5236eb7c7e51a459c497e4ab474bf474ad7000ef)",

   "webSocketDebuggerUrl": "ws://localhost:54323/devtools/browser/62881ab4-ea89-4b48-b75e-4234f709931b"

}


[1623923273.637][DEBUG]: DevTools HTTP Request: http://localhost:54323/json/list
[1623923273.639][DEBUG]: DevTools HTTP Response: [ {

   "description": "",

   "devtoolsFrontendUrl": "/devtools/inspector.html?ws=localhost:54323/devtools/page/30283E47D490358108E12219527675CE",

   "id": "30283E47D490358108E12219527675CE",

   "title": "index.html",

   "type": "page",

   "url": "file:///C:/xxxxxxxxx/xxxxxxxxx/win-unpacked/resources/app.asar/build/index.html",

   "webSocketDebuggerUrl": "ws://localhost:54323/devtools/page/30283E47D490358108E12219527675CE"

} ]
代码语言:javascript
复制
"test:inProgress": "node ./node_modules/cucumber/bin/cucumber-js feature-files/*.feature --format summary --format progress-bar --format node_modules/cucumber-pretty --logLevel=error --require step-definitions/**/*.ts --require-module ts-node/register --require support/*.ts --format json:../reports/02-xxxx/cucumber-report.json --format node_modules/cucumber-junit-formatter:../reports/02-xxxx/testresults.junit --format-options '{\"scenarioAsStep\":true}' --tags \"@inProgress\"",
代码语言:javascript
复制
    "devDependencies": {
    "@cucumber/cucumber": "^7.0.0",
    "@types/chai": "^4.2.14",
    "@types/cucumber": "^6.0.1",
    "@types/jsonpath": "^0.2.0",
    "@types/xml2js": "^0.4.8",
    "@typescript-eslint/eslint-plugin": "^4.4.0",
    "@typescript-eslint/parser": "^4.4.0",
    "chai": "^4.2.0",
    "cucumber": "^6.0.5",
    "cucumber-html-reporter": "^5.3.0",
    "cucumber-junit-formatter": "^0.2.2",
    "cucumber-pretty": "^6.0.0",
    "date-fns": "^2.21.3",
    "electron": "^10.0.0",
    "eslint": "^7.11.0",
    "eslint-config-prettier": "^7.1.0",
    "eslint-plugin-import": "^2.22.1",
    "eslint-plugin-prettier": "^3.3.1",
    "filecompare": "^1.0.4",
    "jsonpath": "^1.1.0",
    "prettier": "2.2.0",
    "spectron": "^13.0.0",
    "ts-node": "^9.1.1",
    "typescript": "^4.1.3",
    "xml2js": "^0.4.23"
  },```
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-06-28 07:24:44

对于将来可能遇到这个问题的人来说。解决我的问题是很基本的。只需手动设置客户端应用程序的界限。

代码语言:javascript
复制
SUT.browserWindow.setSize(1920, 1080);
SUT.browserWindow.setPosition(0, 0);
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/68018053

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档