var adminUI = require('../adminUI');

module.exports = {
	before: function (browser) {
		browser
			.url(adminUI.url)
			.waitForElementVisible(adminUI.cssSelector.signinView.id)
			.setValue(adminUI.cssSelector.signinView.emailInput, adminUI.login.email)
			.setValue(adminUI.cssSelector.signinView.passwordInput, adminUI.login.password)
			.pause(browser.globals.defaultPauseTimeout)
			.click(adminUI.cssSelector.signinView.submitButton)
			.pause(browser.globals.defaultPauseTimeout)
			.url(adminUI.url)
			.waitForElementVisible(adminUI.cssSelector.homeView.id)
			.pause(browser.globals.defaultPauseTimeout);
	},
	after: function (browser) {
		browser
			.click(adminUI.cssSelector.allView.logoutIconLink)
			.pause(browser.globals.defaultPauseTimeout)
			.end();
	},
	'TODO': function (browser) {
		browser
			.click(adminUI.cssSelector.homeView.plusIconLinkForEmailsTabUnderDashboardFieldsSubheading)
			.waitForElementVisible(adminUI.cssSelector.initialModalView.id)
			.pause(browser.globals.defaultPauseTimeout)
	},
};

@@ -774,12 +774,56 @@
 ,%0A%09'
-TODO
+Email field can be created via the initial modal
 ': f
@@ -1006,32 +1006,32 @@
 alModalView.id)%0A
-
 %09%09%09.pause(browse
@@ -1061,15 +1061,1861 @@
 imeout)%0A
+%09%09%09.setValue(adminUI.cssSelector.initialModalView.fieldType.email.email.name.value, 'Email Field Test')%0A%09%09%09.setValue(adminUI.cssSelector.initialModalView.fieldType.email.email.fieldA.value, 'email1@test.e2e')%0A%09%09%09.pause(browser.globals.defaultPauseTimeout)%0A%09%09%09.click(adminUI.cssSelector.initialModalView.buttonCreate)%0A%09%09%09.waitForElementVisible(adminUI.cssSelector.itemView.id)%0A%09%09%09.pause(browser.globals.defaultPauseTimeout);%0A%0A%09%09browser.expect.element(adminUI.cssSelector.itemView.flashMessage)%0A%09%09%09.text.to.equal('New Email Email Field Test created.');%0A%0A%09%09browser.getValue(adminUI.cssSelector.itemView.fieldType.email.email.name.value, function(result) %7B%0A%09%09%09this.assert.equal(typeof result, %22object%22);%0A%09%09%09this.assert.equal(result.status, 0);%0A%09%09%09this.assert.equal(result.value, %22Email Field Test%22);%0A%09%09%7D);%0A%0A%09%09browser.expect.element(adminUI.cssSelector.itemView.fieldType.email.email.fieldA.value)%0A%09%09%09.to.have.value.that.equals('email1@test.e2e');%0A%09%7D,%0A%09'Email field can be created via the edit form': function (browser) %7B%0A%09%09browser%0A%09%09%09.setValue(adminUI.cssSelector.itemView.fieldType.email.email.fieldB.value, 'email2@test.e2e')%0A%09%09%09.pause(browser.globals.defaultPauseTimeout)%0A%09%09%09.click(adminUI.cssSelector.itemView.itemSaveButton)%0A%09%09%09.waitForElementVisible(adminUI.cssSelector.itemView.id)%0A%09%09%09.pause(browser.globals.defaultPauseTimeout);%0A%0A%09%09browser.expect.element(adminUI.cssSelector.itemView.flashMessage)%0A%09%09%09.text.to.equal('Your changes have been saved.');%0A%0A%09%09browser.getValue(adminUI.cssSelector.itemView.fieldType.email.email.name.value, function(result) %7B%0A%09%09%09this.assert.equal(typeof result, %22object%22);%0A%09%09%09this.assert.equal(result.status, 0);%0A%09%09%09this.assert.equal(result.value, %22Email Field Test%22);%0A%09%09%7D);%0A%0A%09%09browser.expect.element(adminUI.cssSelector.itemView.fieldType.email.email.fieldB.value)%0A%09%09%09.to.have.value.that.equals('email2@test.e2e');%0A
 %09%7D,%0A%7D;%0A

add email ux test coverage.