-
Notifications
You must be signed in to change notification settings - Fork 0
/
cypress_tests.js
66 lines (60 loc) · 1.85 KB
/
cypress_tests.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
57
58
59
60
61
62
63
64
65
66
// cypress_tests.js created with Cypress
//
// Start writing your Cypress tests below!
// If you're unfamiliar with how Cypress works,
// check out the link below and learn how to write your first test:
// https://on.cypress.io/writing-first-test
describe('MainMenu->ReturnMainMenu', () => {
it('Visit localhost', () => {
cy.visit('localhost:3000');
})
it('Expect Game Container', () => {
cy.get('.game-container');
})
it('Expect Introduction', () => {
//cy.get('instructions-text');
})
it('Pass Introduction', () => {
cy.get('button').contains("I understand").click();
})
it('Try Introduction Button', () => {
cy.get('button').contains("Instructions").click();
})
})
describe('Init Game', () => {
it('Visit Localhost', () => {
cy.visit('localhost:3000')
})
it('Pass Introduction', () => {
cy.get('button').contains('I understand').click();
})
it('Click "Start Game"', () => {
cy.get('button').contains('Start game').click();
})
it('Expect Countdown', () => {
cy.get('.countdown').find("div").should('have.class', 'countdown-indicator');
})
it('Wait Countdown', () => {
for (let i = 3; i > 0; i--) {
if(i!=1){
cy.get('.countdown').should('have.text', i.toString());
cy.wait(1000);
cy.get('.countdown').should('not.have.text', i.toString());
}else{
cy.get('.countdown').should('not.exist');
}
}
})
})
const text = "";
describe('Play the Game', () => {
it('Get Statement', () => {
cy.get('.statement').should(($btn) => {
text = $btn.text();
cy.log(text);
})
})
it('Find Statement', () => {
//cy.get('.statement').find('div').should('have.class', '')
})
})