]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/src/eg2/CHEAT_SHEET.adoc
LP1615805 No inputs after submit in patron search (AngularJS)
[working/Evergreen.git] / Open-ILS / src / eg2 / CHEAT_SHEET.adoc
1 = Evergreen Angular App Cheatsheet
2
3 == Basics
4
5 [source,sh]
6 ---------------------------------------------------------------------
7 npm update
8 npm install
9 ng lint                              # check code formatting
10 npm run test                         # unit tests
11
12 # run end-to-end tests using Firefox
13 ng e2e                               # end-to-end tests, be sure to set
14                                      # MOZ_HEADLESS=1 if you aren't
15                                      # running x11
16
17 # run end-to-end tests using Chrome
18 npm install --save-dev chromedriver  # install ChromeDrive; you may
19                                      # need to tack on "@VERSION"
20                                      # to match the version of Chromium
21                                      # available to you
22 ng e2e --env chrome                  # ... if you have X11
23 ng e2e --env chrome-headless         # ... if you don't have X11
24
25
26 ng build --watch                     # compile dev mode
27 ng build --configuration=production  # compile production mode
28 ---------------------------------------------------------------------
29
30 == OPTIONAL: Adding a Locale 
31
32 * Using cs-CZ as an example.
33 * A cs-CZ configuration is supplied by default.  Additional configs
34   must be added where needed.
35 * Currently translation builds are only available on --prod build mode.
36 * Uncomment the locale lines in eg_vhost.conf and restart apache.
37 * TODO: expand docs on package.json file changes required to add locales.
38
39 === Exporting Source Strings
40
41 [source,sh]
42 ---------------------------------------------------------------------
43 npm run export-strings
44 ---------------------------------------------------------------------
45
46 * Then upload the messages.xmb file to the translation service
47
48 === Import and Build the Translation
49
50 1. Edit the "locales" array ./src/environments/environment.prod.ts to 
51    include cs-CZ.
52 2. Export translations as ".XTB" files from translation service.
53 3. Put the file in src/locale/messages.cs-CZ.xtb
54 4. Build the application for the selected locale by running:
55 [source,sh]
56 ---------------------------------------------------------------------
57 npm run build-cs-CZ
58 ---------------------------------------------------------------------
59
60 === Working with the e2e tests
61
62 * e2e tests run on https://nightwatchjs.org/[Nightwatch]
63 * New tests go into nightwatch/src and its subdirectories.  Their
64 filenames must end in .spec.ts to be picked up by the test runner.
65 * To run a single e2e test file, `npx nightwatch nightwatch/src/rest/of/path/my_spec.ts`.
66 You can add the `--verbose` flag, which is especially useful if you are
67 troubleshooting a selector.
68 * Also useful when you are troubleshooting: On a machine with a GUI,
69 add `browser.pause()` to your test just before the point where it is
70 failing, then run `npx nightwatch`.  This will provide you with
71 a breakpoint and a firefox browser you can use to investigate.
72 * The e2e tests do not have to be run on an Evergreen server.  You can
73 run them locally and point them to any non-production Evergreen
74 server you'd like, as long as it has the concerto data set loaded.
75 They default to looking for Evergreen URLs on
76 localhost, but you can change the domain by modifiying the
77 "evergreenRoot" setting in nightwatch.conf.js.
78 * These tests make real requests and do real work in the database.
79 Probably a good idea to reload the database between runs if
80 you have the time to do so: turn off opensrf, rerun the eg_db_config
81 support script, and turn opensrf back on.
82 * If you have some good hardware, you can run `npx nightwatch --parallel`
83 to run the tests in parallel and save some time.
84 * If you get the error "Profile not found" while running Firefox
85 installed from a snap package, you may be experiencing this known
86 issue with geckodriver: https://github.com/mozilla/geckodriver/releases/tag/v0.31.0 --
87 `mkdir $HOME/tmp; TMPDIR=$HOME/tmp ng e2e` should work.