Angular-6 Protractor E2E test: Chrome crash issue - protractor

I am running e2e test in simple angular-6 application just have basic application,
though it is always giving me below error,
protractor.conf.js:
// Protractor configuration file, see link for more information
// https://github.com/angular/protractor/blob/master/lib/config.ts
const { SpecReporter } = require('jasmine-spec-reporter');
exports.config = {
allScriptsTimeout: 11000,
specs: [
'./src/**/*.e2e-spec.ts'
],
capabilities: {
'browserName': 'chrome'
},
directConnect: true,
baseUrl: 'http://localhost:4200/',
framework: 'jasmine',
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000,
print: function() {}
},
onPrepare() {
require('ts-node').register({
project: require('path').join(__dirname, './tsconfig.e2e.json')
});
jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
}
};
tsconfig.e2e.json:
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/app",
"module": "commonjs",
"target": "es5",
"types": [
"jasmine",
"jasminewd2",
"node"
]
}
}
angular.json:
{
"$schema": "./node_modules/#angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"Angular6App": {
"root": "",
"sourceRoot": "src",
"projectType": "application",
"prefix": "app",
"schematics": {},
"architect": {
"build": {
"builder": "#angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/Angular6App",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.app.json",
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"src/styles.css"
],
"scripts": []
},
"configurations": {
"production": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true
}
}
},
"serve": {
"builder": "#angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "Angular6App:build"
},
"configurations": {
"production": {
"browserTarget": "Angular6App:build:production"
}
}
},
"extract-i18n": {
"builder": "#angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "Angular6App:build"
}
},
"test": {
"builder": "#angular-devkit/build-angular:karma",
"options": {
"main": "src/test.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.spec.json",
"karmaConfig": "src/karma.conf.js",
"styles": [
"src/styles.css"
],
"scripts": [],
"assets": [
"src/favicon.ico",
"src/assets"
]
}
},
"lint": {
"builder": "#angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"src/tsconfig.app.json",
"src/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
]
}
}
}
},
"Angular6App-e2e": {
"root": "e2e/",
"projectType": "application",
"architect": {
"e2e": {
"builder": "#angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "e2e/protractor.conf.js",
"devServerTarget": "Angular6App:serve"
},
"configurations": {
"production": {
"devServerTarget": "Angular6App:serve:production"
}
}
},
"lint": {
"builder": "#angular-devkit/build-angular:tslint",
"options": {
"tsConfig": "e2e/tsconfig.e2e.json",
"exclude": [
"**/node_modules/**"
]
}
}
}
}
},
"defaultProject": "Angular6App"
}
app.po.ts:
import { browser, by, element } from 'protractor';
export class AppPage {
navigateTo() {
return browser.get('/');
}
getParagraphText() {
return element(by.css('app-root h1')).getText();
}
}
app.e2e-spec.ts:
import { AppPage } from './app.po';
describe('workspace-project App', () => {
let page: AppPage;
beforeEach(() => {
page = new AppPage();
});
it('should display welcome message', () => {
page.navigateTo();
expect(page.getParagraphText()).toEqual('Welcome to Angular6App!');
});
});
I have tried to run app using ng serve then it is working fine. But while running test ng e2e it shows message chrome crash.
So someone knows about how to fix this issue?

Related

Definition for rule '#nrwl/nx/nx-plugin-checks' was not found

Using NX v14.1.4, I'm trying to run linting on a lib that contains a custom executor and I get this error.
My config is:
{
"extends": ["../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {}
},
{
"files": ["*.ts", "*.tsx"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"rules": {}
},
{
"files": ["./package.json", "./generators.json", "./executors.json"],
"parser": "jsonc-eslint-parser",
"rules": {
"#nrwl/nx/nx-plugin-checks": "error"
}
}
]
}
The parent config is
{
"root": true,
"ignorePatterns": ["**/*"],
"plugins": ["#nrwl/nx"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {
"#nrwl/nx/enforce-module-boundaries": [
"error",
{
"enforceBuildableLibDependency": true,
"allow": [],
"depConstraints": [
{
"sourceTag": "*",
"onlyDependOnLibsWithTags": ["*"]
}
]
}
]
}
},
{
"files": ["*.ts", "*.tsx"],
"extends": ["plugin:#nrwl/nx/typescript"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"extends": ["plugin:#nrwl/nx/javascript"],
"rules": {}
},
{
"files": "*.json",
"parser": "jsonc-eslint-parser",
"rules": {}
}
]
}

