Skip to content
This repository was archived by the owner on Dec 4, 2017. It is now read-only.

Commit 4ae9a92

Browse files
e2e test - squash please
1 parent 9a063da commit 4ae9a92

File tree

1 file changed

+75
-2
lines changed

1 file changed

+75
-2
lines changed

public/docs/_examples/reactive-forms/e2e-spec.ts

Lines changed: 75 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ describe('Reactive forms', function() {
3030
expect(select.isDisplayed()).toBe(true);
3131
});
3232

33-
it('should have 8 options for different demos', function() {
33+
it('should have 9 options for different demos', function() {
3434
let options = select.all(by.tagName('option'));
35-
expect(options.count()).toBe(8);
35+
expect(options.count()).toBe(9);
3636
});
3737

3838
it('should start with Final Demo', function() {
@@ -140,7 +140,80 @@ describe('Reactive forms', function() {
140140
});
141141

142142
describe('Bombasta form', function() {
143+
beforeEach(function() {
144+
let bombastaButton = element.all(by.css('nav a')).get(1);
145+
bombastaButton.click();
146+
});
147+
148+
it('should show a hero information when the button is click', function() {
149+
let editMessage = element(by.css('hero-list > div > h3'));
150+
expect(editMessage.getText()).toBe('Editing: Bombasta');
151+
});
143152

153+
// it('should show a form with the selected hero information', function() {
154+
// let nameInput = element(by.css('input[formcontrolname=name]'));
155+
// expect(nameInput.getAttribute('value')).toBe('Whirlwind');
156+
// let address1 = finalDemoAddressForm(element, 0);
157+
// expect(address1.street).toBe('123 Main');
158+
// expect(address1.state).toBe('CA');
159+
// expect(address1.zip).toBe('94801');
160+
// expect(address1.city).toBe('Anywhere');
161+
// let address2 = finalDemoAddressForm(element, 1);
162+
// expect(address2.street).toBe('456 Maple');
163+
// expect(address2.zip).toBe('23226');
164+
// expect(address2.city).toBe('Somewhere');
165+
// });
166+
167+
// it('shows a json output from the form', function() {
168+
// let json = element(by.css('hero-detail > p'));
169+
// expect(json.getText()).toContain('Whirlwind');
170+
// expect(json.getText()).toContain('Anywhere');
171+
// expect(json.getText()).toContain('Somewhere');
172+
// expect(json.getText()).toContain('VA');
173+
// });
174+
175+
// it('has two disabled buttons by default', function() {
176+
// let buttons = element.all(by.css('hero-detail > form > div > button'));
177+
// expect(buttons.get(0).getAttribute('disabled')).toBe('true');
178+
// expect(buttons.get(1).getAttribute('disabled')).toBe('true');
179+
// });
180+
181+
// it('enables the buttons after we edit the form', function() {
182+
// let nameInput = element(by.css('input[formcontrolname=name]'));
183+
// nameInput.sendKeys('a');
184+
// let buttons = element.all(by.css('hero-detail > form > div > button'));
185+
// expect(buttons.get(0).getAttribute('disabled')).toBeNull();
186+
// expect(buttons.get(1).getAttribute('disabled')).toBeNull();
187+
// });
188+
189+
// it('saves the changes when the save button is click', function() {
190+
// let nameInput = element(by.css('input[formcontrolname=name]'));
191+
// nameInput.sendKeys('a');
192+
// let save = element.all(by.css('hero-detail > form > div > button')).get(0);
193+
// save.click();
194+
// let editMessage = element(by.css('hero-list > div > h3'));
195+
// expect(editMessage.getText()).toBe('Editing: Whirlwinda');
196+
// });
197+
198+
// it('reverts the changes when the revert button is click', function() {
199+
// let nameInput = element(by.css('input[formcontrolname=name]'));
200+
// nameInput.sendKeys('a');
201+
// let revert = element.all(by.css('hero-detail > form > div > button')).get(1);
202+
// revert.click();
203+
// let editMessage = element(by.css('hero-list > div > h3'));
204+
// expect(editMessage.getText()).toBe('Editing: Whirlwind');
205+
// expect(nameInput.getAttribute('value')).toBe('Whirlwind');
206+
// });
207+
208+
// it('is able to add a new empty address', function() {
209+
// let newLairButton = element.all(by.css('button')).get(3);
210+
// newLairButton.click();
211+
// let address3 = finalDemoAddressForm(element, 2);
212+
// expect(address3.street).toBe('');
213+
// expect(address3.state).toBe('CA');
214+
// expect(address3.zip).toBe('');
215+
// expect(address3.city).toBe('');
216+
// });
144217
});
145218

146219
describe('Magneta form', function() {

0 commit comments

Comments
 (0)