Skip to content

Instantly share code, notes, and snippets.

View jennifer-shehane's full-sized avatar

Jennifer Shehane jennifer-shehane

View GitHub Profile
@jennifer-shehane
jennifer-shehane / getIdForLater.js
Last active April 8, 2020 14:17
Get ID for later use using custom command
Cypress.Commands.add('getTaskId', (applicationId, retry) => {
function maybeRetryReq() {
return cy.request(({
url: `https://jsonplaceholder.cypress.io/users`
})).then((response) => {
const responseId = response.body[0].id
if (responseId) {
return responseId
}
@jennifer-shehane
jennifer-shehane / local-storage-restore.js
Last active March 9, 2020 04:46
restoring local storage over tests
let LOCAL_STORAGE_MEMORY = {};
Cypress.Commands.add("saveLocalStorage", () => {
cy.log("saveLocalStorage");
Object.keys(localStorage).forEach(key => {
LOCAL_STORAGE_MEMORY[key] = localStorage[key];
console.log('localStorage')
cy.log("saving[" + key + "]");
});
});
@jennifer-shehane
jennifer-shehane / flaky-tests-03-2020.md
Last active March 6, 2020 10:09
Flaky Tests - Mar 2020
@jennifer-shehane
jennifer-shehane / github_saved_replies.md
Last active February 26, 2020 07:47
Jennifer's GitHub Saved Replies for Cypress Repos

+ New issue in docs

I created a new issue in our docs to document {{THING TO DOCUMENT}} here: {{LINK TO ISSUE}}. Our documentation is open source and contributions are welcome. 😄

+ New issue in recipes

I created a new issue in our example recipes repo to add a new recipe for {{THING TO DOCUMENT}} here: {{LINK TO ISSUE}}. Our example recipes are open source and contributions are welcome. 😄

+ Add to plugins

@jennifer-shehane
jennifer-shehane / pr-review-3-5-0.md
Last active October 21, 2019 14:23
PR Reviews (3.5.0)
module.exports = function() {
Cypress.Commands.add('sqlServer', (query) => {
if(!query) {
throw new Error('Query must be set');
}
cy.task('sqlServer:execute', query).then(response => {
let result = [];
const flatten = r => Array.isArray(r) && r.length === 1 ? flatten(r[0]) : r;
cy.get('timeentry_lov1',{timeout : 60000}).eq(1).select('NB-860').debug();
cy.get('timeentry_lov1').eq(1).select('NB-860-Test Automation');
cy.select('timeentry_lov1',{timeout : 7000}).eq(1).should('have.value','NB-860');
cy.find('timeentry_lov1').get('select').select('NB-860');
cy.server();
cy
.route({ method: 'GET', url: '/api/users/*/attributes/checkout-shipping-details' })
.as('deleteCartReq1')
.route({ method: 'GET', url: '/api/countries' }).as('deleteCartReq2')
.route({ method: 'GET', url: '/api/currencies' }).as('deleteCartReq3')
.route({ method: 'GET', url: '/api/users/*/wishlist/saved?limit=100' }).as('deleteCartReq4')
.route({ method: 'GET', url: '/api/users/*/cart/config' }).as('deleteCartReq5')
.route({ method: 'GET', url: '/api/users/*/cart/estimate' }).as('deleteCartReq6')
cy.wait(
it('check validation message on invalid input', () => {
cy.visit('index.html')
cy.get('input:invalid').should('have.length', 0)
cy.get('#mail').type('f') // type something invalid into input
cy.get('button').click() // submit the form
cy.get('input:invalid').should('have.length', 1)
cy.get('#mail').then(($input) => {
expect($input[0].validationMessage).to.eq('I expect an email!')
})
})
Description Link 👍❤️ 👀🎉
"text content" command cypress-io/cypress#630 👍 14
cy.click() fail due to 0x0 size, even though it's not cypress-io/cypress#695 👍 47
KeystrokeDelay for cy.type() cypress-io/cypress#566 👍 16
Ability to disable JS cypress-io/cypress#1611 👍 31
Print console logs to stdout + command log cypress-io/cypress#700 cypress-io/cypress#300 👍 25 + 👍 23
Print reasons why something isn't visible cypress-io/cypress#677 cypress-io/cypress#696 👍 20
Scrollto failure cypress-io/cypress#1924 👍6