DevExpress/angular-testcafe

Builder does not finish after tests run in Angular 14

RochDawid opened this issue · 15 comments

After tests run (no matter if they pass or fail), execution doesn't halt in Angular 14. Cloning your project worked (Angular 13). Here is my configuration: { "$schema": "./node_modules/@angular/cli/lib/config/schema.json", "version": 1, "newProjectRoot": "projects", "projects": { "usermgmt": { "projectType": "application", "schematics": { "@schematics/angular:component": { "style": "scss" }, "@schematics/angular:application": { "strict": true } }, "root": "", "sourceRoot": "src", "prefix": "app", "architect": { "build": { "builder": "ngx-build-plus:browser", "options": { "outputPath": "dist", "index": "src/index.html", "main": "src/main.ts", "polyfills": "src/polyfills.ts", "tsConfig": "tsconfig.app.json", "inlineStyleLanguage": "scss", "assets": [ "src/favicon.ico", "src/assets", "src/silent-refresh.html" ], "styles": ["src/styles.scss"], "scripts": [], "allowedCommonJsDependencies": ["color"], "extraWebpackConfig": "webpack.config.js", "commonChunk": false }, "configurations": { "production": { "budgets": [ { "type": "initial", "maximumWarning": "5mb", "maximumError": "5mb" }, { "type": "anyComponentStyle", "maximumWarning": "2kb", "maximumError": "4kb" } ], "fileReplacements": [ { "replace": "src/environments/environment.ts", "with": "src/environments/environment.prod.ts" } ], "outputHashing": "all", "extraWebpackConfig": "webpack.prod.config.js" }, "development": { "buildOptimizer": false, "optimization": false, "vendorChunk": true, "extractLicenses": false, "sourceMap": true, "namedChunks": true } }, "defaultConfiguration": "production" }, "serve": { "builder": "ngx-build-plus:dev-server", "configurations": { "production": { "browserTarget": "usermgmt:build:production", "extraWebpackConfig": "webpack.prod.config.js" }, "development": { "browserTarget": "usermgmt:build:development", "proxyConfig": "proxy.conf.json" } }, "defaultConfiguration": "development", "options": { "port": 4201, "publicHost": "http://localhost:4201", "extraWebpackConfig": "webpack.config.js" } }, "extract-i18n": { "builder": "ngx-build-plus:extract-i18n", "options": { "browserTarget": "usermgmt:build", "extraWebpackConfig": "webpack.config.js" } }, "test": { "builder": "@angular-devkit/build-angular:karma", "options": { "main": "src/test.ts", "polyfills": "src/polyfills.ts", "tsConfig": "tsconfig.spec.json", "karmaConfig": "karma.conf.js", "codeCoverage": true, "inlineStyleLanguage": "scss", "assets": ["src/favicon.ico", "src/assets"], "styles": ["src/styles.scss"], "scripts": [] } }, "e2e": { "builder": "angular-testcafe:testcafe", "options": { "devServerTarget": "usermgmt:serve", "browsers": ["chrome:headless --no-sandbox"], "src": ["e2e/*.ts"], "skipJsErrors": true, "reporters": [ { "name": "spec" }, { "name": "xunit", "output": "report.xml" } ] } } } } } }

Hi @RochDawid,

Thank you for submitting this issue. We would love to assist you and diagnose it. However, we need a simple sample that we can easily run on our side in order to replicate the issue and research its cause. Without a sample, we are not able to figure out what's going on and why this issue occurs. Refer to this article to create the best example: How To: Create a Minimal Working Example When You Submit an Issue. We look forward to your response.

Hi @RochDawid, Hi @AlexSkorkin,
I am facing the same issue. I could reproduce it by just updating the dependencies in your "demo-app". But it occures on my side in every application that depends on Angular 14.

This is my updated package.json form "demo-app"

