-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/hr-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 view1 when user navigates to /view1', function() {
- expect(element('ng\\:view p:first').text()).
- toMatch(/partial for view 1/);
+ 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('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);
+ });
+
});
- describe('view2', function() {
+ describe('list', function() {
+
+ beforeEach(function() {
+ browser().navigateTo('#/list');
+ });
+
+
+ it('should render list when user navigates to /list', function() {
+ expect(element('[ng-view] div:first').text()).
+ toMatch(/Loading/);
+ });
+
+ });
+
+ describe('authors', function() {
beforeEach(function() {
- browser().navigateTo('#/view2');
+ browser().navigateTo('#/authors');
});
- it('should render view1 when user navigates to /view2', function() {
- expect(element('ng\\:view p:first').text()).
- toMatch(/partial for view 2/);
+ it('loading', function() {
+ expect(element('[ng-view] div:first').text()).
+ toMatch(/Loading/);
});
});