Make the tour interactive

_The code for this is quite hacky and light on tests. But I’d really like to get
it in the app for the research tomorrow to see how well the feature works._

This commit changes the tour from being a set of static screens to some help
which guides you through the process of sending your first test message.

The theory behind this is that what users are really struggling with is the
concept of a variable, rather than the relationship between the placeholders and
the column headers. And like learning to program, the best way to learn is by
taking an example and modifying it to your own needs.

This means that when someone adds their first service we set them up an
example email template and an example text message template. Then there is a
guided, three step process where _all_ the user can do is send a test message to
themselves.

Once the message is sent, the user still has the example templates which they
can edit, rather than having to remember what they’re supposed to be doing.
This commit is contained in:
Chris Hill-Scott
2016-05-20 12:05:05 +01:00
parent 0bb8ac82c4
commit c41944080c
33 changed files with 146 additions and 234 deletions

View File

@@ -1,5 +1,5 @@
from flask import url_for, session
from unittest.mock import ANY
import app
@@ -17,6 +17,7 @@ def test_get_should_render_add_service_template(app_,
def test_should_add_service_and_redirect_to_tour_when_no_services(app_,
mocker,
mock_create_service,
mock_create_service_template,
mock_get_services_with_no_services,
api_user_active):
with app_.test_request_context():
@@ -34,14 +35,22 @@ def test_should_add_service_and_redirect_to_tour_when_no_services(app_,
user_id=api_user_active.id,
email_from='testing.the.post'
)
assert len(mock_create_service_template.call_args_list) == 2
assert session['service_id'] == 101
assert response.status_code == 302
assert response.location == url_for('main.tour', page=1, _external=True)
assert response.location == url_for(
'main.send_test',
service_id=101,
template_id="Example text message template",
help=1,
_external=True
)
def test_should_add_service_and_redirect_to_dashboard_when_existing_service(app_,
mocker,
mock_create_service,
mock_create_service_template,
mock_get_services,
api_user_active):
with app_.test_request_context():
@@ -59,6 +68,7 @@ def test_should_add_service_and_redirect_to_dashboard_when_existing_service(app_
user_id=api_user_active.id,
email_from='testing.the.post'
)
assert len(mock_create_service_template.call_args_list) == 0
assert session['service_id'] == 101
assert response.status_code == 302
assert response.location == url_for('main.service_dashboard', service_id=101, _external=True)

View File

@@ -70,7 +70,7 @@ def test_should_show_updates_for_one_job_as_json(
assert 'queued' in content['counts']
assert 'Recipient' in content['notifications']
assert 'Status' in content['notifications']
assert 'Started' in content['status']
assert 'Sent by Test User' in content['status']
assert job_json['status'] in content['status']

View File

@@ -1,17 +0,0 @@
import pytest
from flask import url_for
@pytest.mark.parametrize("page", range(1, 5))
def test_should_render_tour_pages(
app_,
api_user_active,
mocker,
mock_get_service,
page
):
with app_.test_request_context():
with app_.test_client() as client:
response = client.get(url_for('main.tour', page=page))
assert response.status_code == 200
assert 'Next' in response.get_data(as_text=True)