Ionic AppFlow builds in development instead of production mode

I'm using the Ionic AppFlow Live Update deployment feature without problems but the build is made using the development environment instead of production. I have a similar app using Live Update that builds correctly in production environment and I can't find any differences in the configuration of both apps.
I have two environment files:
environment.prod.ts
environment.ts
and the app is using the environment.ts configuration, which is for development.
I can install correctly the app in production mode in a device through USB using:
$ ionic cap copy --configuration=production
$ ionic cap open android
How can I force AppFlow to use the production environment for the build?
package.json:
{
"name": "app-name",
"version": "0.3.2",
"author": "John Doe",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
...
}
ionic.config.json
{
"name": "app-name",
"integrations": {
"capacitor": {}
},
"type": "angular"
}
angular.json
{
"$schema": "./node_modules/#angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"app": {
"root": "",
"sourceRoot": "src",
"projectType": "application",
"prefix": "app",
"schematics": {},
"architect": {
"build": {
"builder": "#angular-devkit/build-angular:browser",
"options": {
"outputPath": "www",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.app.json",
"baseHref": "/",
"assets": [
{
"glob": "**/*",
"input": "src/assets",
"output": "assets"
},
{
"glob": "**/*.svg",
"input": "node_modules/ionicons/dist/ionicons/svg",
"output": "./svg"
},
"src/manifest.webmanifest",
"src/manifest.webmanifest",
"src/manifest.webmanifest"
],
"styles": ["src/theme/variables.scss", "src/global.scss"],
"scripts": [],
"aot": false,
"vendorChunk": true,
"extractLicenses": false,
"buildOptimizer": false,
"sourceMap": true,
"optimization": false,
"namedChunks": true,
"serviceWorker": true,
"ngswConfigPath": "ngsw-config.json"
},
"configurations": {
"production": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"budgets": [
{
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "5mb"
}
]
},
"ci": {
"progress": false
}
}
},
"serve": {
"builder": "#angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "app:build"
},
"configurations": {
"production": {
"browserTarget": "app:build:production"
},
"ci": {
"progress": false
}
}
},
"extract-i18n": {
"builder": "#angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "app:build"
}
},
"test": {
"builder": "#angular-devkit/build-angular:karma",
"options": {
"main": "src/test.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.spec.json",
"karmaConfig": "karma.conf.js",
"styles": [],
"scripts": [],
"assets": [
{
"glob": "favicon.ico",
"input": "src/",
"output": "/"
},
{
"glob": "**/*",
"input": "src/assets",
"output": "/assets"
},
"src/manifest.webmanifest",
"src/manifest.webmanifest",
"src/manifest.webmanifest"
]
},
"configurations": {
"ci": {
"progress": false,
"watch": false
}
}
},
"lint": {
"builder": "#angular-eslint/builder:lint",
"options": {
"lintFilePatterns": [
"src/**/*.ts",
"src/**/*.html"
]
}
},
"e2e": {
"builder": "#angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "e2e/protractor.conf.js",
"devServerTarget": "app:serve"
},
"configurations": {
"production": {
"devServerTarget": "app:serve:production"
},
"ci": {
"devServerTarget": "app:serve:ci"
}
}
}
}
}
},
"cli": {
"schematicCollections": [
"#ionic/angular-toolkit"
]
},
"schematics": {
"#ionic/angular-toolkit:component": {
"styleext": "scss"
},
"#ionic/angular-toolkit:page": {
"styleext": "scss"
}
}
}
I realized that because I'm using the free AppFlow version there is no Environments option. So I changed the build script to:
"build": "ng build --configuration=production",
and it worked.
In the Basic Plan and above, you can create environments and environments variables, as described in the official documentation.

VS Code Breakpoints get disabled when starting the app

