From 235f9f999a8a657579b7c2293106eb9e38d74b47 Mon Sep 17 00:00:00 2001 From: pauloborba Date: Sun, 1 Oct 2017 16:44:26 -0300 Subject: [PATCH] refinando expressoes regulares e sincronia dos passos --- tests-acceptance/stepdefinitions/alunos.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tests-acceptance/stepdefinitions/alunos.ts b/tests-acceptance/stepdefinitions/alunos.ts index 99be8122d..f551ec85b 100644 --- a/tests-acceptance/stepdefinitions/alunos.ts +++ b/tests-acceptance/stepdefinitions/alunos.ts @@ -15,22 +15,24 @@ defineSupportCode(function ({ Given, When, Then }) { await $("a[name='alunos']").click(); }) - Given(/^I cannot see a student with CPF "(.*?)" in the students list$/, async (cpf) => { + Given(/^I cannot see a student with CPF "(\d*)" in the students list$/, async (cpf) => { var allcpfs : ElementArrayFinder = element.all(by.name('cpflist')); + await allcpfs; var samecpfs = allcpfs.filter(elem => elem.getText().then(text => text === cpf)); await samecpfs; await samecpfs.then(elems => expect(Promise.resolve(elems.length)).to.eventually.equal(0)); }); - When(/^I try to register the student "(.*?)" with CPF "(.*?)"$/, async (name, cpf) => { + When(/^I try to register the student "([^\"]*)" with CPF "(\d*)"$/, async (name, cpf) => { await $("input[name='namebox']").sendKeys( name); await $("input[name='cpfbox']").sendKeys( cpf); await element(by.buttonText('Adicionar')).click(); }); - Then(/^I can see "(.*?)" with CPF "(.*?)" in the students list$/, async (name, cpf) => { + Then(/^I can see "([^\"]*)" with CPF "(\d*)" in the students list$/, async (name, cpf) => { var allalunos : ElementArrayFinder = element.all(by.name('alunolist')); + await allalunos; var samenamecpf = allalunos.filter(elem => sameCPF(elem,cpf) && sameName(elem,name)); await samenamecpf; await samenamecpf.then(elems => expect(Promise.resolve(elems.length)).to.eventually.equal(1));