Skip to content

docs: configurando ambiente #16

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Cypress Tests

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
cypress-run:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18

- name: Install dependencies
run: npm install

- name: Run Cypress tests
run: npx cypress run
7 changes: 7 additions & 0 deletions cypress.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const { defineConfig } = require("cypress");

module.exports = defineConfig({
e2e: {
baseUrl: 'http://uitestingplayground.com'
},
});
60 changes: 60 additions & 0 deletions cypress/e2e/ui-test.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
describe('UI Test', () => {
it('Deve clicar no botão sem usar o ID dinâmico', () => {
cy.visit('/dynamicid')

cy.contains('button', 'Button with Dynamic ID')
.should('be.visible')
.click()
.should('have.text', 'Button with Dynamic ID')
})

it('Deve exibir alerta ao clicar no botão primário', () => {
cy.visit('/classattr')

cy.on('window:alert', cy.stub().as('alert'))
cy.get('.btn-primary').click()
cy.get('@alert')
.should('have.been.calledWith', 'Primary button pressed')
})

it('Deve impedir clique duplo no botão verde', () => {
cy.visit('/hiddenlayers')

cy.get('#greenButton').click()
cy.get('#greenButton').click({ force: true })


cy.get('#blueButton')
.should('exist')
.and('have.length', 1)

})

it('Deve navegar até "Load Delay" e clicar no botão após o carregamento', () => {
cy.visit('/')
cy.contains('a', 'Load Delay')
.click()
cy.contains('button', 'Button Appearing After Delay')
.should('be.visible')
.click()
})

it('Deve aguardar o carregamento do texto via AJAX', () => {
cy.visit('/ajax')

cy.contains('button', 'Button Triggering AJAX Request')
.click()
cy.contains('Data loaded with AJAX get request.', { timeout: 20000 })
.should('be.visible')
})

it.only('Deve aguardar o texto do rótulo aparecer após o processamento no lado do cliente', () => {
cy.visit('/clientdelay')

cy.contains('button', 'Button Triggering Client Side Logic')
.click()
cy.contains('Data calculated on the client side.', {timeout: 15000})
.should('be.visible')
})

})
5 changes: 5 additions & 0 deletions cypress/fixtures/example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "Using fixtures to represent data",
"email": "hello@cypress.io",
"body": "Fixtures are a great way to mock data for responses to routes"
}
25 changes: 25 additions & 0 deletions cypress/support/commands.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// ***********************************************
// This example commands.js 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) => { ... })
17 changes: 17 additions & 0 deletions cypress/support/e2e.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// ***********************************************************
// This example support/e2e.js is processed and
// loaded automatically before your test files.
//
// This is a great place to put global configuration and
// behavior that modifies Cypress.
//
// You can change the location of this file or turn off
// automatically serving support files with the
// 'supportFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/configuration
// ***********************************************************

// Import commands.js using ES2015 syntax:
import './commands'
Loading