Typescript e2e测试在docker中失败,但在本地通过

Typescript e2e测试在docker中失败,但在本地通过,typescript,selenium,docker,protractor,ui-automation,Typescript,Selenium,Docker,Protractor,Ui Automation,我正试图通过circle ci在docker image中运行e2e测试 在7项测试中,6项测试失败,1项测试通过。 但当我在本地运行它们时,所有测试都通过了 这就是我得到的错误 ✗ Should Display Dashboard Header and Loan Information - Failed: No element found using locator: By(css selector, h3[class="sprk-b-TypeDisplayFour sprk-o-

我正试图通过circle ci在docker image中运行e2e测试

在7项测试中,6项测试失败,1项测试通过。 但当我在本地运行它们时,所有测试都通过了

这就是我得到的错误

✗ Should Display Dashboard Header and Loan Information
      - Failed: No element found using locator: By(css selector, h3[class="sprk-b-TypeDisplayFour sprk-o-Stack__item sprk-u-Color--white"])
          at elementArrayFinder.getWebElements.then (/home/circleci/project/node_modules/protractor/built/element.js:814:27)
          at ManagedPromise.invokeCallback_ (/home/circleci/project/node_modules/selenium-webdriver/lib/promise.js:1376:14)
          at TaskQueue.execute_ (/home/circleci/project/node_modules/selenium-webdriver/lib/promise.js:3084:14)
          at TaskQueue.executeNext_ (/home/circleci/project/node_modules/selenium-webdriver/lib/promise.js:3067:27)
          at asyncRun (/home/circleci/project/node_modules/selenium-webdriver/lib/promise.js:2927:27)
          at /home/circleci/project/node_modules/selenium-webdriver/lib/promise.js:668:7
          at <anonymous>
          at process._tickCallback (internal/process/next_tick.js:189:7)Error
          at ElementArrayFinder.applyAction_ (/home/circleci/project/node_modules/protractor/built/element.js:459:27)
          at ElementArrayFinder.(anonymous function).args [as getText] (/home/circleci/project/node_modules/protractor/built/element.js:91:29)
          at ElementFinder.(anonymous function).args [as getText] (/home/circleci/project/node_modules/protractor/built/element.js:831:22)
          at Dashboard.getDashboardHeaderText (/home/circleci/project/e2e/app/loan/dashboard/dashboard.po.ts:47:41)
          at Object.<anonymous> (/home/circleci/project/e2e/app/loan/dashboard/dashboard.e2e-spec.ts:18:30)
          at step (/home/circleci/project/node_modules/tslib/tslib.js:133:27)
          at Object.next (/home/circleci/project/node_modules/tslib/tslib.js:114:57)
          at /home/circleci/project/node_modules/tslib/tslib.js:107:75
          at new Promise (<anonymous>)
          at Object.__awaiter (/home/circleci/project/node_modules/tslib/tslib.js:103:16)
      From: Task: Run it("Should Display Dashboard Header and Loan Information") in control flow
          at UserContext.<anonymous> (/home/circleci/project/node_modules/jasminewd2/index.js:94:19)
          at 
✗ 应显示仪表板标题和贷款信息
-失败:使用locator:By(css选择器,h3[class=“sprk-b-TypeDisplayFour sprk-o-Stack\uUu项目sprk-u-Color--white”])未找到任何元素
在elementArrayFinder.getWebElements.then(/home/circleci/project/node_modules/dragrator/build/element.js:814:27)
在ManagedPromise.invokeCallback上(/home/circleci/project/node_modules/selenium webdriver/lib/promise.js:1376:14)
在TaskQueue.execute处(/home/circleci/project/node_modules/selenium webdriver/lib/promise.js:3084:14)
在TaskQueue.executeNext上(/home/circleci/project/node\u modules/selenium webdriver/lib/promise.js:3067:27)
异步运行时(/home/circleci/project/node_modules/selenium webdriver/lib/promise.js:2927:27)
at/home/circleci/project/node_modules/selenium webdriver/lib/promise.js:668:7

目前

信息如此之少,我们无法为您提供太多帮助。您是否从容器中获取了截图/视频/HTML转储?调试完成了吗?我想分享你的Dockerfile可能会有帮助。您是如何运行量角器的(它是selenium网格吗?您只是在使用selenium服务器吗?等等)?哪些测试失败?你的docker实例是否真的慢到超时?可能是元素没有加载,所以你需要禁用waitForAngular并添加一些睡眠-这是我的猜测。当本地量角器将您的应用程序识别为Angular应用程序时,可能会发生这种情况,但对于已部署的应用程序,不会发生这种情况。但是,您的问题需要更多关于实现的细节。在元素之后使用thread.sleep(20000),看看它是否有效,如果有效,您将需要使用如此少的信息实现一些健壮的等待,我们可以为您做的不多。您是否从容器中获取了截图/视频/HTML转储?调试完成了吗?我想分享你的Dockerfile可能会有帮助。您是如何运行量角器的(它是selenium网格吗?您只是在使用selenium服务器吗?等等)?哪些测试失败?你的docker实例是否真的慢到超时?可能是元素没有加载,所以你需要禁用waitForAngular并添加一些睡眠-这是我的猜测。当本地量角器将您的应用程序识别为Angular应用程序时,可能会发生这种情况,但对于已部署的应用程序,不会发生这种情况。但是,您的问题需要更多关于实现的细节。在元素之后使用thread.sleep(20000),看看它是否有效,如果有效,您将需要实现一些健壮的等待