Je voulais créer une étape de test de concombre avec un rapporteur, mais je me suis attendu à ce que le '2019' ne soit pas lisible. . Voici mon code source:TypeError '2019' n'est pas applicable
this.Then(/^I check that the calculated year from the current month\(if current month >= 6 ==> current year = current year \+ 2,else current year = current year \+ 1\)$/,function(callback) {
var actualDate=new Date();
var actualYear=actualDate.getFullYear();
var actualMonth=actualDate.getMonth()+1;
//expect(targetAmountPO.getYesInflationLabel().isDisplayed()).eventually.to.equal(true).then(callback);
targetAmountPO.getYesInflationLabel().isDisplayed().then(function() {
targetAmountPO.getYesInflationCorrectionAnswer().isSelected().then(function(){
targetAmountPO.getYesInflationLabel().getAttribute("outerText").then(function(text,callback){
//console.log(text);
var splittedString=text.split(":");
//console.log(splittedString[1]);
if(actualMonth>=6)
{
actualYear+=2;
var yearString=actualYear.toString();
console.log(yearString);
expect(yearString).to.eventually.contain(splittedString[1]).and.notify(callback);
//console.log(actualYear);
}
else
{
expect(actualYear+1).to.include(splittedString[1]).and.notify(callback);
}
})
})
})
})
À l'attendre (yearString) .to.eventually.contain (splittedString [1]) and.notify (rappel);
J'ai obtenu le '2019' n'est pas possible. L'année est 2019 c'est bien. Mais pourquoi n'est-ce pas possible?
Pouvez-vous m'aider?
Merci Ross. Je dois comprendre la promesse, parce que je suis développeur JAVA mais j'ai eu le test AngularJS E2E. – user3654435