首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >软件包更新后Cypress e2e出现问题

软件包更新后Cypress e2e出现问题
EN

Stack Overflow用户
提问于 2021-01-21 23:51:20
回答 1查看 265关注 0票数 0

我有一个项目,我已经更新了所有的包。

在更新之前,所有e2e测试都按预期运行。

更新后,产品本身会按预期进行编译和运行。

然而,e2e测试在集成开发环境和运行时都显示了意外的问题。

例如,

代码语言:javascript
复制
 cy.checkA11y(
  {
    rules: {
      'aria-required-children': { enabled: false },
    },
  },
);

在集成开发环境中,cy.checkAlly给我一个错误,指出:

代码语言:javascript
复制
 TS2345: Argument of type '{ rules: { 'aria-required-children': { enabled: boolean; }; }; }' is not assignable to parameter of type 'Options'.   Object literal may only specify known properties, and 'rules' does not exist in type 'Options'.

然而,当查看源代码时,界面'Options‘扩展了axe.RunOptions,它确实有一个'RuleObject’类型的'rules‘条目,它本身具有以下结构:

代码语言:javascript
复制
 interface RuleObject {
    [key: string]: {
        enabled: boolean;
    };
}

毫不奇怪,当我尝试运行测试时,我也从Cypress那里得到了同样的错误,所以现在大多数测试都失败了。

我尝试过导入所需的Options类,但是编译器当然会报告该接口尚未从node_modules目录中导出。

我的包更改如下:

