Hallo, ich habe folgenden Code:Satz erwartetes Ergebnis als wahr, wenn Fund in einem String zum Teil richtig Winkelmesser
it('Search for string', function() {
var MySearch = element(by.model('searchQuery'));
MySearch.sendKeys('Apple Pomace');
expect(MySearch.getAttribute('value')).toBe('Apple Pomace');
element(by.buttonText('Search')).click();
//browser.pause();
var optionTexts = element.all(by.repeater('product in products')).map(function (Options) {
return Options.getText();
});
optionTexts.then(function (array){
expect(array).toContain("Apple Pomace");
});
});
dann bekomme ich als Ergebnis:
[ 'Apple Pomace\nFinest pressings of apples. Allergy disclaimer: Might contain traces of worms. Can be sent back to us for recycling.\n0.89' ]
jetzt will ich, wenn das überprüfen Zeichenfolge enthält Apfeltrester
ich versucht habe folgenden Code:
expect(array).toContain('Apple Pomace');
dann bekomme ich:
Expected [ 'Apple Pomace
Finest pressings of apples. Allergy disclaimer: Might contain traces of worms. Can be sent back to us for recycling.
0.89' ] to contain 'Apple Pomace'. <Click to see difference>
wie richte ich den Test gilt auch, wenn die gesamte Zeichenkette mein Ergebnis nicht übereinstimmt?
oder validieren Sie die Zeichenfolge zum ersten "\"?
Vielen Dank im Voraus
Vielen Dank! Ich werde es versuchen! –