Skip to content

Commit

Permalink
refinando expressoes regulares e sincronia dos passos
Browse files Browse the repository at this point in the history
  • Loading branch information
pauloborba committed Oct 1, 2017
1 parent 88cafb2 commit 235f9f9
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions tests-acceptance/stepdefinitions/alunos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(<string> name);
await $("input[name='cpfbox']").sendKeys(<string> 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));
Expand Down

0 comments on commit 235f9f9

Please sign in to comment.