run all e2e scenarios
[angular-drzb] / test / e2e / scenarios.js
index 1b63871..806ca86 100644 (file)
@@ -2,10 +2,10 @@
 
 /* http://docs.angularjs.org/guide/dev_guide.e2e-testing */
 
-describe('my app', function() {
+describe('myApp', function() {
 
   beforeEach(function() {
-    browser().navigateTo('/lang/en/drzb2013.html');
+    browser().navigateTo('/lang/hr-dev/drzb2013.html?test=mock');
   });
 
 
@@ -17,15 +17,81 @@ describe('my app', function() {
   describe('registration', function() {
 
     beforeEach(function() {
-      browser().navigateTo('#/registration');
+       browser().navigateTo('#/registration');
     });
 
 
     it('should render registration when user navigates to /registration', function() {
       expect(element('[ng-view]').text()).
-        toMatch(/Registration/);
+        toMatch(/Registra/);
     });
 
+    it('has warning box', function() {
+      expect(element('p.well').text()).toBeTruthy();
+    });
+
+    it('RegistrationForm.$valid', function() {
+      expect(binding('RegistrationForm.$valid')).toBe("false"); // FIXME toBeFalsy() doesn't work
+    });
+
+    it('RegistrationForm.$error', function() {
+      expect(binding('RegistrationForm.$error')).toBeDefined();
+    });
+
+       xit('save draft button', function() {
+               input('user.registration_type').select('symposium').click();
+               expect(binding('user.registration_type')).toBe("symposium");
+               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({});
+       });
+  
+  });
+
+  describe('registration_type accomp', function() {
+
+       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();
+               //dump('registration_url', registration_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/);
+       });
+
+       it('accomp change to lecture', function() {
+               browser().navigateTo( '#' + registration_url.value );
+               expect(browser().location().url()).toBe(registration_url.value);
+               input('user.registration_type').select('lecture');
+               var work_persons = using('fieldset#has_work').repeater('div.persons');
+               expect(work_persons.count()).toBe(1);
+       });
+
   });
 
 
@@ -42,4 +108,18 @@ describe('my app', function() {
     });
 
   });
+
+  describe('authors', function() {
+
+    beforeEach(function() {
+      browser().navigateTo('#/authors');
+    });
+
+
+    it('loading', function() {
+      expect(element('[ng-view] div:first').text()).
+        toMatch(/Loading/);
+    });
+
+  });
 });