diff --git a/IPython/html/services/notebooks/tests/test_nbmanager.py b/IPython/html/services/notebooks/tests/test_nbmanager.py
index 1a42451..b6a240e 100644
--- a/IPython/html/services/notebooks/tests/test_nbmanager.py
+++ b/IPython/html/services/notebooks/tests/test_nbmanager.py
@@ -68,7 +68,7 @@ class TestNotebookManager(TestCase):
try:
os.makedirs(os_path)
except OSError:
- print("Directory already exists.")
+ print("Directory already exists: %r" % os_path)
def test_create_notebook_model(self):
with TemporaryDirectory() as td:
diff --git a/IPython/html/tests/casperjs/test_cases/dashboard_nav.js b/IPython/html/tests/casperjs/test_cases/dashboard_nav.js
new file mode 100644
index 0000000..9730b1e
--- /dev/null
+++ b/IPython/html/tests/casperjs/test_cases/dashboard_nav.js
@@ -0,0 +1,45 @@
+casper.wait_for_list = function () {
+ casper.waitForSelector('.list_item');
+ // casper.wait(500);
+}
+
+casper.get_list_items = function () {
+ return this.evaluate(function () {
+ return $.makeArray($('.item_link').map(function () {
+ return {
+ link: $(this).attr('href'),
+ label: $(this).find('.item_name').text()
+ }
+ }));
+ });
+}
+
+casper.test_items = function (test, baseUrl) {
+ casper.then(function () {
+ var items = casper.get_list_items();
+ casper.each(items, function (self, item) {
+ if (!item.label.match('.ipynb$')) {
+ var followed_url = baseUrl+item.link;
+ if (!followed_url.match('/\.\.$')) {
+ casper.thenOpen(baseUrl+item.link, function () {
+ casper.wait_for_list();
+ test.assertEquals(this.getCurrentUrl(), followed_url, 'Testing dashboard link: '+followed_url);
+ casper.test_items(test, baseUrl);
+ this.back();
+ });
+ }
+ }
+ });
+ });
+}
+
+casper.test.begin('Testing dashboard navigation', function (test) {
+ var baseUrl = casper.get_notebook_server();
+ casper.start(baseUrl);
+ casper.echo(baseUrl);
+ casper.wait_for_list();
+ casper.test_items(test, baseUrl);
+ casper.run(function() {
+ test.done();
+ });
+});
diff --git a/IPython/html/tests/launchnotebook.py b/IPython/html/tests/launchnotebook.py
index 9f9e083..3666a0c 100644
--- a/IPython/html/tests/launchnotebook.py
+++ b/IPython/html/tests/launchnotebook.py
@@ -1,5 +1,7 @@
"""Base class for notebook tests."""
+from __future__ import print_function
+
import sys
import time
import requests
diff --git a/IPython/testing/iptestcontroller.py b/IPython/testing/iptestcontroller.py
index 8ad3d7e..9e02c9a 100644
--- a/IPython/testing/iptestcontroller.py
+++ b/IPython/testing/iptestcontroller.py
@@ -167,6 +167,10 @@ class JSController(TestController):
self.section = section
self.ipydir = TemporaryDirectory()
+ self.nbdir = os.path.join(self.ipydir.name, 'notebooks')
+ print("Running notebook tests in directory: %r" % self.nbdir)
+ os.makedirs(os.path.join(self.nbdir, 'subdir1/subdir1a'))
+ os.makedirs(os.path.join(self.nbdir, 'subdir2/subdir2a'))
# print(self.ipydir.name)
self.dirs.append(self.ipydir)
self.env['IPYTHONDIR'] = self.ipydir.name
@@ -191,7 +195,7 @@ class JSController(TestController):
def _init_server(self):
"Start the notebook server in a separate process"
self.queue = q = Queue()
- self.server = Process(target=run_webapp, args=(q, self.ipydir.name))
+ self.server = Process(target=run_webapp, args=(q, self.ipydir.name, self.nbdir))
self.server.start()
self.server_port = q.get()
@@ -202,17 +206,17 @@ class JSController(TestController):
js_test_group_names = {'js'}
-def run_webapp(q, nbdir, loglevel=0):
+def run_webapp(q, ipydir, nbdir, loglevel=0):
"""start the IPython Notebook, and pass port back to the queue"""
import os
import IPython.html.notebookapp as nbapp
import sys
sys.stderr = open(os.devnull, 'w')
- os.environ["IPYTHONDIR"] = nbdir
+ os.environ["IPYTHONDIR"] = ipydir
server = nbapp.NotebookApp()
args = ['--no-browser']
args.append('--notebook-dir='+nbdir)
- args.append('--profile-dir='+nbdir)
+ args.append('--profile-dir='+ipydir)
args.append('--log-level='+str(loglevel))
server.initialize(args)
# communicate the port number to the parent process