-
-
Notifications
You must be signed in to change notification settings - Fork 974
Expand file tree
/
Copy pathcommands.ts
More file actions
54 lines (53 loc) · 2.14 KB
/
Copy pathcommands.ts
File metadata and controls
54 lines (53 loc) · 2.14 KB
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
// / <reference types="cypress" />
// ***********************************************
// This example commands.ts shows you how to
// create various custom commands and overwrite
// existing commands.
//
// For more comprehensive examples of custom
// commands please read more here:
// https://on.cypress.io/custom-commands
// ***********************************************
//
//
// -- This is a parent command --
// Cypress.Commands.add('login', (email, password) => { ... })
//
//
// -- This is a child command --
// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... })
//
//
// -- This is a dual command --
// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... })
//
//
// -- This will overwrite an existing command --
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
//
// declare global {
// namespace Cypress {
// interface Chainable {
// login(email: string, password: string): Chainable<void>
// drag(subject: string, options?: Partial<TypeOptions>): Chainable<Element>
// dismiss(subject: string, options?: Partial<TypeOptions>): Chainable<Element>
// visit(originalFn: CommandOriginalFn, url: string, options: Partial<VisitOptions>): Chainable<Element>
// }
// }
// }
// methods
Cypress.Commands.add('header', () => {
cy.get('[data-testid="app-header"]').should('be.visible');
cy.get('[data-testid="app-logo"]').should('be.visible');
cy.get('[data-testid="plays-search-box-container"]').should('not.exist');
cy.get('[data-testid="header-links-container"]').should('be.visible');
cy.get('[data-testid="browse-btn"]').should('be.visible').as('browseBtn');
cy.get('[data-testid="create-btn"]').should('be.visible');
cy.get('[data-testid="ideas-btn"]').should('be.visible');
cy.get('[data-testid="github-btn"]').should('be.visible');
cy.get('[data-testid="twitter-btn"]').should('be.visible');
cy.get('[data-testid="share-btn"]').should('be.visible');
cy.get('[data-testid="leaderboard-btn"]').should('be.visible');
cy.get('@browseBtn').click();
cy.get('[data-testid="plays-search-box-container"]').should('be.visible');
});