cypress-example-kitchensink
Advanced tools
Comparing version 2.0.2 to 2.0.3
@@ -12,18 +12,18 @@ /// <reference types="cypress" /> | ||
// https://on.cypress.io/type | ||
cy.get('.action-email') | ||
.type('fake@email.com').should('have.value', 'fake@email.com') | ||
cy.get('.action-email').type('fake@email.com') | ||
cy.get('.action-email').should('have.value', 'fake@email.com') | ||
// .type() with special character sequences | ||
.type('{leftarrow}{rightarrow}{uparrow}{downarrow}') | ||
.type('{del}{selectall}{backspace}') | ||
// .type() with special character sequences | ||
cy.get('.action-email').type('{leftarrow}{rightarrow}{uparrow}{downarrow}') | ||
cy.get('.action-email').type('{del}{selectall}{backspace}') | ||
// .type() with key modifiers | ||
.type('{alt}{option}') //these are equivalent | ||
.type('{ctrl}{control}') //these are equivalent | ||
.type('{meta}{command}{cmd}') //these are equivalent | ||
.type('{shift}') | ||
// .type() with key modifiers | ||
cy.get('.action-email').type('{alt}{option}') //these are equivalent | ||
cy.get('.action-email').type('{ctrl}{control}') //these are equivalent | ||
cy.get('.action-email').type('{meta}{command}{cmd}') //these are equivalent | ||
cy.get('.action-email').type('{shift}') | ||
// Delay each keypress by 0.1 sec | ||
.type('slow.typing@email.com', { delay: 100 }) | ||
.should('have.value', 'slow.typing@email.com') | ||
// Delay each keypress by 0.1 sec | ||
cy.get('.action-email').type('slow.typing@email.com', { delay: 100 }) | ||
cy.get('.action-email').should('have.value', 'slow.typing@email.com') | ||
@@ -34,3 +34,3 @@ cy.get('.action-disabled') | ||
.type('disabled error checking', { force: true }) | ||
.should('have.value', 'disabled error checking') | ||
cy.get('.action-disabled').should('have.value', 'disabled error checking') | ||
}) | ||
@@ -41,3 +41,3 @@ | ||
cy.get('.action-focus').focus() | ||
.should('have.class', 'focus') | ||
cy.get('.action-focus').should('have.class', 'focus') | ||
.prev().should('have.attr', 'style', 'color: orange;') | ||
@@ -48,4 +48,5 @@ }) | ||
// https://on.cypress.io/blur | ||
cy.get('.action-blur').type('About to blur').blur() | ||
.should('have.class', 'error') | ||
cy.get('.action-blur').type('About to blur') | ||
cy.get('.action-blur').blur() | ||
cy.get('.action-blur').should('have.class', 'error') | ||
.prev().should('have.attr', 'style', 'color: red;') | ||
@@ -57,5 +58,5 @@ }) | ||
cy.get('.action-clear').type('Clear this text') | ||
.should('have.value', 'Clear this text') | ||
.clear() | ||
.should('have.value', '') | ||
cy.get('.action-clear').should('have.value', 'Clear this text') | ||
cy.get('.action-clear').clear() | ||
cy.get('.action-clear').should('have.value', '') | ||
}) | ||
@@ -69,3 +70,3 @@ | ||
cy.get('.action-form').submit() | ||
.next().should('contain', 'Your form has been submitted!') | ||
cy.get('.action-form').next().should('contain', 'Your form has been submitted!') | ||
}) | ||
@@ -106,9 +107,9 @@ | ||
cy.get('#action-canvas') | ||
.click(80, 75) // click 80px on x coord and 75px on y coord | ||
.click(170, 75) | ||
.click(80, 165) | ||
.click(100, 185) | ||
.click(125, 190) | ||
.click(150, 185) | ||
.click(170, 165) | ||
cy.get('#action-canvas').click(80, 75) // click 80px on x coord and 75px on y coord | ||
cy.get('#action-canvas').click(170, 75) | ||
cy.get('#action-canvas').click(80, 165) | ||
cy.get('#action-canvas').click(100, 185) | ||
cy.get('#action-canvas').click(125, 190) | ||
cy.get('#action-canvas').click(150, 185) | ||
cy.get('#action-canvas').click(170, 165) | ||
@@ -127,3 +128,4 @@ // click multiple elements by passing multiple: true | ||
// that hides the div and shows an input on double click | ||
cy.get('.action-div').dblclick().should('not.be.visible') | ||
cy.get('.action-div').dblclick() | ||
cy.get('.action-div').should('not.be.visible') | ||
cy.get('.action-input-hidden').should('be.visible') | ||
@@ -137,3 +139,4 @@ }) | ||
// that hides the div and shows an input on right click | ||
cy.get('.rightclick-action-div').rightclick().should('not.be.visible') | ||
cy.get('.rightclick-action-div').rightclick() | ||
cy.get('.rightclick-action-div').should('not.be.visible') | ||
cy.get('.rightclick-action-input-hidden').should('be.visible') | ||
@@ -147,22 +150,22 @@ }) | ||
// matching checkbox or radio elements in succession, one after another | ||
cy.get('.action-checkboxes [type="checkbox"]').not('[disabled]') | ||
.check().should('be.checked') | ||
cy.get('.action-checkboxes [type="checkbox"]').not('[disabled]').check() | ||
cy.get('.action-checkboxes [type="checkbox"]').not('[disabled]').should('be.checked') | ||
cy.get('.action-radios [type="radio"]').not('[disabled]') | ||
.check().should('be.checked') | ||
cy.get('.action-radios [type="radio"]').not('[disabled]').check() | ||
cy.get('.action-radios [type="radio"]').not('[disabled]').should('be.checked') | ||
// .check() accepts a value argument | ||
cy.get('.action-radios [type="radio"]') | ||
.check('radio1').should('be.checked') | ||
cy.get('.action-radios [type="radio"]').check('radio1') | ||
cy.get('.action-radios [type="radio"]').should('be.checked') | ||
// .check() accepts an array of values | ||
cy.get('.action-multiple-checkboxes [type="checkbox"]') | ||
.check(['checkbox1', 'checkbox2']).should('be.checked') | ||
cy.get('.action-multiple-checkboxes [type="checkbox"]').check(['checkbox1', 'checkbox2']) | ||
cy.get('.action-multiple-checkboxes [type="checkbox"]').should('be.checked') | ||
// Ignore error checking prior to checking | ||
cy.get('.action-checkboxes [disabled]') | ||
.check({ force: true }).should('be.checked') | ||
cy.get('.action-checkboxes [disabled]').check({ force: true }) | ||
cy.get('.action-checkboxes [disabled]').should('be.checked') | ||
cy.get('.action-radios [type="radio"]') | ||
.check('radio3', { force: true }).should('be.checked') | ||
cy.get('.action-radios [type="radio"]').check('radio3', { force: true }) | ||
cy.get('.action-radios [type="radio"]').should('be.checked') | ||
}) | ||
@@ -177,3 +180,6 @@ | ||
.not('[disabled]') | ||
.uncheck().should('not.be.checked') | ||
.uncheck() | ||
cy.get('.action-check [type="checkbox"]') | ||
.not('[disabled]') | ||
.should('not.be.checked') | ||
@@ -183,3 +189,6 @@ // .uncheck() accepts a value argument | ||
.check('checkbox1') | ||
.uncheck('checkbox1').should('not.be.checked') | ||
cy.get('.action-check [type="checkbox"]') | ||
.uncheck('checkbox1') | ||
cy.get('.action-check [type="checkbox"][value="checkbox1"]') | ||
.should('not.be.checked') | ||
@@ -189,7 +198,12 @@ // .uncheck() accepts an array of values | ||
.check(['checkbox1', 'checkbox3']) | ||
.uncheck(['checkbox1', 'checkbox3']).should('not.be.checked') | ||
cy.get('.action-check [type="checkbox"]') | ||
.uncheck(['checkbox1', 'checkbox3']) | ||
cy.get('.action-check [type="checkbox"][value="checkbox1"]') | ||
.should('not.be.checked') | ||
cy.get('.action-check [type="checkbox"][value="checkbox3"]') | ||
.should('not.be.checked') | ||
// Ignore error checking prior to unchecking | ||
cy.get('.action-check [disabled]') | ||
.uncheck({ force: true }).should('not.be.checked') | ||
cy.get('.action-check [disabled]').uncheck({ force: true }) | ||
cy.get('.action-check [disabled]').should('not.be.checked') | ||
}) | ||
@@ -212,2 +226,3 @@ | ||
.select(['apples', 'oranges', 'bananas']) | ||
cy.get('.action-select-multiple') | ||
// when getting multiple values, invoke "val" method first | ||
@@ -219,2 +234,3 @@ .invoke('val') | ||
cy.get('.action-select').select('fr-bananas') | ||
cy.get('.action-select') | ||
// can attach an assertion right away to the element | ||
@@ -225,2 +241,3 @@ .should('have.value', 'fr-bananas') | ||
.select(['fr-apples', 'fr-oranges', 'fr-bananas']) | ||
cy.get('.action-select-multiple') | ||
.invoke('val') | ||
@@ -246,2 +263,3 @@ .should('deep.equal', ['fr-apples', 'fr-oranges', 'fr-bananas']) | ||
cy.get('#scroll-horizontal button').scrollIntoView() | ||
cy.get('#scroll-horizontal button') | ||
.should('be.visible') | ||
@@ -254,2 +272,3 @@ | ||
cy.get('#scroll-vertical button').scrollIntoView() | ||
cy.get('#scroll-vertical button') | ||
.should('be.visible') | ||
@@ -262,2 +281,3 @@ | ||
cy.get('#scroll-both button').scrollIntoView() | ||
cy.get('#scroll-both button') | ||
.should('be.visible') | ||
@@ -277,3 +297,5 @@ }) | ||
.invoke('val', 25) | ||
cy.get('.trigger-input-range') | ||
.trigger('change') | ||
cy.get('.trigger-input-range') | ||
.get('input[type=range]').siblings('p') | ||
@@ -280,0 +302,0 @@ .should('have.text', '25') |
@@ -85,3 +85,4 @@ /// <reference types="cypress" /> | ||
// cy.clearCookies() yields null | ||
cy.clearCookie('token').should('be.null') | ||
cy.clearCookie('token') | ||
cy.getCookie('token').should('be.null') | ||
@@ -88,0 +89,0 @@ cy.getCookie('token').should('be.null') |
@@ -15,3 +15,4 @@ /// <reference types="cypress" /> | ||
// ends the current chain and yields null | ||
cy.contains('Cheryl').click().end() | ||
cy.contains('Cheryl').click() | ||
//.end() | ||
@@ -18,0 +19,0 @@ // queries the entire table again |
@@ -79,2 +79,3 @@ /// <reference types="cypress" /> | ||
cy.get('#clock-div').click() | ||
cy.get('#clock-div') | ||
.should('have.text', '1489449600') | ||
@@ -93,2 +94,3 @@ }) | ||
cy.get('#tick-div').click() | ||
cy.get('#tick-div') | ||
.should('have.text', '1489449600') | ||
@@ -98,2 +100,3 @@ | ||
cy.get('#tick-div').click() | ||
cy.get('#tick-div') | ||
.should('have.text', '1489449610') | ||
@@ -100,0 +103,0 @@ }) |
@@ -13,3 +13,4 @@ /// <reference types="cypress" /> | ||
// https://on.cypress.io/clearlocalstorage | ||
cy.get('.ls-btn').click().should(() => { | ||
cy.get('.ls-btn').click() | ||
cy.get('.ls-btn').should(() => { | ||
expect(localStorage.getItem('prop1')).to.eq('red') | ||
@@ -20,10 +21,11 @@ expect(localStorage.getItem('prop2')).to.eq('blue') | ||
// clearLocalStorage() yields the localStorage object | ||
cy.clearLocalStorage().should((ls) => { | ||
expect(ls.getItem('prop1')).to.be.null | ||
expect(ls.getItem('prop2')).to.be.null | ||
expect(ls.getItem('prop3')).to.be.null | ||
cy.clearLocalStorage() | ||
cy.getAllLocalStorage().should(() => { | ||
expect(localStorage.getItem('prop1')).to.be.null | ||
expect(localStorage.getItem('prop2')).to.be.null | ||
expect(localStorage.getItem('prop3')).to.be.null | ||
}) | ||
cy.get('.ls-btn').click().should(() => { | ||
cy.get('.ls-btn').click() | ||
cy.get('.ls-btn').should(() => { | ||
expect(localStorage.getItem('prop1')).to.eq('red') | ||
@@ -35,9 +37,11 @@ expect(localStorage.getItem('prop2')).to.eq('blue') | ||
// Clear key matching string in localStorage | ||
cy.clearLocalStorage('prop1').should((ls) => { | ||
expect(ls.getItem('prop1')).to.be.null | ||
expect(ls.getItem('prop2')).to.eq('blue') | ||
expect(ls.getItem('prop3')).to.eq('magenta') | ||
cy.clearLocalStorage('prop1') | ||
cy.getAllLocalStorage().should(() => { | ||
expect(localStorage.getItem('prop1')).to.be.null | ||
expect(localStorage.getItem('prop2')).to.eq('blue') | ||
expect(localStorage.getItem('prop3')).to.eq('magenta') | ||
}) | ||
cy.get('.ls-btn').click().should(() => { | ||
cy.get('.ls-btn').click() | ||
cy.get('.ls-btn').should(() => { | ||
expect(localStorage.getItem('prop1')).to.eq('red') | ||
@@ -49,6 +53,7 @@ expect(localStorage.getItem('prop2')).to.eq('blue') | ||
// Clear keys matching regex in localStorage | ||
cy.clearLocalStorage(/prop1|2/).should((ls) => { | ||
expect(ls.getItem('prop1')).to.be.null | ||
expect(ls.getItem('prop2')).to.be.null | ||
expect(ls.getItem('prop3')).to.eq('magenta') | ||
cy.clearLocalStorage(/prop1|2/) | ||
cy.getAllLocalStorage().should(() => { | ||
expect(localStorage.getItem('prop1')).to.be.null | ||
expect(localStorage.getItem('prop2')).to.be.null | ||
expect(localStorage.getItem('prop3')).to.eq('magenta') | ||
}) | ||
@@ -79,6 +84,7 @@ }) | ||
// clearAllLocalStorage() yields null | ||
cy.clearAllLocalStorage().should(() => { | ||
expect(sessionStorage.getItem('prop1')).to.be.null | ||
expect(sessionStorage.getItem('prop2')).to.be.null | ||
expect(sessionStorage.getItem('prop3')).to.be.null | ||
cy.clearAllLocalStorage() | ||
cy.getAllLocalStorage().should(() => { | ||
expect(localStorage.getItem('prop1')).to.be.null | ||
expect(localStorage.getItem('prop2')).to.be.null | ||
expect(localStorage.getItem('prop3')).to.be.null | ||
}) | ||
@@ -109,3 +115,4 @@ }) | ||
// clearAllSessionStorage() yields null | ||
cy.clearAllSessionStorage().should(() => { | ||
cy.clearAllSessionStorage() | ||
cy.getAllSessionStorage().should(() => { | ||
expect(sessionStorage.getItem('prop4')).to.be.null | ||
@@ -112,0 +119,0 @@ expect(sessionStorage.getItem('prop5')).to.be.null |
@@ -22,6 +22,5 @@ /// <reference types="cypress" /> | ||
cy.wrap($li) | ||
.should('not.have.class', 'active') | ||
.click() | ||
.should('have.class', 'active') | ||
cy.wrap($li).should('not.have.class', 'active') | ||
cy.wrap($li).click() | ||
cy.wrap($li).should('have.class', 'active') | ||
}) | ||
@@ -45,3 +44,3 @@ | ||
cy.get('.utility-blob img').click() | ||
.should('have.attr', 'src', dataUrl) | ||
cy.get('.utility-blob img').should('have.attr', 'src', dataUrl) | ||
}) | ||
@@ -48,0 +47,0 @@ }) |
{ | ||
"name": "cypress-example-kitchensink", | ||
"version": "2.0.2", | ||
"version": "2.0.3", | ||
"description": "This is an example app used to showcase Cypress.io End-to-End (E2E) testing. For a full reference of our documentation, go to https://docs.cypress.io", | ||
@@ -64,3 +64,3 @@ "main": "index.js", | ||
"@bahmutov/print-env": "1.3.0", | ||
"cypress": "13.6.4", | ||
"cypress": "13.6.6", | ||
"eslint": "8.56.0", | ||
@@ -67,0 +67,0 @@ "eslint-plugin-cypress": "2.15.1", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2340854
4588