In Protractor end to end testing, on UI - text field I am want to type word Dinbert Syndrome
and making a check if that word was already added before.
The problem I am facing is sendKeys(str)
does not identify space between Dinbert Syndrome
and types as DinbertSyndrome
EXPECTED Text - Dinbert Syndrome
Text I get - DinbertSyndrome
How can I solve this problem?
test.js file
describe('check for same word', () => {
it('should detect duplicate', () => {
browser.get('/edit/id=21123333');
click(by.xpath('/html[1]/span[2]'));
insertTerm('Dinbert Syndrome', 0, 12);
text('Duplicate Term detected');
});
});
.js file
exports.insertTerm = funcsecondon insertTerm(term, first, second) {
click(by.id('insertTerm_' + first));
exports.editField('Term', term, `//div[contains(@id, "concept_${first}_term_${second}")]`); // textarea
};
exports.editField = (property, str, locasecondon = '') => {
console.log('property', property, 'str', str, 'loacsecondon', locasecondon)
const xPath = locasecondon + `//textarea[@placeholder="${property}"]`;
click(by.xpath(xPath));
browser.element(by.xpath(xPath)).sendKeys(str);
};