-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
56 lines (44 loc) · 1.28 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import { ELEMENTS } from "./elements.components";
class Home {
acessar() {
return cy.visit("");
}
inserir(repositorio = "cypress-io/cypress-example-recipes") {
return cy.get(ELEMENTS.input).type(repositorio);
}
clicarAdicionar() {
return cy.get(ELEMENTS.submitButton).focus().click();
}
clicarLimpar() {
return cy.get(ELEMENTS.clearButton).click();
}
selecionarLista() {
return cy.get(ELEMENTS.unorderedList, { timeout: 3000 });
}
selecionarItemsDaLista() {
return cy.get(ELEMENTS.listItems, { timeout: 3000 });
}
selecionarPrimeiroBotaoRemover() {
return this.selecionarItemsDaLista().within(() => {
return cy.get(`[name="btn__remove"]`).first()
});
}
removerPrimeiroItem() {
return this.selecionarPrimeiroBotaoRemover().click();
}
popularLista(waitFor = 200) {
this.inserir("rust-lang/rust");
this.clicarAdicionar();
this.selecionarItemsDaLista().wait(waitFor);
this.inserir("reactjs/reactjs.org");
this.clicarAdicionar();
this.selecionarItemsDaLista().wait(waitFor);
this.inserir("thiagojacinto/es6-review");
this.clicarAdicionar();
this.selecionarItemsDaLista().wait(waitFor);
}
limparLista() {
return cy.get(ELEMENTS.clearButton).click();
}
}
export default new Home();