-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'julio' of https://github.com/IrvingYHM/Opticenter into …
…irving
- Loading branch information
Showing
17 changed files
with
38,668 additions
and
7,927 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,35 @@ | ||
name: PWA CI/CD Workflow # Nombre del flujo de trabajo | ||
name: Cypress CI | ||
|
||
# Definir los eventos que activan el flujo de trabajo | ||
on: | ||
push: | ||
branches: | ||
- Irving | ||
- Julio | ||
- Jesus | ||
- Master | ||
- master # Despliegue en producción | ||
- julio # Ramas de desarrollo | ||
- irving # Ramas de desarrollo | ||
- jesus # Ramas de desarrollo | ||
- feature/* | ||
pull_request: | ||
branches: | ||
- Irving | ||
- Julio | ||
- Jesus | ||
- Master | ||
workflow_dispatch: # Activación manual opcional | ||
- master | ||
- julio | ||
- irving | ||
- jesus | ||
workflow_dispatch: # Activación manual opcional | ||
|
||
# Definir los trabajos (jobs) a ejecutar | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest # Sistema operativo donde se ejecutará el flujo | ||
|
||
cypress: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 # Descargar el código del repositorio | ||
uses: actions/checkout@v2 # Clonar el repositorio | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v2 # Configurar Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: '16' # Especificar la versión de Node.js | ||
node-version: '16' | ||
|
||
- name: Install dependencies | ||
run: npm install # Instalar las dependencias del proyecto | ||
run: npm install --legacy-peer-deps # Instalar dependencias | ||
|
||
- name: Run tests | ||
run: npm test # Ejecutar las pruebas del proyecto | ||
- name: Run Cypress tests | ||
run: npx cypress run # Ejecutar las pruebas de Cypress |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { defineConfig } from "cypress"; | ||
|
||
export default defineConfig({ | ||
e2e: { | ||
baseUrl: 'https://opticenter-hu.vercel.app', // Cambia al puerto que estés usando | ||
setupNodeEvents(on, config) { | ||
// Implementa aquí los node event listeners si los necesitas | ||
}, | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
describe('Mi primera prueba', () => { | ||
it('Visita la página de ejemplo', () => { | ||
cy.visit('https://opticenter-hu.vercel.app'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
describe('Validación de Campos', () => { | ||
it('Mostrar error cuando el correo está vacío en el formulario de inicio de sesión', () => { | ||
cy.visit('/inicioS'); // Ruta a la página de login | ||
cy.get('input[placeholder="Correo electronico"]').clear(); | ||
cy.get('input[placeholder="Contraseña"]').type('password123'); | ||
cy.get('button[type="submit"]').click(); | ||
cy.contains('El campo es requerido'); // Mensaje de error esperado | ||
}); | ||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
//carga inicial y visualización de productos | ||
|
||
|
||
describe('Página de productos', () => { | ||
it('Carga y muestra productos', () => { | ||
cy.visit('/lentes'); // Visita la ruta de productos | ||
cy.contains('¡Descubre nuestra colección de lentes!'); // Asegura que el mensaje de bienvenida esté visible | ||
cy.get('.w-80').should('have.length.greaterThan', 0); // Comprueba que al menos un producto esté visible | ||
}); | ||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"name": "Using fixtures to represent data", | ||
"email": "[email protected]", | ||
"body": "Fixtures are a great way to mock data for responses to routes" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) => { ... }) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
/** | ||
* Copyright 2018 Google Inc. All Rights Reserved. | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
// If the loader is already loaded, just stop. | ||
if (!self.define) { | ||
let registry = {}; | ||
|
||
// Used for `eval` and `importScripts` where we can't get script URL by other means. | ||
// In both cases, it's safe to use a global var because those functions are synchronous. | ||
let nextDefineUri; | ||
|
||
const singleRequire = (uri, parentUri) => { | ||
uri = new URL(uri + ".js", parentUri).href; | ||
return registry[uri] || ( | ||
|
||
new Promise(resolve => { | ||
if ("document" in self) { | ||
const script = document.createElement("script"); | ||
script.src = uri; | ||
script.onload = resolve; | ||
document.head.appendChild(script); | ||
} else { | ||
nextDefineUri = uri; | ||
importScripts(uri); | ||
resolve(); | ||
} | ||
}) | ||
|
||
.then(() => { | ||
let promise = registry[uri]; | ||
if (!promise) { | ||
throw new Error(`Module ${uri} didn’t register its module`); | ||
} | ||
return promise; | ||
}) | ||
); | ||
}; | ||
|
||
self.define = (depsNames, factory) => { | ||
const uri = nextDefineUri || ("document" in self ? document.currentScript.src : "") || location.href; | ||
if (registry[uri]) { | ||
// Module is already loading or loaded. | ||
return; | ||
} | ||
let exports = {}; | ||
const require = depUri => singleRequire(depUri, uri); | ||
const specialDeps = { | ||
module: { uri }, | ||
exports, | ||
require | ||
}; | ||
registry[uri] = Promise.all(depsNames.map( | ||
depName => specialDeps[depName] || require(depName) | ||
)).then(deps => { | ||
factory(...deps); | ||
return exports; | ||
}); | ||
}; | ||
} | ||
define(['./workbox-fec928b6'], (function (workbox) { 'use strict'; | ||
|
||
self.skipWaiting(); | ||
workbox.clientsClaim(); | ||
|
||
/** | ||
* The precacheAndRoute() method efficiently caches and responds to | ||
* requests for URLs in the manifest. | ||
* See https://goo.gl/S9QRab | ||
*/ | ||
workbox.precacheAndRoute([{ | ||
"url": "/offline.html", | ||
"revision": "0.p67sb6el2t" | ||
}], {}); | ||
workbox.cleanupOutdatedCaches(); | ||
workbox.registerRoute(new workbox.NavigationRoute(workbox.createHandlerBoundToURL("/offline.html"), { | ||
allowlist: [/^\/$/] | ||
})); | ||
workbox.registerRoute(/https:\/\/backopt-production.up.railway.app\/productos\/productos/, new workbox.StaleWhileRevalidate({ | ||
"cacheName": "productos-cache", | ||
plugins: [new workbox.ExpirationPlugin({ | ||
maxEntries: 50, | ||
maxAgeSeconds: 86400 | ||
})] | ||
}), 'GET'); | ||
workbox.registerRoute(({ | ||
request | ||
}) => request.destination === "document" || request.destination === "script" || request.destination === "style", new workbox.CacheFirst({ | ||
"cacheName": "app-shell-cache", | ||
plugins: [new workbox.ExpirationPlugin({ | ||
maxEntries: 10, | ||
maxAgeSeconds: 604800 | ||
})] | ||
}), 'GET'); | ||
workbox.registerRoute(({ | ||
request | ||
}) => request.destination === "image", new workbox.CacheFirst({ | ||
"cacheName": "images-cache", | ||
plugins: [new workbox.ExpirationPlugin({ | ||
maxEntries: 50, | ||
maxAgeSeconds: 2592000 | ||
})] | ||
}), 'GET'); | ||
workbox.initialize({}); | ||
|
||
})); |
Oops, something went wrong.