I'm setting breakpoints into my code (Windows 10). There are red.
When I do ng serve, there stay red.
When I start debugging (F5 or play button) there switch to grey circles with hint "Unbound breakpoint".
I searched the net and find many suggestions to change settings here and there and I dried them, but it does not solve the problem. Also the breakpoints was working with tis project on a different laptop. I did not change any settings of the app.
You got any idea to solve this behavior?
My angular.json
{
"$schema": "./node_modules/#angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"feature": {
"root": "",
"sourceRoot": "src",
"projectType": "application",
"prefix": "app",
"schematics": {},
"architect": {
"build": {
"builder": "#angular-devkit/build-angular:browser",
"options": {
"progress": false,
"aot": true,
"outputPath": "dist",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.app.json",
"preserveSymlinks": true,
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"src/assets/css/bootstrap.min.css",
"src/assets/css/font-awesome.css",
"src/styles.css"
],
"scripts": [
],
"vendorChunk": true,
"extractLicenses": false,
"buildOptimizer": false,
"sourceMap": true,
"optimization": false,
"namedChunks": true
},
"configurations": {
"production": {
"index": {
"input": "src/index.prod.html",
"output": "index.html"
},
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"namedChunks": false,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"budgets": [
{
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "5mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "6kb",
"maximumError": "10kb"
}
]
}
}
},
"serve": {
"builder": "#angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "feature:build"
},
"configurations": {
"production": {
"browserTarget": "feature:build:production"
}
}
},
"extract-i18n": {
"builder": "#angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "feature:build"
}
},
"lint": {
"builder": "#angular-eslint/builder:lint",
"options": {
"lintFilePatterns": [
"src/**/*.ts",
"src/**/*.html"
]
}
}
}
}
},
"defaultProject": "feature"
}
My launch.json:
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "pwa-chrome",
"request": "launch",
"name": "Launch Chrome against localhost",
"url": "http://localhost:4200",
"webRoot": "${workspaceFolder}"
}
]
}
I changed at the launch.json to:
"webRoot": "${workspaceFolder}/ClientApp"
And it works now.

Requirements check failed for JDK 1.8 in ionic on ionic cordova build android