代码语言:javascript
复制
  @ag-grid-community/angular                         23.2.1  →    25.0.1
  @ag-grid-community/client-side-row-model           23.2.1  →    25.0.1
  @ag-grid-community/core                            23.2.1  →    25.0.1
  @ag-grid-enterprise/core                           23.2.1  →    25.0.1
  @ag-grid-enterprise/rich-select                    23.2.1  →    25.0.1
  @angular/animations                                11.0.5  →    11.1.0
  @angular/cdk                                       10.1.1  →    11.1.0
  @angular/cdk-experimental                          11.0.2  →    11.1.0
  @angular/common                                    11.0.5  →    11.1.0
  @angular/compiler                                  11.0.5  →    11.1.0
  @angular/core                                      11.0.5  →    11.1.0
  @angular/forms                                     11.0.5  →    11.1.0
  @angular/material                                  10.1.1  →    11.1.0
  @angular/platform-browser                          11.0.5  →    11.1.0
  @angular/platform-browser-dynamic                  11.0.5  →    11.1.0
  @angular/router                                    11.0.5  →    11.1.0
  @azure/msal-browser                                 2.1.0  →     2.9.0
  @azure/msal-common                                  1.2.0  →     2.1.0
  @graphile-contrib/pg-simplify-inflector             6.0.0  →     6.1.0
  @nestjs/common                                      7.3.2  →     7.6.5
  @nestjs/core                                        7.3.2  →     7.6.5
  @nestjs/graphql                                     7.4.1  →     7.9.6
  @nestjs/platform-express                            7.3.2  →     7.6.5
  @nestjs/serve-static                                2.1.3  →     2.1.4
  @nrwl/angular                                     11.0.16  →    11.1.5
  ajv                                                6.12.4  →     7.0.3
  apollo-angular                                      1.8.0  →     2.2.0
  apollo-angular-link-http                            1.9.0  →    1.11.0
  apollo-cache-inmemory                               1.6.0  →     1.6.6
  apollo-client                                       2.6.0  →    2.6.10
  apollo-link                                        1.2.11  →    1.2.14
  apollo-server-express                              2.11.0  →    2.19.2
  axios                                              0.21.0  →    0.21.1
  class-transformer                                   0.2.3  →     0.3.2
  class-validator                                    0.12.2  →    0.13.1
  core-js                                             3.6.4  →     3.8.3
  file-saver                                          2.0.2  →     2.0.5
  fs-extra                                            9.0.1  →     9.1.0
  graphile-build                                      4.7.0  →    4.10.0
  graphql                                            14.7.0  →    15.4.0
  graphql-middleware                                  4.0.2  →     6.0.2
  graphql-request                              2.1.0-next.1  →     3.4.0
  graphql-shield                                      7.4.2  →     7.5.0
  graphql-tag                                        2.10.3  →    2.11.0
  graphql-tools                                      6.0.10  →     7.0.2
  lodash                                            4.17.15  →   4.17.20
  msal                                                1.4.0  →     1.4.4
  node-mocks-http                                     1.9.0  →    1.10.1
  pako                                               1.0.11  →     2.0.3
  pg                                                  8.0.3  →     8.5.1
  pg-sql2                                             4.7.0  →     4.9.0
  postgraphile                                        4.7.0  →    4.10.0
  postgraphile-plugin-connection-filter               2.0.0  →     2.1.1
  rxjs                                                6.5.5  →     6.6.3
  tslib                                               2.0.0  →     2.1.0
  typeface-titillium-web                             0.0.72  →    1.1.13
  yargs                                              15.4.1  →    16.2.0
  zone.js                                            0.10.3  →    0.11.3
  @angular-devkit/build-angular                    0.1100.5  →  0.1101.0
  @angular-eslint/eslint-plugin                0.8.0-beta.6  →     1.1.0
  @angular-eslint/eslint-plugin-template       0.8.0-beta.6  →     1.1.0
  @angular-eslint/template-parser              0.8.0-beta.6  →     1.1.0
  @angular/cli                                       11.0.5  →    11.1.0
  @angular/compiler-cli                              11.0.5  →    11.1.0
  @angular/language-service                          11.0.5  →    11.1.0
  @graphql-codegen/cli                               1.15.4  →    1.20.0
  @graphql-codegen/typescript-apollo-angular         1.15.4  →     2.2.1
  @graphql-codegen/typescript-graphql-request        1.17.7  →     3.0.0
  @graphql-codegen/typescript-operations             1.15.4  →   1.17.13
  @nestjs/cli                                         7.4.1  →     7.5.4
  @nestjs/schematics                                  7.0.0  →     7.2.6
  @nestjs/testing                                     7.3.2  →     7.6.5
  @nrwl/cypress                                     11.0.16  →    11.1.5
  @nrwl/eslint-plugin-nx                            11.0.16  →    11.1.5
  @nrwl/jest                                        11.0.16  →    11.1.5
  @nrwl/nest                                        11.0.16  →    11.1.5
  @nrwl/node                                        11.0.16  →    11.1.5
  @nrwl/storybook                                   11.0.16  →    11.1.5
  @nrwl/workspace                                   11.0.16  →    11.1.5
  @storybook/addon-actions                           6.0.21  →    6.1.14
  @storybook/addon-controls                          6.0.21  →    6.1.14
  @storybook/angular                                 6.1.11  →    6.1.14
  @types/cypress-image-snapshot                       3.1.2  →     3.1.3
  @types/jest                                        26.0.7  →   26.0.20
  @types/lodash                                    4.14.158  →  4.14.168
  @types/node                                      12.12.38  →  14.14.22
  @types/pg                                          7.14.3  →    7.14.9
  @types/webpack                                    4.41.21  →   4.41.26
  @typescript-eslint/eslint-plugin                    4.3.0  →    4.14.0
  @typescript-eslint/parser                           4.3.0  →    4.14.0
  axe-core                                            3.5.5  →     4.1.1
  cross-env                                           7.0.2  →     7.0.3
  cypress                                             5.3.0  →     6.3.0
  cypress-axe                                         0.8.1  →    0.12.0
  cypress-image-snapshot                              3.1.1  →     4.0.0
  eslint                                              7.6.0  →    7.18.0
  eslint-config-prettier                              7.1.0  →     7.2.0
  eslint-plugin-jsdoc                                30.7.6  →    31.0.8
  husky                                               4.3.0  →     4.3.8
  jest                                               26.1.0  →    26.6.3
  jest-createspyobj                                   1.2.2  →     2.0.0
  jest-preset-angular                                 8.3.1  →     8.3.2
  prettier                                            2.0.5  →     2.2.1
  start-server-and-test                              1.11.2  →    1.11.7
  ts-json-schema-generator                           0.72.1  →    0.83.2
  typescript                                          4.0.3  →     4.0.5
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-01-22 03:52:08

在访问了axe-cypress的NPM页面后,终于找到了解决方案。

代码语言:javascript
复制
 cy.configureAxe( {
rules: {
  'aria-required-children': { enabled: false },
 },
});

cy.checkAlly();

现在我有了一组完全不同的问题,但我猜这超出了这个问题的范围。:)

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/65830974

复制
相关文章

相似问题

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