split describe registration_type accomp
[angular-drzb] / test / e2e / scenarios.js
1 'use strict';
2
3 /* http://docs.angularjs.org/guide/dev_guide.e2e-testing */
4
5 describe('myApp', function() {
6
7   beforeEach(function() {
8     browser().navigateTo('/lang/hr-dev/drzb2013.html?test=mock');
9   });
10
11
12   it('should automatically redirect to /registration/ when location hash/fragment is empty', function() {
13     expect(browser().location().url()).toBe("/registration/");
14   });
15
16
17   describe('registration', function() {
18
19     beforeEach(function() {
20        browser().navigateTo('#/registration');
21     });
22
23
24     it('should render registration when user navigates to /registration', function() {
25       expect(element('[ng-view]').text()).
26         toMatch(/Registra/);
27     });
28
29     it('has warning box', function() {
30       expect(element('p.well').text()).toBeTruthy();
31     });
32
33     it('RegistrationForm.$valid', function() {
34       expect(binding('RegistrationForm.$valid')).toBe("false"); // FIXME toBeFalsy() doesn't work
35     });
36
37     it('RegistrationForm.$error', function() {
38       expect(binding('RegistrationForm.$error')).toBeDefined();
39     });
40
41         xit('save draft button', function() {
42                 input('user.registration_type').select('symposium').click();
43                 expect(binding('user.registration_type')).toBe("symposium");
44                 expect(element('input#save-draft')).toBeDefined();
45         });
46
47         it('symposium has 4 works by default', function() {
48                 input('user.registration_type').select('symposium');
49                 input('user.firstname').enter('name');
50 //              expect(element(':input[ng-model="user.registration_type"]').val()).toBe('symposium');
51                 var r = using('div#symposium-works').repeater('div.work');
52                 expect(r.count()).toBe(4);
53 //              expect(r.row(0)).toEqual({});
54         });
55   
56   });
57
58   describe('registration_type accomp', function() {
59
60         var registration_url;
61
62         it('accomp draft', function() {
63                 input('user.registration_type').select('accomp');
64                 input('user.firstname').enter('Test');
65                 input('user.surname').enter('Registration');
66                 input('user.city').enter('TEST');
67                 input('user.email').enter('test.registration@example.com');
68
69                 element('button#update-draft').click();
70                 expect(element('[ng-view]').text()).toMatch(/draft/i);
71                 expect(browser().location().url()).toMatch(/draft/);
72                 element('#edit-registration').click();
73                 expect(browser().location().url()).toMatch(/registration/);
74                 registration_url = browser().location().url();
75                 //dump('registration_url', registration_url);
76         });
77
78         it('accomp finish registration', function() {
79                 browser().navigateTo( '#' + registration_url.value );
80                 expect(browser().location().url()).toBe(registration_url.value);
81                 input('user.reception').select('no');
82                 input('user.dinner').select('no');
83                 element('#update-registration').click();
84                 expect(browser().location().url()).toMatch(/confirmation/);
85         });
86
87   });
88
89
90   describe('list', function() {
91
92     beforeEach(function() {
93       browser().navigateTo('#/list');
94     });
95
96
97     it('should render list when user navigates to /list', function() {
98       expect(element('[ng-view] div:first').text()).
99         toMatch(/Loading/);
100     });
101
102   });
103 });