Skip to content

Instantly share code, notes, and snippets.

View yagudaev's full-sized avatar

Michael Yagudaev yagudaev

View GitHub Profile
@yagudaev
yagudaev / cypress-resetting-state-do.js
Created January 21, 2019 20:33
Testing Your Frontend with Cypress.io Framework
// This is what you want...
describe('Shopping Cart', () => {
before(() => {
cy.login('michael@example.com', 'password')
})
beforeEach(() => {
resetShoppingCart()
})
@yagudaev
yagudaev / resetting-state-dont.js
Created January 21, 2019 20:30
Testing Your Frontend with Cypress.io Framework
// not great...
describe('Shopping Cart', () => {
before(() => {
cy.login('michael@example.com', 'password')
})
it('add item to cart', () => {
cy.visit('/products/fidget-spinner-1')
cy.contains('Add To Cart').click()
cy.contains('Show Cart').click()
@yagudaev
yagudaev / error.js
Created January 21, 2019 20:28
Testing Your Frontend with Cypress.io Framework
renderWelcome() {
// oooppps, did we mean logins?
if (props.user.pro && props.user.login.length === 1) {
return <p>Thank you for supporting us!</p>
} else {
return <p>Welcome back {props.user.firstName}</p>
}
}
@yagudaev
yagudaev / cypress_integration_login.pro.spec.js
Last active February 25, 2019 22:39
Testing Your Frontend with Cypress.io Framework
it('A Pro User logs in and sees a thank you message for the first time', () => {
loginWith('new-pro@example.com', 'passsword')
expect(cy.contains('Thank you for supporting us!')).to.exist
})
it('A Pro User logs in and sees and sees a welcome message', () => {
loginWith('old-pro@example.com', 'passsword')
expect(cy.contains('Welcome back John')).to.exist
})
@yagudaev
yagudaev / cypress_integration_login.spec.js
Last active February 25, 2019 22:40
Testing Your Frontend with Cypress.io Framework
// cypress/integration/login.spec.js
describe('login', () => {
beforeEach(() => {
visitLoginPage()
})
it('A User logs in and sees a welcome message', () => {
loginWith('michael@example.com', 'passsword')
expect(cy.contains('Welcome back Michael')).to.exist
@yagudaev
yagudaev / login.spec.js
Last active February 25, 2019 22:39
Testing Your Frontend with Cypress.io Framework
// cypress/integration/login.spec.js
describe('login', () => {
beforeEach(() => {
visitLoginPage()
})
it('A User logs in and sees a welcome message', () => {
loginWith('michael@example.com', 'passsword')
expect(cy.contains('Welcome back Michael')).to.exist
protocol ArrayRepresentable {
typealias ArrayType
func toArray() -> ArrayType[]
}
extension Range : ArrayRepresentable {
func toArray() -> T[] {
return T[](self)
}
@yagudaev
yagudaev / file.js
Created December 3, 2012 06:28
My Awesome Javascript Function
function foo()
@yagudaev
yagudaev / Custom.css
Created June 30, 2012 18:59 — forked from bentruyman/Custom.css
Dark Theme for Chrome Dev tools
/**********************************************/
/*
/* IR_Black Skin by Ben Truyman - 2011
/*
/* Based on Todd Werth's IR_Black:
/* http://blog.toddwerth.com/entries/2
/*
/* Inspired by Darcy Clarke's blog post:
/* http://darcyclarke.me/design/skin-your-chrome-inspector/
/*