ranger-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Csaba Koncz <csabako...@gmail.com>
Subject Re: Review Request 69067: RANGER-2255 JavaScript tests for UI loading
Date Thu, 03 Jan 2019 14:04:40 GMT


> On Jan. 1, 2019, 9:49 a.m., Zsombor Gegesy wrote:
> > Any particular reason, why these tests are added to the 'src/main/webapp/tests'
folder, instead under 'src/test/javascript'? This way, these js files are added to the webapp,
isn't it?

The latest patch has the tests in the tests folder.

The webapp folder was convenient because the test/production codes had the same relative location
both before and after the packaging phase.

By keeping the tests in the tests folder I had to tweak the Karma and RequireJS configurations
to be able to load the production code from both the src (during the test phase) and target
folders (during the the verify phase).


- Csaba


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/69067/#review211591
-----------------------------------------------------------


On Jan. 3, 2019, 1:43 p.m., Csaba Koncz wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/69067/
> -----------------------------------------------------------
> 
> (Updated Jan. 3, 2019, 1:43 p.m.)
> 
> 
> Review request for ranger.
> 
> 
> Bugs: RANGER-2255
>     https://issues.apache.org/jira/browse/RANGER-2255
> 
> 
> Repository: ranger
> 
> 
> Description
> -------
> 
> Added JavaScript testing infrastructure (Karma, Mocha, PhantomJS) and a basic test to
verify that both the initial uncompressed JavaScript module tree and the minified version
can be loaded by a browser.
> 
> There are two test (Karma) configurations that correspond to the two module loading methods.
> 
> Later on more sophisticated tests can be added that mock backend services and do "real"
business logic testing.
> 
> 
> Diffs
> -----
> 
>   security-admin/pom.xml c67860115 
>   security-admin/src/main/webapp/index.html 4eb97353b 
>   security-admin/src/main/webapp/minify.build.js 4b94bb159 
>   security-admin/src/main/webapp/package-lock.json f7a72833f 
>   security-admin/src/main/webapp/package.json 9f2274445 
>   security-admin/src/main/webapp/scripts/Init.js 52b49e5fb 
>   security-admin/src/main/webapp/scripts/Main.js 941414618 
>   security-admin/src/test/javascript/karma-common.conf.js PRE-CREATION 
>   security-admin/src/test/javascript/karma-dev.conf.js PRE-CREATION 
>   security-admin/src/test/javascript/karma-prd.conf.js PRE-CREATION 
>   security-admin/src/test/javascript/test-main.js PRE-CREATION 
>   security-admin/src/test/javascript/tests/main-test.js PRE-CREATION 
> 
> 
> Diff: https://reviews.apache.org/r/69067/diff/4/
> 
> 
> Testing
> -------
> 
> Executed mvn clean verify. The output contained the following:
> 
> [INFO] --- frontend-maven-plugin:1.6:npm (npm run karma dev) @ security-admin-web ---
> [INFO] Running 'npm run karma -- start security-admin-web-2.0.0-SNAPSHOT/tests/karma-dev.conf.js'
in /Users/ckoncz/work/git/hwx/ranger/security-admin/target
> [INFO]
> [INFO] > security-admin@2.0.0 karma /Users/ckoncz/work/git/hwx/ranger/security-admin/target
> [INFO] > karma "start" "security-admin-web-2.0.0-SNAPSHOT/tests/karma-dev.conf.js"
> [INFO]
> [INFO] 17 10 2018 21:32:26.799:WARN [watcher]: Pattern "/Users/ckoncz/work/git/hwx/ranger/security-admin/target/security-admin-web-2.0.0-SNAPSHOT/node_modules/chai/chai.js"
does not match any file.
> [INFO] 17 10 2018 21:32:26.802:WARN [watcher]: Pattern "/Users/ckoncz/work/git/hwx/ranger/security-admin/target/security-admin-web-2.0.0-SNAPSHOT/node_modules/karma-requirejs/lib/adapter.js"
does not match any file.
> [INFO] 17 10 2018 21:32:26.944:INFO [karma]: Karma v3.0.0 server started at http://0.0.0.0:9876/
> [INFO] 17 10 2018 21:32:26.944:INFO [launcher]: Launching browser PhantomJS with unlimited
concurrency
> [INFO] 17 10 2018 21:32:26.949:INFO [launcher]: Starting browser PhantomJS
> [INFO] 17 10 2018 21:32:27.792:INFO [PhantomJS 2.1.1 (Mac OS X 0.0.0)]: Connected on
socket PKDEs28ja09HLFyLAAAA with id 27321101
>        LOG: 'just before loading Main'
> [INFO] PhantomJS 2.1.1 (Mac OS X 0.0.0): Executed 0 of 1 SUCCESS (0 secs / 0 secs)
>        LOG: 'initialize a Communicator'
>        LOG: 'Initialize a Region Manager'
> [INFO] PhantomJS 2.1.1 (Mac OS X 0.0.0): Executed 0 of 1 SUCCESS (0 secs / 0 secs)
> [INFO] 17 10 2018 21:32:28.788:WARN [web-server]: 404: /service/users/profile?_=1539804747867
> [INFO] 17 10 2018 21:32:28.827:WARN [web-server]: 404: /images/avatar.png
>        LOG: 'initialize a Controller Controller'
> [INFO] PhantomJS 2.1.1 (Mac OS X 0.0.0): Executed 0 of 1 SUCCESS (0 secs / 0 secs)
>        LOG: 'initialized a TopNav ItemView'
>        LOG: 'initialized a ProfileBar ItemView'
>        LOG: 'initialized a Footer ItemView'
>        LOG: 'Error in service/plugins/checksso REST call404'
>        LOG: 'initialized a ErrorView ItemView'
>        LOG: 'mainModule.success=false'
>        PhantomJS 2.1.1 (Mac OS X 0.0.0): Executed 1 of 1 SUCCESS (0.966 secs / 0.958
secs)
> [INFO] TOTAL: 1 SUCCESS
> [INFO]
> [INFO] --- frontend-maven-plugin:1.6:npm (npm run karma prd) @ security-admin-web ---
> [INFO] Running 'npm run karma -- start security-admin-web-2.0.0-SNAPSHOT/tests/karma-prd.conf.js'
in /Users/ckoncz/work/git/hwx/ranger/security-admin/target
> [INFO]
> [INFO] > security-admin@2.0.0 karma /Users/ckoncz/work/git/hwx/ranger/security-admin/target
> [INFO] > karma "start" "security-admin-web-2.0.0-SNAPSHOT/tests/karma-prd.conf.js"
> [INFO]
> [INFO] 17 10 2018 21:32:29.524:WARN [watcher]: Pattern "/Users/ckoncz/work/git/hwx/ranger/security-admin/target/security-admin-web-2.0.0-SNAPSHOT/node_modules/chai/chai.js"
does not match any file.
> [INFO] 17 10 2018 21:32:29.527:WARN [watcher]: Pattern "/Users/ckoncz/work/git/hwx/ranger/security-admin/target/security-admin-web-2.0.0-SNAPSHOT/node_modules/karma-requirejs/lib/adapter.js"
does not match any file.
> [INFO] 17 10 2018 21:32:29.671:INFO [karma]: Karma v3.0.0 server started at http://0.0.0.0:9876/
> [INFO] 17 10 2018 21:32:29.671:INFO [launcher]: Launching browser PhantomJS with unlimited
concurrency
> [INFO] 17 10 2018 21:32:29.686:INFO [launcher]: Starting browser PhantomJS
> [INFO] 17 10 2018 21:32:30.560:INFO [PhantomJS 2.1.1 (Mac OS X 0.0.0)]: Connected on
socket yzaLy1GMCrq06Z5DAAAA with id 31360149
>        LOG: 'just before loading Main'
> [INFO] PhantomJS 2.1.1 (Mac OS X 0.0.0): Executed 0 of 1 SUCCESS (0 secs / 0 secs)
> [INFO] 17 10 2018 21:32:30.771:WARN [web-server]: 404: /service/plugins/csrfconf
> [INFO] 17 10 2018 21:32:30.781:WARN [web-server]: 404: /service/users/profile?_=1539804750660
> [INFO] 17 10 2018 21:32:30.805:WARN [web-server]: 404: /images/avatar.png
>        LOG: 'initialize a Communicator'
> [INFO] PhantomJS 2.1.1 (Mac OS X 0.0.0): Executed 0 of 1 SUCCESS (0 secs / 0 secs)
>        LOG: 'Initialize a Region Manager'
>        LOG: 'initialize a Controller Controller'
>        LOG: 'initialized a TopNav ItemView'
>        LOG: 'initialized a ProfileBar ItemView'
>        LOG: 'initialized a Footer ItemView'
>        LOG: 'Error in service/plugins/checksso REST call404'
>        LOG: 'initialized a ErrorView ItemView'
>        LOG: 'mainModule.success=false'
>        PhantomJS 2.1.1 (Mac OS X 0.0.0): Executed 1 of 1 SUCCESS (0.145 secs / 0.132
secs)
> [INFO] TOTAL: 1 SUCCESS
> [INFO]
> [INFO] --- maven-war-plugin:2.6:war (default-war) @ security-admin-web ---
> [INFO] Packaging webapp
> [INFO] Assembling webapp [security-admin-web] in [/Users/ckoncz/work/git/hwx/ranger/security-admin/target/security-admin-web-2.0.0-SNAPSHOT]
> [INFO] Processing war project
> [INFO] Webapp assembled in [356 msecs]
> [INFO] Building war: /Users/ckoncz/work/git/hwx/ranger/security-admin/target/security-admin-web-2.0.0-SNAPSHOT.war
> [INFO]
> 
> 
> I.e. Karma was launched two times and and each time a single test was successfully executed.
> There are also logs that indicate that JavaScript application startup was triggered.
However, this could not succeed because of missing backend services.
> 
> 
> Thanks,
> 
> Csaba Koncz
> 
>


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message