<commit_before>'use strict';

function sharedTests() {
	
}

describe('Registration information page', function() {
	describe('with no pack information submitted', function() {
		var savedData;
		beforeEach(function() {
			var flow = protractor.promise.controlFlow();
			flow.execute(function() {
				var defer = protractor.promise.defer();
				browser.executeAsyncScript(function(callback) {
					registration = angular.injector(["ccj16reg"]).get("registration");
					reg = new registration();
					reg.council = "Test council";
					reg.groupName = "Test group";
					reg.contactLeaderFirstName = "FirstN";
					reg.contactLeaderLastName = "LastN";
					reg.contactLeaderEmail = "<EMAIL>";
					reg.contactLeaderPhoneNumber= "123-456-7890";
					reg.estimatedYouth = 20;
					reg.estimatedLeaders = 12;
					reg.agreedToEmailTerms(true);
					
					reg.$save().then(function(savedObject) {
						callback([true, savedObject]);
					}, function() {
						callback([false]);
					});
				}).then(function(data) {
					var success = data[0];
					if (success) {
						defer.fulfill(data[1]);
					} else {
						defer.reject("Failed to clear database");
					}
				});
				defer.promise.then(function(data) {
					savedData = data;
					browser.get('/registration/' + data.securityKey);
				});
				return defer.promise;
			});
		});
		it('should be on the proper page', function() {
			expect(browser.getLocationAbsUrl()).toBe("/registration/" + savedData.securityKey);
		});
		it('should have the header include the council/group/pack name as appropriate', function() {
			expect(element.all(by.css('h1')).first().getText()).
				toBe('CCJ16 Pre-registration - Test group of Test council');
		});
		it('should have the correct leader information', function() {
			var leaderBlock = element.all(by.css('md-card-content')).get(0);
			expect(leaderBlock.element(by.tagName('h2')).getText()).toBe('Contact Leader');

			expect(leaderBlock.all(by.css('div.form-redisplay')).get(0).element(by.tagName('p')).getText()).toBe('FirstN');
			expect(leaderBlock.all(by.css('div.form-redisplay')).get(1).element(by.tagName('p')).getText()).toBe('LastN');
			expect(leaderBlock.all(by.css('div.form-redisplay')).get(2).element(by.tagName('p')).getText()).toBe('test@invalid');
			expect(leaderBlock.all(by.css('div.form-redisplay')).get(3).element(by.tagName('p')).getText()).toBe('123-456-7890');
		});
		it('should have the estimated participant count information', function() {
			var countBlock = element.all(by.css('md-card-content')).get(1);
			expect(countBlock.element(by.tagName('h2')).getText()).toBe('Estimated Participant counts');

			expect(countBlock.all(by.css('div.form-redisplay')).get(0).element(by.tagName('p')).getText()).toBe('20');
			expect(countBlock.all(by.css('div.form-redisplay')).get(1).element(by.tagName('p')).getText()).toBe('12');
		});
	});
});<commit_msg>Test that pack information gets in the header correctly.<commit_after>'use strict';

function sharedTests() {
	
}

