accomp draft+full registration
authorDobrica Pavlinusic <dpavlin@rot13.org>
Mon, 21 Jan 2013 22:13:28 +0000 (23:13 +0100)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Mon, 21 Jan 2013 23:11:00 +0000 (00:11 +0100)
app/drzb2013.html.ep
app/registration/view.html.ep
test/e2e/scenarios.js

index 71913b3..a3b1404 100644 (file)
@@ -94,6 +94,7 @@ angular.module('testApp', ['myApp', 'ngMockE2E' ]).
                $httpBackend.whenGET(/partials\/.*/).passThrough();
                $httpBackend.whenJSONP(/./).passThrough();
                $httpBackend.whenGET(/registration/).passThrough();
+               $httpBackend.whenPOST(/registration/).passThrough();
        }
 );
 
index c614d9d..47a6872 100644 (file)
@@ -1,8 +1,8 @@
 
- <a class="btn" href="#/registration/{{registration.id}}">edit</a>
+ <a id="edit-registration" class="btn" href="#/registration/{{registration.id}}">edit</a>
  {{registration.user.registration_type}}
  {{registration._id | registration_date_time}}
- <a class="btn" href="#/{{registration.state}}/{{registration.id}}" title="{{registration.state}}" ng-show="registration.state"><tt>{{registration.id}}</tt></a>
+ <a id="registration-state" class="btn" href="#/{{registration.state}}/{{registration.id}}" title="{{registration.state}}" ng-show="registration.state"><tt>{{registration.id}}</tt></a>
  {{registration.state}}
 % if ( $lang =~ m/-dev/ ) {
  <a class="btn" href="<%= $couchdb_view %>/{{registration._id}}" target="couchdb">couchdb</a>
index 731d2a5..106e8de 100644 (file)
@@ -2,7 +2,7 @@
 
 /* http://docs.angularjs.org/guide/dev_guide.e2e-testing */
 
-describe('my app', function() {
+describe('myApp', function() {
 
   beforeEach(function() {
     browser().navigateTo('/lang/en-dev/drzb2013.html?test=mock');
@@ -49,6 +49,32 @@ describe('my app', function() {
 //             expect(r.row(0)).toEqual({});
        });
 
+       var registration_url;
+
+       it('accomp draft', function() {
+               input('user.registration_type').select('accomp');
+               input('user.firstname').enter('Test');
+               input('user.surname').enter('Registration');
+               input('user.city').enter('TEST');
+               input('user.email').enter('test.registration@example.com');
+
+               element('button#update-draft').click();
+               expect(element('[ng-view]').text()).toMatch(/draft/i);
+               expect(browser().location().url()).toMatch(/draft/);
+               element('#edit-registration').click();
+               expect(browser().location().url()).toMatch(/registration/);
+               registration_url = browser().location().url();
+       });
+
+       it('accomp finish registration', function() {
+               browser().navigateTo( '#' + registration_url.value );
+               expect(browser().location().url()).toBe(registration_url.value);
+               input('user.reception').select('no');
+               input('user.dinner').select('no');
+               element('#update-registration').click();
+               expect(browser().location().url()).toMatch(/confirmation/);
+       });
+
   });