match english and croatian translation with same pattern
[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/en-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('invalid form', function() {
34       expect(binding('RegistrationForm.$valid')).toEqual('false');
35     });
36
37         it('save draft button', function() {
38                 expect(input('user.registration_type').select('symposium')).toBeDefined;
39                 expect(binding('RegistrationForm.$valid')).toEqual('false');
40                 expect(element('input#save-draft')).toBeDefined;
41         });
42
43         it('symposium has 4 works by default', function() {
44                 input('user.registration_type').select('symposium');
45                 input('user.firstname').enter('name');
46 //              expect(element(':input[ng-model="user.registration_type"]').val()).toBe('symposium');
47                 var r = using('div#symposium-works').repeater('div.work');
48                 expect(r.count()).toBe(4);
49 //              expect(r.row(0)).toEqual({});
50         });
51
52         var registration_url;
53
54         it('accomp draft', function() {
55                 input('user.registration_type').select('accomp');
56                 input('user.firstname').enter('Test');
57                 input('user.surname').enter('Registration');
58                 input('user.city').enter('TEST');
59                 input('user.email').enter('test.registration@example.com');
60
61                 element('button#update-draft').click();
62                 expect(element('[ng-view]').text()).toMatch(/draft/i);
63                 expect(browser().location().url()).toMatch(/draft/);
64                 element('#edit-registration').click();
65                 expect(browser().location().url()).toMatch(/registration/);
66                 registration_url = browser().location().url();
67         });
68
69         it('accomp finish registration', function() {
70                 browser().navigateTo( '#' + registration_url.value );
71                 expect(browser().location().url()).toBe(registration_url.value);
72                 input('user.reception').select('no');
73                 input('user.dinner').select('no');
74                 element('#update-registration').click();
75                 expect(browser().location().url()).toMatch(/confirmation/);
76         });
77
78   });
79
80
81   describe('list', function() {
82
83     beforeEach(function() {
84       browser().navigateTo('#/list');
85     });
86
87
88     it('should render list when user navigates to /list', function() {
89       expect(element('[ng-view] div:first').text()).
90         toMatch(/Loading/);
91     });
92
93   });
94 });