describe('Registration information page', function() {
	describe('with no pack information submitted', function() {
		var savedData;
		beforeEach(function() {
			var flow = protractor.promise.controlFlow();
			flow.execute(function() {
				var defer = protractor.promise.defer();
				browser.executeAsyncScript(function(callback) {
					registration = angular.injector(["ccj16reg"]).get("registration");
					reg = new registration();
					reg.council = "Test council";
					reg.groupName = "Test group";
					reg.contactLeaderFirstName = "FirstN";
					reg.contactLeaderLastName = "LastN";
					reg.contactLeaderEmail = "<EMAIL>";
					reg.contactLeaderPhoneNumber= "123-456-7890";
					reg.estimatedYouth = 20;
					reg.estimatedLeaders = 12;
					reg.agreedToEmailTerms(true);

					reg.$save().then(function(savedObject) {
						callback([true, savedObject]);
					}, function() {
						callback([false]);
					});
				}).then(function(data) {
					var success = data[0];
					if (success) {
						defer.fulfill(data[1]);
					} else {
						defer.reject("Failed to clear database");
					}
				});
				defer.promise.then(function(data) {
					savedData = data;
					browser.get('/registration/' + data.securityKey);
				});
				return defer.promise;
			});
		});
		it('should be on the proper page', function() {
			expect(browser.getLocationAbsUrl()).toBe("/registration/" + savedData.securityKey);
		});
		it('should have the header include the council/group/pack name as appropriate', function() {
			expect(element.all(by.css('h1')).first().getText()).
				toBe('CCJ16 Pre-registration - Test group of Test council');
		});
		it('should have the correct leader information', function() {
			var leaderBlock = element.all(by.css('md-card-content')).get(0);
			expect(leaderBlock.element(by.tagName('h2')).getText()).toBe('Contact Leader');

			expect(leaderBlock.all(by.css('div.form-redisplay')).get(0).element(by.tagName('p')).getText()).toBe('FirstN');
			expect(leaderBlock.all(by.css('div.form-redisplay')).get(1).element(by.tagName('p')).getText()).toBe('LastN');
			expect(leaderBlock.all(by.css('div.form-redisplay')).get(2).element(by.tagName('p')).getText()).toBe('test@invalid');
			expect(leaderBlock.all(by.css('div.form-redisplay')).get(3).element(by.tagName('p')).getText()).toBe('123-456-7890');
		});
		it('should have the estimated participant count information', function() {
			var countBlock = element.all(by.css('md-card-content')).get(1);
			expect(countBlock.element(by.tagName('h2')).getText()).toBe('Estimated Participant counts');

			expect(countBlock.all(by.css('div.form-redisplay')).get(0).element(by.tagName('p')).getText()).toBe('20');
			expect(countBlock.all(by.css('div.form-redisplay')).get(1).element(by.tagName('p')).getText()).toBe('12');
		});
	});

	describe('with no pack information submitted', function() {
		var savedData;
		beforeEach(function() {
			var flow = protractor.promise.controlFlow();
			flow.execute(function() {
				var defer = protractor.promise.defer();
				browser.executeAsyncScript(function(callback) {
					registration = angular.injector(["ccj16reg"]).get("registration");
					reg = new registration();
					reg.council = "Test council";
					reg.groupName = "Test group";
					reg.packName = "Test pack";
					reg.contactLeaderFirstName = "FirstN";
					reg.contactLeaderLastName = "LastN";
					reg.contactLeaderEmail = "<EMAIL>";
					reg.contactLeaderPhoneNumber= "123-456-7890";
					reg.estimatedYouth = 20;
					reg.estimatedLeaders = 12;
					reg.agreedToEmailTerms(true);

					reg.$save().then(function(savedObject) {
						callback([true, savedObject]);
					}, function() {
						callback([false]);
					});
				}).then(function(data) {
					var success = data[0];
					if (success) {
						defer.fulfill(data[1]);
					} else {
						defer.reject("Failed to clear database");
					}
				});
				defer.promise.then(function(data) {
					savedData = data;
					browser.get('/registration/' + data.securityKey);
				});
				return defer.promise;
			});
		});
		it('should be on the proper page', function() {
			expect(browser.getLocationAbsUrl()).toBe("/registration/" + savedData.securityKey);
		});
		it('should have the header include the council/group/pack name as appropriate', function() {
			expect(element.all(by.css('h1')).first().getText()).
				toBe('CCJ16 Pre-registration - Test group of Test council (Test pack)');
		});
	});
});
{'fraction_non_alphanumeric': 0.18334905024922538, 'fraction_numerical': 0.014953522834433517, 'mean_word_length': 4.095401509951956, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5253935', 'n_tokens_mistral': 2858, 'n_tokens_neox': 2306, 'n_words': 372}