I am working on ionic 4,
Where I am trying to create build for Android on using ionic
cordova build android
But creating build for Android failed because of following reason
-- >
Android Studio project detected
ANDROID_HOME=/Users/user/Library/Android/sdk
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-11.jdk/Contents/Home
Requirements check failed for JDK 1.8
Details for java
java version
users-MacBook-Pro-3:library user$ java -version
java version "11" 2018-09-25
Java(TM) SE Runtime Environment 18.9 (build 11+28)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11+28, mixed mode)
- Details of My Mac os
Macbook pro late 2011
os installed - Ox x ei caption
angular.json file
{
"$schema": "./node_modules/#angular-devkit/core/src/workspace/workspace-schema.json",
"version": 1,
"defaultProject": "app",
"newProjectRoot": "projects",
"projects": {
"app": {
"root": "",
"sourceRoot": "src",
"projectType": "application",
"prefix": "app",
"schematics": {},
"architect": {
"build": {
"builder": "#angular-devkit/build-angular:browser",
"options": {
"outputPath": "www",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.app.json",
"assets": [
{
"glob": "**/*",
"input": "src/assets",
"output": "assets"
},
{
"glob": "**/*.svg",
"input": "node_modules/ionicons/dist/ionicons/svg",
"output": "./svg"
}
],
"styles": [
{
"input": "src/theme/variables.scss"
},
{
"input": "src/global.scss"
}
],
"scripts": [],
"es5BrowserSupport": true
},
"configurations": {
"production": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"budgets": [
{
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "5mb"
}
]
},
"ci": {
"progress": false
}
}
},
"serve": {
"builder": "#angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "app:build"
},
"configurations": {
"production": {
"browserTarget": "app:build:production"
},
"ci": {
"progress": false
}
}
},
"extract-i18n": {
"builder": "#angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "app:build"
}
},
"test": {
"builder": "#angular-devkit/build-angular:karma",
"options": {
"main": "src/test.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.spec.json",
"karmaConfig": "src/karma.conf.js",
"styles": [],
"scripts": [],
"assets": [
{
"glob": "favicon.ico",
"input": "src/",
"output": "/"
},
{
"glob": "**/*",
"input": "src/assets",
"output": "/assets"
}
]
},
"configurations": {
"ci": {
"progress": false,
"watch": false
}
}
},
"lint": {
"builder": "#angular-devkit/build-angular:tslint",
"options": {
"tsConfig": ["src/tsconfig.app.json", "src/tsconfig.spec.json"],
"exclude": ["**/node_modules/**"]
}
},
"ionic-cordova-build": {
"builder": "#ionic/angular-toolkit:cordova-build",
"options": {
"browserTarget": "app:build"
},
"configurations": {
"production": {
"browserTarget": "app:build:production"
}
}
},
"ionic-cordova-serve": {
"builder": "#ionic/angular-toolkit:cordova-serve",
"options": {
"cordovaBuildTarget": "app:ionic-cordova-build",
"devServerTarget": "app:serve"
},
"configurations": {
"production": {
"cordovaBuildTarget": "app:ionic-cordova-build:production",
"devServerTarget": "app:serve:production"
}
}
}
}
},
"app-e2e": {
"root": "e2e/",
"projectType": "application",
"architect": {
"e2e": {
"builder": "#angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "e2e/protractor.conf.js",
"devServerTarget": "app:serve"
},
"configurations": {
"ci": {
"devServerTarget": "app:serve:ci"
}
}
},
"lint": {
"builder": "#angular-devkit/build-angular:tslint",
"options": {
"tsConfig": "e2e/tsconfig.e2e.json",
"exclude": ["**/node_modules/**"]
}
}
}
}
},
"cli": {
"defaultCollection": "#ionic/angular-toolkit"
},
"schematics": {
"#ionic/angular-toolkit:component": {
"styleext": "scss"
},
"#ionic/angular-toolkit:page": {
"styleext": "scss"
}
}
}
Both:
java -version
and:
javac -version
should be Java 8. Either can be changed on Linux (Debian) by running:
sudo update-alternatives --config java
or:
sudo update-alternatives --config javac
You have installed Java JDK version 11. For ionic cordova you need JDK 8.
Read Installing the Requirements.
You can download JDK 8 here

App won't stay in Portrait mode in Trigger.io

