Skip to content
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
10 changes: 10 additions & 0 deletions cypress.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const { defineConfig } = require("cypress");

module.exports = defineConfig({
e2e: {
baseUrl: 'https://the-internet.herokuapp.com',
viewportHeight: 500,
viewportWidth: 700,

},
});
12 changes: 12 additions & 0 deletions cypress/e2e/abtesting.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
describe('AB/Testing functionality', () => {
beforeEach(() => {
cy.intercept({ resourceType: /xhr|fetch/ }, { log: false });
});

it('should display the correct content based on the test version', () => {
cy.visit('/abtest');

// Verificar que el elemento <h3> contiene el texto "A/B Test"
cy.contains('h3', 'A/B Test').should('be.visible');
});
});
35 changes: 35 additions & 0 deletions cypress/e2e/addRemove.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
describe('Add/Remove Elements functionality', () => {
beforeEach(() => {
cy.intercept({ resourceType: /xhr|fetch/ }, { log: false });
cy.visit('/add_remove_elements/');
});

it('add/remove elements', () => {
// Hacer clic dos veces en "Add Element" usando el comando personalizado
cy.clickAddElement();
cy.clickAddElement();

// Verificar que ambos botones "Delete" sean visibles
cy.get('button') // Selecciona todos los botones
.filter(':contains("Delete")') // Filtra los que contienen el texto "Delete"
.should('have.length', 2) // Verifica que hay exactamente 2 botones
.and('be.visible'); // Verifica que ambos sean visibles

cy.clickDelete();
cy.get('button')
.filter(':contains("Delete")') // Filtra los que contienen el texto "Delete"
.should('have.length', 1) // Verifica que hay exactamente 2 botones
cy.clickDelete();

cy.get('button')
.filter(':contains("Delete")') // Filtra los que contienen el texto "Delete"
.should('not.exist')

cy.get('button')
.should('have.length', 1) // Verifica que hay exactamente 1 boton
});


});


29 changes: 29 additions & 0 deletions cypress/e2e/basicAuth.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
describe('Basic Auth functionality', () => {
beforeEach(() => {
// Centraliza la visita a la página con autenticación básica
cy.visit('/basic_auth', {
auth: {
username: 'admin',
password: 'admin',
},
});
});




it('should display the success message', () => {
// Verificar que el encabezado esté visible
cy.contains('h3', 'Basic Auth').should('be.visible');

// Verificar que el mensaje de éxito esté visible
cy.contains('p', 'Congratulations! You must have the proper credentials.').should('be.visible');
});

it('should not display an error', () => {
// Verificar que no haya mensajes de error
cy.contains('Error').should('not.exist');
});


});
17 changes: 17 additions & 0 deletions cypress/e2e/challengingDom.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
describe('Challenging DOM', () => {
beforeEach(() => {
cy.visit('/challenging_dom')
});

it('should interact with the challenging DOM elements', () => {
// Test implementation goes here
cy.get('.button').not('.alert, .success');
cy.get('.button').filter('.alert');
cy.get('.button').filter('.success');
});

it('should perform another action', () => {
// Implement another test or remove this block if unnecessary
cy.get('table').should('be.visible');
});
});
35 changes: 35 additions & 0 deletions cypress/e2e/checkboxes.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
//"estamos comprobando el funcionamiento de"
describe('Checkboxes', () => {
beforeEach(()=> {
cy.visit('/checkboxes')
})
//"esto deberia"
it('should check the checkboxes functionality', () => {
cy.contains('h3', 'Checkboxes')
.should("be.visible")

// Verificar que el primer checkbox esté desactivado (no marcado)
cy
.get('input')
.eq(0)
.as('input0')
.check()

cy
.get('@input0')
.should('be.checked')



cy
.get('input')
.eq(1)
.as('input1')
.uncheck()

cy
.get('@input1')
.should('not.be.checked')

})
})
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"
}
33 changes: 33 additions & 0 deletions cypress/support/commands.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// ***********************************************
// 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) => { ... })

Cypress.Commands.add('clickAddElement', () => {
cy.contains('button', 'Add Element').click();
});

Cypress.Commands.add('clickDelete', () => {
cy.contains('button', 'Delete').click();
});
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