SuiteCRM-Core/core/app/engine/README.md
2021-03-30 19:12:01 +01:00

3.4 KiB

SuiteCRM

This project was generated with Angular CLI version 7.3.4.

Development server

Run ng serve for a dev server. Navigate to http://localhost:4200/. The app will automatically reload if you change any of the source files.

Code scaffolding

Run ng generate component component-name to generate a new component. You can also use ng generate directive|pipe|service|class|guard|interface|enum|module.

Build

Run ng build to build the project. The build artifacts will be stored in the dist/ directory. Use the --prod flag for a production build.

Running unit tests

Run ng test to execute the unit tests via Karma.

Running end-to-end tests

Run ng e2e to execute the end-to-end tests via Protractor.

Further help

To get more help on the Angular CLI use ng help or go check out the Angular CLI README.

Creating in-build SVG files:

usage of svgbuild.js: node svgbuild.js [folder-of-svg-files] [svg-icon-template-html]

Creating local config:

Set your local specific changes in config-local.ts. See more in config-example.ts.

(Note: You can make more environment specific configuration and set your config class in config-class.ts.)

example for config-local.ts:

import { ConfigExample } from './config-example';

export class ConfigLocal extends ConfigExample {

    // add your local config overrides here..

    constructor() {
        super();

        // override the config variables separately:
        this.fakeApiUrls.fakeBaseUrl = 'http://localhost/scrm8/fakeapi.php?';
    }
}

Front End Testing

Front end tests are created to ensure the application runs as expected from start to finish for the end user

The Angular CLI downloads and install everything you need to test an Angular application with the Jasmine test framework

Running Tests

The project you create with the CLI is immediately ready to test

Simply run the CLI command:

ng test <project> [options] OR ng t <project> [options]

For full testing options, see: https://angular.io/cli/test#options

Karma configuration

Karma is the task runner for the tests written in Jasmine

There is a config created called karma.conf.js

The Angular CLI configuration of Karma uses the file “test.ts” as the entry point of the tests for the application

Within each component there is a test file where you add your unit test code

This will normally be automatically generated by the CLI as {component-name}.spec.ts as standard

Karma picks up files with extension '.spec.ts' as test files

End-To-End Testing

In addition to running standard tests, you can run end to end tests within the Angular CLI using:

ng e2e <project> [options] OR ng e <project> [options]

For full testing options, see: https://angular.io/cli/e2e#options

The end-to-end tests build and serve your Angular app, then run end-to-end tests using Protractor

This allows you to run end-to-end testing from a user's perspective

The tests ensure the application runs as expected from start to finish

As the tests run, you will see the browser interaction just as you would see it from the user perspective

To run the tests, Protractor depends on two files

The spec files inside the e2e folder and the 'protractor.conf.json' file