Skip to content

Instantly share code, notes, and snippets.

/// <reference types="cypress" />
context('Portal', () => {
beforeEach(() => {
/**
Para autenticar no site são usados dois Cookies:
- OAuth_Token_Request_State
- JSESSIONID
@samlucax
samlucax / reporter.js
Created August 6, 2020 04:49
Código do reporter construído na Semana Agilizei 1.0 - Aula 04 - Relatórios
const reporter = require('cucumber-html-reporter')
const options = {
theme: 'bootstrap',
jsonDir: 'cypress/reports/cucumber-json',
output: 'cypress/reports/cucumber_report.html',
reportSuiteAsScenarios: true,
scenarioTimestamp: true,
launchReport: true,
metadata: {
// Cypress version: 6.5.0
context('Diego', () => {
beforeEach(() => {
// rota para os endpoints que trazem cada post
cy.intercept({
method: 'GET',
path: '/_next/data/**'
}).as('data')
@samlucax
samlucax / index.js
Last active December 19, 2020 15:02
Adicionar imagens + vídeos no relatório do Mochawesome
// Adicionar este código dentro de support/index.js
// Importante: aplicável para projetos que usam o mochawesome como relatório
// No cypress.json, setar as seguintes configs:
// "screenshotsFolder": "mochawesome-report/assets",
// "videosFolder": "mochawesome-report/videos"
import './commands'
import addContext from 'mochawesome/addContext'
@samlucax
samlucax / workshop.yml
Created November 11, 2020 03:27
Workshop CWI YAML
# Node.js
# Build a general Node.js project with npm.
# Add steps that analyze code, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/javascript
# quando o pipeline deve ser executado?
trigger:
- main
# qual máquina o pipeline deve ser executado?
@samlucax
samlucax / index.d.ts
Last active December 13, 2020 11:09
Cypress Commands Intellisense
/**
* Crie um arquivo index.d.ts na pasta support.
* Copie o conteúdo abaixo dentro do arquivo index.d.ts criado.
* Importante: esse NÃO substitui o index.js existente. Eles possuem finalidades diferentes.
*/
/// <reference types="cypress" />
declare namespace Cypress {
@samlucax
samlucax / main.yml
Created December 10, 2020 19:45
Semana Agilizei 2.0 - YAML
# This is a basic workflow to help you get started with Actions
name: CI
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [ main ]
pull_request:
@samlucax
samlucax / vscode_prefs.json
Created December 7, 2020 23:14
Preferências do Visual Studio Code
{
// Define o tema do VSCode
"workbench.colorTheme": "Dracula",
//Aumenta a fonte do terminal
"terminal.integrated.fontSize": 22,
// Define o tema dos ícones na sidebar
"workbench.iconTheme": "material-icon-theme",
"workbench.startupEditor": "newUntitledFile",
// Instale essa biblioteca em seu projeto com o comando abaixo:
// npm install jwt-decode
// adicione essa linha no topo do arquivo sempre que precisar usar
import jwt_decode from "jwt-decode";
describe('Exemplo', () => {
it('Exemplo JWT Decode', () => {
@samlucax
samlucax / index.js
Created November 18, 2020 13:44 — forked from r0nunes/index.js
Cypress: Running tests with multiple tags on grep
/// <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
// ***********************************************************