Skip to content

Instantly share code, notes, and snippets.

View nottyo's full-sized avatar

Traitanit Huangsri nottyo

View GitHub Profile
@nottyo
nottyo / cypress_sample.spec.js
Created October 29, 2018 03:32
cypress_sample.spec.js
/// <reference types="Cypress" />
describe('Cypress Test', () => {
beforeEach(() => {
cy.visit('https://www.cypress.io')
})
it('should has text \'npm install cypress\'', () => {
cy.get('[class="filler"]').should('contain', 'npm install cypress')
})
@nottyo
nottyo / .babelrc
Created July 6, 2019 08:49
babelrc for istanbul
{
"plugins": ["istanbul"]
}
@nottyo
nottyo / .nycrc
Created July 6, 2019 08:50
nycrc configuration for code coverage
{
"extension": [".js", ".vue"]
}
/// <reference types="Cypress" />
describe('Add Todo', () => {
beforeEach(() => {
cy.visit(Cypress.config('baseUrl'))
})
it('should be able to add new todo', () => {
const firstTodo = 'Writing a blog'
const secondTodo = 'Running'
@nottyo
nottyo / index.js
Created July 6, 2019 09:16
cypress/support/index.js
import '@cypress/code-coverage/support'
@nottyo
nottyo / index.js
Created July 6, 2019 09:17
cypress/plugins/index.js
module.exports = (on, config) => {
on('task', require('@cypress/code-coverage/task'))
}
@nottyo
nottyo / cypress.json
Created July 14, 2019 13:42
cypress.reporter.dot.json
{
"reporter": "dot"
}
@nottyo
nottyo / cypress.json
Last active July 14, 2019 14:05
cypress.nyan.json
{
"reporter": "nyan"
}
@nottyo
nottyo / report-config.json
Created July 14, 2019 14:18
mochawesome.json
{
"reportDir": "cypress/report/mochawesome-report",
"overwrite": true,
"html": true,
"json": true
}
}
@nottyo
nottyo / index.js
Last active July 16, 2019 10:11
cypress support file (cypress/support/index.js)
const addContext = require('mochawesome/addContext')
Cypress.on('test:after:run', (test, runnable) => {
if (test.state === 'failed') {
const screenshotFileName = `${runnable.parent.title} -- ${test.title} (failed).png`
addContext({ test }, `assets/${Cypress.spec.name}/${screenshotFileName}`)
}
})