Running an app in iOS6 right now and it won't stay in landscape mode for iPhone/iPad devices. I've checked the docs and other-related questions but can't find an answer. I believe we're following the docs, so, maybe we've got some incorrect formatting. Here's the config, which I've only stripped out identifying/key/hash info:
{
"config_version": "2",
"name": "appname",
"author": "author-email",
"version": "0.1",
"platform_version": "v1.4.50",
"description": "description goes here",
"partners": {
"parse": {
"applicationId": "id",
"clientKey": "clientkeyishere",
"parseRestKey": "parsekey"
}
},
"modules": {
"requirements": {
"ios": {
"minimum_version": "4.3",
"device_family": "iphone"
}
},
"icons": {
"android": {
"36": "res/icons/android/ldpi.png",
"48": "res/icons/android/mdpi.png",
"72": "res/icons/android/hdpi.png",
"96": "res/icons/android/xhdpi.png"
},
"ios": {
"57": "res/icons/ios/icon_iphone#1x.png",
"72": "res/icons/ios/icon_ipad#1x.png",
"114": "res/icons/ios/icon_iphone#2x.png",
"144": "res/icons/ios/icon_ipad#2x.png",
"512": "res/icons/ios/icon_512.png"
}
},
"launchimage": {
"iphone": "res/splash/ios/siren_splash#1x.png",
"iphone-retina": "res/splash/ios/siren_splash#2x.png",
"iphone-retina4": "res/splash/ios/siren_splash_iphone_tall.png",
"ipad": "res/splash/ios/siren_splash_ipad_tall#1x.png",
"ipad-landscape": "res/splash/ios/siren_splash_ipad_wide#1x.png",
"ipad-retina": "res/splash/ios/siren_splash_ipad_tall#2x.png",
"ipad-landscape-retina": "res/splash/ios/siren_splash_ipad_wide#1x.png",
"android": "res/splash/android/android_logo.png",
"android-landscape": "res/splash/android/android_logo.png",
"background-color": "#000000"
},
"package_names": {
"ios": "packagenameishere"
},
"display": {
"orientation": {
"default": "portrait",
"iphone": "portrait",
"ipad": "portrait",
"android": "portrait"
}
},
"geolocation": true,
"logging": {
"level": "DEBUG"
},
"request": {
"permissions": [
"http://*/*",
"https://*/*"
]
},
"contact": true,
"file": true,
"is": true,
"media": {},
"prefs": true,
"tools": true,
"reload": true,
"parameters": {
"api": "apigoeshere"
}
},
"plugins": {
"rate": {
"hash": "hashishere",
"type": "project"
}
}
}
You might want to try this formatting, I think it changes from time to time.
This is with Toolkit v2.0.1
Works for me.
{
"modules": {
"display": {
"config": {
"orientations": {
"android": "portrait",
"ipad": "portrait",
"iphone": "portrait"
}
},
"version": "2.2"
}
}
}
Full example from my working config:
{
"author": "",
"config_version": "4",
"core": {
"general": {
"reload": true
},
"ios": {
"device_family": "iphone",
"minimum_version": "4.3",
"package_name": ""
}
},
"description": "",
"homepage": "",
"modules": {
"contact": {
"disabled": true,
"version": "2.2"
},
"display": {
"config": {
"orientations": {
"android": "portrait",
"ipad": "portrait",
"iphone": "portrait"
}
},
"version": "2.2"
},
"file": {
"version": "2.2"
},
"flurry": {
"config": {
"ios_api_key": ""
},
"version": "2.3",
"disabled": true
},
"geolocation": {
"version": "2.0"
},
"icons": {
"config": {
"ios": {
"57": "assets/graphic/icons/icon-57.png",
"72": "assets/graphic/icons/icon-72.png",
"76": "assets/graphic/icons/AppIcon76x76.png",
"114": "assets/graphic/icons/icon-114.png",
"120": "assets/graphic/icons/AppIcon60x60#2x.png",
"144": "assets/graphic/icons/icon-144.png",
"152": "assets/graphic/icons/AppIcon76x76#2x.png",
"512": "assets/graphic/icons/icon-512.png",
"prerendered": true
}
},
"version": "2.1"
},
"launchimage": {
"config": {
"ios": {
"1536x2048": "assets/graphic/splash/1536x2048-splash.png",
"320x480": "assets/graphic/splash/320x480-splash.png",
"640x1136": "assets/graphic/splash/640x1136-splash.png",
"2048x1536": "assets/graphic/splash/2048x1536-splash.png",
"1536x2008": "assets/graphic/splash/1536x2008-splash.png",
"1024x768": "assets/graphic/splash/1024x768-splash.png",
"2048x1496": "assets/graphic/splash/2048x1496-splash.png",
"1024x748": "assets/graphic/splash/1024x748-splash.png",
"640x960": "assets/graphic/splash/640x960-splash.png",
"768x1004": "assets/graphic/splash/768x1004-splash.png",
"768x1024": "assets/graphic/splash/768x1024-splash.png"
}
},
"version": "2.1"
},
"media": {
"config": {},
"disabled": true,
"version": "2.1"
},
"notification": {
"version": "2.2"
},
"parse": {
"config": {
"applicationId": "",
"clientKey": ""
},
"version": "2.0"
},
"prefs": {
"version": "2.0"
},
"request": {
"config": {
"permissions": [
"http://*/*",
"https://*/*"
]
},
"version": "2.3"
},
"sms": {
"version": "2.0"
},
"tabbar": {
"disabled": true,
"version": "2.1"
},
"tabs": {
"version": "2.4"
},
"urlhandler": {
"config": {
"scheme": ""
},
"version": "2.0"
},
"topbar": {
"version": "2.2"
}
},
"name": "",
"platform_version": "v2.0.1",
"version": ""
}