TestCafe Docker:由于ReactSelector

我通过向其添加testcafe-react-selector的安装来使用TestCafe docker修改的图像。运行测试时,出现以下错误:

1) action "selector" argument error:

  Selector is expected to be initialized with a function,CSS selector
  string,another Selector,node snapshot or a Promise returned by a
  Selector,but object was passed.

  Browser: Chrome 77.0.3865 / Linux 0.0.0

     119 |});
     120 |
     121 |test('Verify Project breakdown',async (t) => {
     122 |  await t
     123 |
  .click(accountManager.selectTestaccount('testaccount'))
   > 124 |    .click(homePage.dashboard)

我的测试:

    test('Verify Project breakdown',async (t) => {
  await t
    .click(accountManager.selectTestaccount('testaccount'))
    .click(homePage.dashboardIcon)

// homepage.js
this.dashboardIcon = ReactSelector('DashboardIcon');

如果将以上元素从ReactSelector更改为Selector,则它在docker环境中对我有效。

如果我在本地环境(TestCafe,Testcafe-react-selectors)中进行测试,则可以使用ReactSelector运行相同的测试。我不确定为什么不喜欢ReactSelector。我已经在很多地方使用过它,所以我不想将元素定位符更改为Selector

我也收到这样设置的灯具的错误:

.beforeEach(async (t) => {
await waitForReact();

运行测试后出现错误:

- Error in fixture.beforeEach hook -
  ClientFunction cannot implicitly resolve the test run in the context 
  of which it should be executed. If you need to call ClientFunction from
  the Node.js API callback,pass the test controller manually via
  ClientFunction's `.with({ boundTestRun: t })` method first. Note that 
  you cannot execute ClientFunction outside the test code.

  Browser: Chrome 77.0.3865 / Linux 0.0.0
  Screenshot:

TestCafe docker映像:

FROM testcafe/testcafe
# See https://github.com/DevExpress/testcafe/tree/master/docker

# We need root privileges to install new deps:
USER root

# Without this line `testcafe` and `testcafe-*-selectors` are not found:
ENV NODE_PATH=/opt:/usr/lib/node_modules:/opt/testcafe/node_modules

# Installing custom dependencies:
RUN cd /opt/testcafe && npm install \
    testcafe-react-selectors testcafe-reporter-html testcafe-reporter-xunit
narcisol 回答:TestCafe Docker:由于ReactSelector

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3157424.html

大家都在问