I was trying to use .then() with my test cases but without success because of strage comportament. I'm trying make tests with google chrome to.
i have the "SELENIUM_PROMISE_MANAGER: false," in my conf.js file.
Now the problem:
When i trying to find some elements in the DOM i has problems...the actual error is:
Failed: Index out of bound. Trying to access element at index: 2, but there are only 0 elements that match locator By(css selector, .mat-option-text)
The CODE (With comments)
console.log('Testing Pesquisa Assunto ...');
beforeAll(function () {
var teste = browser.get(browser.params.URL_PROCESSO).then(function () {
})
});
it('Deve escolher um ASSUNTO PRINCIPAL e verificar os resultados', async function () {
try {
if (browser.findElements(by.id('filtro_assuntos')).toEqual(""));
} catch{
await element(by.id('maisFiltros')).click()
await element(by.className('[placeholder = "main"]')).isPresent()
try {
//THE TEST DON'T DO ANYTHING OF THAT
await element(by.css('[placeholder = "Assunto"]')).isDisplayed()
await element(by.css('[placeholder = "Assunto"]')).click()
await element(by.className('cdk-overlay-pane')).isDisplayed();
}
catch{
//THE TEST IS ENTERING HERE
console.log('Cannot find a list ')
}
var clicaAssunto = await element.all(by.className('mat-option-text')).get(2).click(); //AND HAS PROBLEMS TO FIND THIS LIST OF OPTIONS
await element(by.className('mat-slide-toggle-bar')).click()
await element(by.className("aplicar")).click()
await element(by.className('processo')).isPresent()
await element(by.className('identificacao')).isPresent()
await expect(element(by.className('identificacao')).getText()).toContain('Abandono');
}
})
});```
Aucun commentaire:
Enregistrer un commentaire