0

So the basic problem is I have an protractor test that is failing because the space is missing. If I send "new title" it puts "newtitle" in the field, causing it to fail.

Example code:

it('should allow the description to be editted', function () { element.all(by.css('h4.review__header__item')).then(function (headerItems) { var description = headerItems[1]; expect(description.getText()).toEqual('Short Test Meeting'); browser.actions().mouseMove(description).click(description).perform(); expect(description.getAttribute('contenteditable')).toBeTruthy(); description.clear().sendKeys('Description New').sendKeys(protractor.Key.ENTER); element.all(by.css('h4.review__header__item')).then(function (headerItems) { description = headerItems[1]; expect(description.getText()).toEqual('Description New'); // Check to see if it persists browser.refresh(); element.all(by.css('h4.review__header__item')).then(function (headerItems) { description = headerItems[1]; expect(description.getText()).toEqual('Description New'); }); }); }); }); 

The Error:

1) Review Meeting Meta Data should allow the description to be editted

Message:

Expected 'DescriptionNew' to equal 'Description New'.

Stack: Error: Failed expectation at /Users/adam/git/mrp-www/e2e/scenarios/reviewScenario.js:18:36 at ManagedPromise.invokeCallback_ (/Users/adam/git/mrp-www/node_modules/selenium-webdriver/lib/promise.js:1379:14) at TaskQueue.execute_ (/Users/adam/git/mrp-www/node_modules/selenium-webdriver/lib/promise.js:2913:14) at TaskQueue.executeNext_ (/Users/adam/git/mrp-www/node_modules/selenium-webdriver/lib/promise.js:2896:21) at asyncRun (/Users/adam/git/mrp-www/node_modules/selenium-webdriver/lib/promise.js:2775:27) at /Users/adam/git/mrp-www/node_modules/selenium-webdriver/lib/promise.js:639:7 at process._tickCallback (internal/process/next_tick.js:103:7)

1
  • BTW: I manually verified that typing into the description field works as expected. Commented Oct 25, 2016 at 17:31

1 Answer 1

1

I believe you're missing a .perform() after sendKeys(protractor.Key.ENTER).

Try this:

description.clear().sendKeys('Description New').sendKeys(protractor.Key.ENTER).perform(); 
Sign up to request clarification or add additional context in comments.

5 Comments

Nope, perform is not a function of element. test failed.
Try to split this up.
Try to split this up: description.clear(); description.sendKeys('Description New');
Try to split this up: description.clear(); description.sendKeys('Description New'); browser.actions().sendKeys(protractor.Key.ENTER).perform();
Same failure as above. Expected 'DescriptionNew' to equal 'Description New'.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.