Front end testing with CleverStack

posted in: AngularJS, Cleverstack, Testing | 0

What is Protractor and how to use it, for reference:

Create a new project:

clever init clever-walking-skeleton-10.0/

  Creating installation path /Users/nomad/Projects/clever-walking-skeleton-10.0/...
  Finding seeds to target for installation...
  Starting installation...

Installing Backend...
  Installation path is /Users/nomad/Projects/clever-walking-skeleton-10.0/backend...
  Downloading and extracting node-seed...
  Creating local configuration file config/local.json...
  Installing NPM modules...
  Installing bundledDependencies...
  Backend installation has completed successfully!

Installing Frontend...
  Installation path is /Users/nomad/Projects/clever-walking-skeleton-10.0/frontend...
  Downloading and extracting angular-seed...
  Installing NPM modules...
  Installing bundled modules...
  Installing bower components...
  Building frontend...
  Frontend installation has completed successfully.
  Installing protractor...
  Protractor successfully installed...

Project clever-walking-skeleton-10.0/ has been created in /Users/nomad/Projects/clever-walking-skeleton-10.0/

Delete the backend directory.

Edit this file:


  // The location of the selenium standalone server .jar file.
  // seleniumServerJar: './scripts/selenium-server-standalone-2.39.0.jar',
  // The port to start the selenium server on, or null if the server should
  // find its own unused port.
  // seleniumPort: 4444,
  seleniumAddress: 'http://localhost:4444/wd/hub',
  // Chromedriver location is used to help the selenium standalone server
  // find chromedriver. This will be passed to the selenium jar as
  // the system property If null, selenium will
  // attempt to find chromedriver using PATH.
  // chromeDriver: isWin ? './scripts/Chromedriver.exe' : './scripts/Chromedriver',
  // Additional command line options to pass to selenium. For example,
  // if you need to change the browser timeout, use
  // seleniumArgs: ['-browserTimeout=60'],
  seleniumArgs: [],


Go into the frontend folder
cd frontend/


clever test unit
Scanning folders for Gruntfiles...
Running "karma:unit" (karma) task
INFO [karma]: Karma v0.10.10 server started at http://localhost:9090/
INFO [launcher]: Starting browser Chrome
INFO [launcher]: Starting browser PhantomJS
WARN [watcher]: Pattern "/Users/nomad/Projects/clever-walking-skeleton-10.0/frontend/app/modules/**/directives/*.js" does not match any file.
WARN [watcher]: Pattern "/Users/nomad/Projects/clever-walking-skeleton-10.0/frontend/app/modules/**/factories/*.js" does not match any file.
WARN [watcher]: Pattern "/Users/nomad/Projects/clever-walking-skeleton-10.0/frontend/app/modules/**/services/*.js" does not match any file.
INFO [PhantomJS 1.9.7 (Mac OS X)]: Connected on socket a0H2On9cZfUpsxhP-L74
INFO [Chrome 35.0.1916 (Mac OS X 10.9.3)]: Connected on socket 4sdEC29aciR51il_-L75
PhantomJS 1.9.7 (Mac OS X) WARN: 'Unable to read href attr from base tag'
PhantomJS 1.9.7 (Mac OS X) WARN: 'Unable to read href attr from base tag'
Chrome 35.0.1916 (Mac OS X 10.9.3) WARN: 'Unable to read href attr from base tag'
Chrome 35.0.1916 (Mac OS X 10.9.3) WARN: 'Unable to read href attr from base tag'
PhantomJS 1.9.7 (Mac OS X): Executed 1 of 1 SUCCESS (0.213 secs / 0.009 secs)
Chrome 35.0.1916 (Mac OS X 10.9.3): Executed 1 of 1 SUCCESS (0.297 secs / 0.014 secs)

Done, without errors.

Execution Time (2014-06-28 10:15:12 UTC)
loading tasks  815ms  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 25%
karma:unit      2.5s  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 75%
Total 3.3s
Tests ran successfully.

Open a new console window in frontend


webdriver-manager start 5119
Jun 28, 2014 12:18:07 PM org.openqa.grid.selenium.GridLauncher main
INFO: Launching a standalone server
Setting system property to /usr/local/lib/node_modules/protractor/selenium/chromedriver
12:18:07.797 INFO - Java: Apple Inc. 20.65-b04-462
12:18:07.797 INFO - OS: Mac OS X 10.9.3 x86_64
12:18:07.806 INFO - v2.42.2, with Core v2.42.2. Built from revision 6a6995d
12:18:07.866 INFO - Default driver registration is skipped: registration capabilities Capabilities [{platform=WINDOWS, ensureCleanSession=true, browserName=internet explorer, version=}] does not match with current platform: MAC
12:18:07.895 INFO - RemoteWebDriver instances should connect to:
12:18:07.896 INFO - Version Jetty/5.1.x
12:18:07.897 INFO - Started HttpContext[/selenium-server/driver,/selenium-server/driver]
12:18:07.897 INFO - Started HttpContext[/selenium-server,/selenium-server]
12:18:07.897 INFO - Started HttpContext[/,/]
12:18:07.930 INFO - Started org.openqa.jetty.jetty.servlet.ServletHandler@1f25fefa
12:18:07.930 INFO - Started HttpContext[/wd,/wd]
12:18:07.937 INFO - Started SocketListener on
12:18:07.937 INFO - Started org.openqa.jetty.jetty.Server@1d5a0305

From the previous console window run:

Expect it to fail because of many reasons.

We will remedy this by deleting all the tests and starting from scratch


cd backend

grunt db

grunt serve

Change home.test.js

// test if the homepage is loading
describe('e2e: home', function() {

 var ptor;
 beforeEach(function() {
 ptor = protractor.getInstance();
 ptor.ignoreSynchronization = true;

 it('should load the home page', function() {




clever test e2e


clever test e2e
Scanning folders for Gruntfiles...
Running "connect:livereload" (connect) task
Started connect web server on

Running "protractor:singlerun" (protractor) task
Using the selenium server at http://localhost:4444/wd/hub

Finished in 1.578 seconds
1 test, 1 assertion, 0 failures

Done, without errors.

Execution Time (2014-07-02 09:25:32 UTC)
loading tasks         885ms  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 21%
protractor:singlerun   3.3s  ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 79%
Total 4.2s
Running "mochaTest:e2e" (mochaTest) task
No files to check...OK

Done, without errors.
Tests ran successfully.

Leave a Reply