describe('Shopping Cart Functionality', () => {
it('should add items to cart', () => {
cy.visit('/products')
cy.get('[data-testid="add-to-cart"]').click()
cy.get('[data-testid="cart-items"]').should('have.length', 1)
})
})
describe('Shopping Cart', () => {
beforeEach(() => {
cy.visit('/shop')
})
it('should add product to cart', () => {
cy.get('[data-testid="product-item"]').first().click()
cy.get('[data-testid="add-to-cart"]').click()
cy.get('[data-testid="cart-count"]').should('have.text', '1')
})
})
describe('Authentication', () => {
it('should login successfully', () => {
cy.intercept('POST', '/api/login').as('loginRequest')
cy.visit('/login')
cy.get('#email').type('user@example.com')
cy.get('#password').type('password123')
cy.get('button[type="submit"]').click()
cy.wait('@loginRequest')
cy.url().should('include', '/dashboard')
})
})
bash
npm install @testquality/cypress-reporter --save-dev
javascript
const { defineConfig } = require('cypress')
module.exports = defineConfig({
reporter: '@testquality/cypress-reporter',
reporterOptions: {
apiKey: 'YOUR_API_KEY',
projectId: 'YOUR_PROJECT_ID',
testRunName: 'Cypress Test Run'
}
})