/angularjs-inventory

Angularjs 1.7.x starter project - Inventory management system

Primary LanguageJavaScript

Angular Js test Project

Development

Before you can build this project, you must install and configure your machine.

We use Node.js to run a development web server and build the project. Depending on your system, you can install Node either from source or as a pre-packaged bundle.

After installing Node, you should be able to run the following command to install development tools (like Bower and BrowserSync. You will only need to run this command when dependencies change in package.json.

npm install

For non OS X users

npm install --no-optional

We use Bower for our third-party client libraries. Install the Bower-controlled apps with:

bower install

We use Gulp as our build system. Install the Gulp command-line tool globally with:

npm install -g gulp

Run the following command terminal to create a blissful development experience where your browser auto-refreshes when files change on your hard drive.

gulp

Run following command to inject vendors if needed

gulp inject:vendor

Bower is used to manage CSS and JavaScript dependencies used in this application. You can upgrade dependencies by specifying a newer version in bower.json. You can also run bower update and bower install to manage dependencies. Add the -h flag on any command to see how you can use it. For example, bower update -h.

Configuring environment

Copy the example configuration file to .env:

cp .env.example .env

Then edit that file to contain the URL of the API instance you wish to use.

Building (and serving) for development

gulp serve

Building for production

gulp build

Testing

Unit tests are run by Karma and written with Jasmine.

gulp test

More details on unit testing here: https://github.com/inventory/client/wiki/Unit-Tests-(Karma---Jasmine)

E2E (End-to-End) tests

npm install --TYFY_ENV='local'

gulp itest

or 

gulp itest --suite = account

where `account` is suite name. Test Suites can be configured in `protractor.config.js`

Locale/Translations

  1. Test/compare locale files - compares locale directory with en default locale directory and check if there are missing keys. Below command will report all missing keys in terminal.
gulp locale:test

Note - This task is recommended to execute before you push any change.

  1. Update missing keys. Below command will add missing keys in locale file with key value - VALUE_FOR_KEY_MISSING
gulp locale:update
  1. Create new locale directory that will clone files from default locale directory en and update value of each key to VALUE_FOR_KEY_MISSING
gulp locale:create --name="en1"

Also, need to add newly created locale in src/app/components/language/language.constants.js file.

    .constant('TFY_LOCALE', {
      locales: ['en', 'es','nl','pt','vi','zh','en1'],
      mapping: {
        'en-*': 'en',
        'es-*': 'es',
        'nl-*': 'nl',
        'pt-*': 'pt',
        'zh-*': 'zh',
        'en1-*': 'en1'
      }
    })
  1. add language to locale compare script
    • go to gulp/locale.js
    • go to line number 3 - const localesDirs = ['es', 'nl', 'pt-br', 'pt', 'vi', 'zh'];
    • add language key in an array const localesDirs = ['es', 'nl', 'pt-br', 'pt', 'vi', 'zh', 'en1'];

File & directories:

  • File /src/test/protractor.config.js. All protractor, jasmine2 and testcases configurations.
  • /src/test/e2e : Test suites and helper files
  • Write commonly used helper function in /src/test/e2e/helper.js
  • Write custom hook in /src/test/e2e/customHooks.js
  • Write custom hook in /src/test/e2e/customHooks.js

References & Guielines:

Continuous Integration

  • Post-build Actions
    • Publish Test Report XML: build/reports/e2e/*.xml`

Known Issues

  • When update to latest Node version

Node Sass does not yet support your current environment (macOS 10.12.1, Node 7.0.0)

Solution:

npm cache clean --force npm rebuild node-sass

  • Quill does not contains dist files when installed with Bower ?
    bower install quill=https://github.com/quilljs/quill/releases/download/v1.3.5/quill.tar.gz --save

language codes

http://can-translate.appspot.com/languages.js