match english and croatian translation with same pattern
[angular-drzb] / test / e2e / scenarios.js
index 516c2a8..15036e6 100644 (file)
@@ -1,40 +1,93 @@
-describe('my app', function() {
+'use strict';
+
+/* http://docs.angularjs.org/guide/dev_guide.e2e-testing */
+
+describe('myApp', function() {
 
   beforeEach(function() {
-    browser().navigateTo('../../app/index.html');
+    browser().navigateTo('/lang/en-dev/drzb2013.html?test=mock');
   });
 
 
-  it('should automatically redirect to /view1 when location hash/fragment is empty', function() {
-    expect(browser().location().url()).toBe("/view1");
+  it('should automatically redirect to /registration/ when location hash/fragment is empty', function() {
+    expect(browser().location().url()).toBe("/registration/");
   });
 
 
-  describe('view1', function() {
+  describe('registration', function() {
 
     beforeEach(function() {
-      browser().navigateTo('#/view1');
+       browser().navigateTo('#/registration');
+    });
+
+
+    it('should render registration when user navigates to /registration', function() {
+      expect(element('[ng-view]').text()).
+        toMatch(/Registra/);
     });
 
+    it('has warning box', function() {
+      expect(element('p.well').text()).toBeTruthy();
+    });
 
-    it('should render view1 when user navigates to /view1', function() {
-      expect(element('[ng-view] p:first').text()).
-        toMatch(/partial for view 1/);
+    it('invalid form', function() {
+      expect(binding('RegistrationForm.$valid')).toEqual('false');
     });
 
+       it('save draft button', function() {
+               expect(input('user.registration_type').select('symposium')).toBeDefined;
+               expect(binding('RegistrationForm.$valid')).toEqual('false');
+               expect(element('input#save-draft')).toBeDefined;
+       });
+
+       it('symposium has 4 works by default', function() {
+               input('user.registration_type').select('symposium');
+               input('user.firstname').enter('name');
+//             expect(element(':input[ng-model="user.registration_type"]').val()).toBe('symposium');
+               var r = using('div#symposium-works').repeater('div.work');
+               expect(r.count()).toBe(4);
+//             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/);
+       });
+
   });
 
 
-  describe('view2', function() {
+  describe('list', function() {
 
     beforeEach(function() {
-      browser().navigateTo('#/view2');
+      browser().navigateTo('#/list');
     });
 
 
-    it('should render view1 when user navigates to /view2', function() {
-      expect(element('[ng-view] p:first').text()).
-        toMatch(/partial for view 2/);
+    it('should render list when user navigates to /list', function() {
+      expect(element('[ng-view] div:first').text()).
+        toMatch(/Loading/);
     });
 
   });