parent
31fde3457f
commit
7451d2ed60
@ -0,0 +1,9 @@
|
||||
const { defineConfig } = require("cypress");
|
||||
|
||||
module.exports = defineConfig({
|
||||
e2e: {
|
||||
setupNodeEvents(on, config) {
|
||||
// implement node event listeners here
|
||||
},
|
||||
},
|
||||
});
|
@ -0,0 +1,64 @@
|
||||
describe('Project Toast Notification', () => {
|
||||
beforeEach(() => {
|
||||
cy.visit('http://127.0.0.1:5500/toast-notification/index.html')
|
||||
})
|
||||
|
||||
it('Opens the homepage', () => {
|
||||
|
||||
})
|
||||
|
||||
it('The screen is visble', () => {
|
||||
cy.get('body').should('be.visible')
|
||||
})
|
||||
|
||||
context('Body', () => {
|
||||
context('Background', () => {
|
||||
it('The background is visible', () => {
|
||||
cy.get('body').should('be.visible')
|
||||
})
|
||||
|
||||
it('The background color is correct', () => {
|
||||
cy.get('body').should('be.visible').should('have.css', 'background-color', 'rgb(102, 51, 153)')
|
||||
})
|
||||
})
|
||||
|
||||
context('Content', () => {
|
||||
context('Button', () => {
|
||||
it('The button is visible', () => {
|
||||
cy.xpath('//button[@class="btn"]').should('be.visible')
|
||||
})
|
||||
|
||||
it('The button has correct background color', () => {
|
||||
cy.xpath('//button[@class="btn"]').should('be.visible')
|
||||
.should('have.css', 'background-color', 'rgb(255, 255, 255)')
|
||||
})
|
||||
|
||||
it('The text in the button is visible', () => {
|
||||
cy.xpath('//button[@class="btn"]').should('be.visible')
|
||||
.invoke('text').should('exist')
|
||||
})
|
||||
|
||||
it('The text is correct', () => {
|
||||
cy.xpath('//button[@class="btn"]').should('be.visible')
|
||||
.invoke('text').should('include', 'Show Notification')
|
||||
})
|
||||
|
||||
it('The text has correct color', () => {
|
||||
cy.xpath('//button[@class="btn"]').should('be.visible')
|
||||
.should('have.css', 'color', 'rgb(102, 51, 153)')
|
||||
})
|
||||
|
||||
it('The button is clickable', () => {
|
||||
cy.xpath('//button[@class="btn"]').should('be.visible').click()
|
||||
})
|
||||
|
||||
it('When I click on the button, it generates notification messages on the bottom', () => {
|
||||
cy.xpath('//button[@class="btn"]').should('be.visible').click()
|
||||
cy.get('.toast').should('have.length.gt', 0);
|
||||
cy.wait(10000);
|
||||
cy.get('.toast').should('have.length', 0);
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
@ -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"
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
// ***********************************************
|
||||
// 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) => { ... })
|
||||
|
||||
import 'cypress-xpath';
|
@ -0,0 +1,20 @@
|
||||
// ***********************************************************
|
||||
// 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'
|
||||
|
||||
// Alternatively you can use CommonJS syntax:
|
||||
// require('./commands')
|
Loading…
Reference in new issue