X-Git-Url: http://git.rot13.org/?p=angular-drzb;a=blobdiff_plain;f=test%2Fe2e%2Fscenarios.js;h=4bd1abfd9b39e9538db9ac31e2e211275d2b737a;hp=e9dee6a99cd960d61d6b04b50ff1e5456f9b79af;hb=3281f1ad855e4d18a28f2470e5cc8b1a4f2f6489;hpb=3f2cce012077bced39185888820034780278d2f7 diff --git a/test/e2e/scenarios.js b/test/e2e/scenarios.js index e9dee6a..4bd1abf 100644 --- a/test/e2e/scenarios.js +++ b/test/e2e/scenarios.js @@ -1,40 +1,102 @@ -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().hash()).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('RegistrationForm.$valid', function() { + expect(binding('RegistrationForm.$valid')).toBe("false"); // FIXME toBeFalsy() doesn't work + }); - it('should render view1 when user navigates to /view1', function() { - expect(element('ng\\:include p:first').text()). - toMatch(/partial for view 1/) + 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/); + }); + }); - 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\\:include 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/); }); });