Skip to content

Commit

Permalink
test: 🧪 instalando e testando com cypress
Browse files Browse the repository at this point in the history
  • Loading branch information
pcbrsites committed Dec 6, 2021
1 parent 2678ee5 commit 941188e
Show file tree
Hide file tree
Showing 11 changed files with 8,809 additions and 45 deletions.
File renamed without changes.
3 changes: 3 additions & 0 deletions cypress.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"baseUrl": "http://localhost:3000/"
}
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": "[email protected]",
"body": "Fixtures are a great way to mock data for responses to routes"
}
37 changes: 37 additions & 0 deletions cypress/integration/1-home/link.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/// <reference types="cypress" />

describe("AHUB", () => {
beforeEach(() => {});

it("ABRIR HOME E CHECK SE EXISTE POP E TECH E LINK", () => {
cy.visit("/");
cy.wait(1000);
cy.contains("A HUB É POP");
cy.wait(400);
cy.contains("A HUB É TECH");
cy.wait(400);
cy.contains("QUERO FAZER PARTE");
cy.wait(400);
cy.get(".discord_btn")
.invoke("attr", "href")
.then((href) => {
cy.get(`[href="${href}"]`).should("have.length", 3);
});
});

it("ABRIR PAGINA DO DISCORD", () => {
cy.visit("/");
cy.get(".discord_btn").click();
// Convite Inválido
});

it("ABRIR BLOG", () => {
cy.visit("/");
cy.get('[href="https://blog.ahub.tech/"]').click();
});

it("ABRIR GITHUB ", () => {
cy.visit("/");
cy.get('[href="https://github.com/aHub-Tech"]').click();
});
});
22 changes: 22 additions & 0 deletions cypress/plugins/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/// <reference types="cypress" />
// ***********************************************************
// This example plugins/index.js can be used to load plugins
//
// You can change the location of this file or turn off loading
// the plugins file with the 'pluginsFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/plugins-guide
// ***********************************************************

// This function is called when a project is opened or re-opened (e.g. due to
// the project's config changing)

/**
* @type {Cypress.PluginConfig}
*/
// eslint-disable-next-line no-unused-vars
module.exports = (on, config) => {
// `on` is used to hook into various events Cypress emits
// `config` is the resolved Cypress config
}
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) => { ... })
20 changes: 20 additions & 0 deletions cypress/support/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// ***********************************************************
// This example support/index.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')
10 changes: 7 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,17 @@
"dev": "nuxt",
"build": "nuxt build",
"start": "nuxt start",
"generate": "nuxt generate"
"generate": "nuxt generate",
"cy:open": "cypress open",
"cy:run": "cypress run"
},
"dependencies": {
"@nuxtjs/axios": "^5.13.6",
"@nuxtjs/pwa": "^3.3.5",
"core-js": "^3.15.1",
"nuxt": "^2.15.7"
},
"devDependencies": {}
}
"devDependencies": {
"cypress": "^9.1.1"
}
}
42 changes: 0 additions & 42 deletions pages/Home/index.vue

This file was deleted.

50 changes: 50 additions & 0 deletions pages/index.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<template>
<main class="cover">
<div class="cover_container">
<div class="cover_text">
<h2>A HUB É <span>POP</span></h2>
<h2>A HUB É <span>TECH</span></h2>
<div class="title_bar"></div>
<p>
Aqui você encontrará os mais diversos assuntos pertinentes ao mundo de
TI, conhecerá diversas pessoas e se divertirá muito enquanto aprende e
ensina!
</p>
<a
href="https://discord.com/invite/RMDSHVkDmE"
target="_blank"
class="discord_btn"
>
<i class="mdi mdi-discord"></i>
QUERO FAZER PARTE
</a>
</div>
<img src="cover.svg" alt="" />
</div>
<div class="cover_links">
<a target="_blank" href="https://github.com/aHub-Tech" class="cover_link">
<i class="mdi mdi-github"></i>
</a>
<a
target="_blank"
href="https://discord.com/invite/RMDSHVkDmE"
class="cover_link"
>
<i class="mdi mdi-discord"></i>
</a>
</div>
</main>
</template>

<script>
export default {
layout: "site/default",
head() {
return {
title: "Inicio",
};
},
};
</script>

<style src="~/assets/css/pages/Home.css"></style>
Loading

0 comments on commit 941188e

Please sign in to comment.