{
  "name": "demo-app",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "lint": "ng lint",
    "e2e": "ng e2e -c passing"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^14.1.3",
    "@angular/common": "^14.1.3",
    "@angular/compiler": "^14.1.3",
    "@angular/core": "^14.1.3",
    "@angular/forms": "^14.1.3",
    "@angular/platform-browser": "^14.1.3",
    "@angular/platform-browser-dynamic": "^14.1.3",
    "@angular/router": "^14.1.3",
    "rxjs": "~7.5.6",
    "tslib": "^2.3.0",
    "zone.js": "~0.11.4"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^14.1.3",
    "@angular-eslint/builder": "14.0.2",
    "@angular-eslint/eslint-plugin": "14.0.2",
    "@angular-eslint/eslint-plugin-template": "14.0.2",
    "@angular-eslint/schematics": "14.0.2",
    "@angular-eslint/template-parser": "14.0.2",
    "@angular/cli": "^14.1.3",
    "@angular/compiler-cli": "^14.1.3",
    "@angular/language-service": "13.0.1",
    "@types/node": "^18.7.8",
    "@types/webpack-env": "^1.16.0",
    "@typescript-eslint/eslint-plugin": "5.3.0",
    "@typescript-eslint/parser": "5.3.0",
    "angular-testcafe": "file:..",
    "eslint": "^8.2.0",
    "ts-node": "~8.10.2",
    "tslint": "~6.1.3",
    "typescript": "~4.7.4"
  }
}

I hope you can reproduce it also.
Thank you very much.

Hi @helloworld121,

Thank you for the description. I reproduced the issue. We will update this thread once we have any news.

Hi @Aleksey28,

There is a small workaround, which is not completely eliminate the issue, but, at least, the builder coming back after approx. 30 sec, even if it does not work perfectly. It might be good idea anyway to "close" testcafe instance after execution. See the diff below:

diff --git a/src/testcafe/testcafe.builder.ts b/src/testcafe/testcafe.builder.ts
index a8543fd..a92e885 100644
--- a/src/testcafe/testcafe.builder.ts
+++ b/src/testcafe/testcafe.builder.ts
@@ -69,7 +69,7 @@ async function runTestcafe (opts: TestcafeBuilderOptions, hostName): Promise<unk
             speed:                opts.speed,
             stopOnFirstFail:      opts.stopOnFirstFail,
             pageRequestTimeout:   opts.pageRequestTimeout,
-        });
+        }).finally(() => { testCafe.close(); });
 }

Hi @yklymenko,

Thank you for the workaround.

Any update on this issue? I've just updated our app to NG14, but this problem is really holding me up.

In addition to the workaround proposed by @yklymenko I can confirm that stopping the runner also works:

.finally(() => { runner.stop(); })

@bvklingeren
No updates yet. Once we get any results, we will post them in this thread.

So, if I may ask, why not implement one of the workarounds for the time being, to have a working solution for users?

Hi @bvklingeren

This workaround may potentially lead to a number of other issues and result in unpredictable behavior. Thus, we cannot add it to the testcafe code.

@Aleksey28
This is a major problem. Angular 14 was released a year ago, now we have Angular 16 and still no solution.
Provided workaround is working for me. Anyway i don't get why you don't want to create for example 3.1.0-beta as an "temporary solution" to make it somehow working. Instead almost a year Builder is not usable on Angular 14+

@Aleksey28

This is a major problem. Angular 14 was released a year ago, now we have Angular 16 and still no solution.

Provided workaround is working for me. Anyway i don't get why you don't want to create for example 3.1.0-beta as an "temporary solution" to make it somehow working. Instead almost a year Builder is not usable on Angular 14+

The solution that worked for me was:

  • Migrate to Cypress😎

@MarcinRabczynski, we do not support the simultaneous publication of different versions of TestCafe. Therefore, it would be inappropriate to publish a workaround in one version and neglect to include it in another version. At present, we cannot give any estimates on when the issue will be fixed.

This issue has been automatically marked as stale because it has not had any activity for a long period. It will be closed and archived if no further activity occurs. However, we may return to this issue in the future. If it still affects you or you have any additional information regarding it, please leave a comment and we will keep it open.

We're closing this issue after a prolonged period of inactivity. If it still affects you, please add a comment to this issue with up-to-date information. Thank you.