You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

cypress-example-kitchensink

Package Overview
Dependencies
Maintainers
2
Versions
82
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.5 to 0.2.0

selenium/example_spec.js

14

app/assets/js/scripts.js

@@ -160,5 +160,4 @@ // initialize highlight.js for JavaScript code highlighting

$('.get-cookies-btn').on('click', function(e) {
// setting a cookie
$('.set-a-cookie').on('click', function(e) {
e.preventDefault();

@@ -168,10 +167,5 @@ setCookies(e);

$('.clear-cookies-btn').on('click', function(e) {
e.preventDefault();
setCookies(e);
});
// populate local storage to demonstrate cy.clearLocalStorage()
// populate local cookie to demonstrate cy.clearCookies()
function setCookies(e) {
document.cookie = 'fakeCookie1=123ABC';
document.cookie = 'token=123ABC';
}

@@ -178,0 +172,0 @@

@@ -22,2 +22,4 @@ //

// **** Resetting State Before Each Test ****

@@ -41,2 +43,3 @@ //

// **** Making Assertions ****

@@ -163,3 +166,2 @@ //

cy.get('.traversal-pagination').find('li').find('a').should('have.length', 7)
})

@@ -1183,7 +1185,17 @@

beforeEach(function(){
Cypress.Cookies.debug(true)
cy.visit('http://localhost:8080/commands/cookies')
})
it('cy.getCookie() - get a browser cookie', function(){
// **** Get a Cookie ****
//
// // https://on.cypress.io/api/getcookie
cy
.visit('http://localhost:8080/commands/cookies')
.clearCookies()
.get('#getCookie .set-a-cookie').click()
Cypress.Cookies.debug(true)
// getCookie() returns a cookie object
.getCookie('token').should('have.property', 'value', '123ABC')
})

@@ -1197,10 +1209,52 @@

cy
.getCookies().should('not.have.property', 'fakeCookie1')
.getCookies().should('be.empty')
.get('.get-cookies-btn').click()
.get('#getCookies .set-a-cookie').click()
.getCookies().should('have.property', 'fakeCookie1', '123ABC')
// getCookies() returns an array of cookies
.getCookies().should('have.length', 1).then( function(cookies) {
// each cookie has these properties
expect(cookies[0]).to.have.property('name', 'token')
expect(cookies[0]).to.have.property('value', '123ABC')
expect(cookies[0]).to.have.property('httpOnly', false)
expect(cookies[0]).to.have.property('secure', false)
expect(cookies[0]).to.have.property('domain')
expect(cookies[0]).to.have.property('path')
})
})
it('cy.setCookie() - set a browser cookie', function(){
// **** Set a Cookie ****
//
// // https://on.cypress.io/api/setcookie
cy
.getCookies().should('be.empty')
.setCookie('foo', 'bar')
// getCookie() returns a cookie object
.getCookie('foo').should('have.property', 'value', 'bar')
})
it('cy.clearCookie() - clear a browser cookie', function(){
// **** Clear a Cookie ****
//
// // https://on.cypress.io/api/clearcookie
cy
.getCookie('token').should('be.null')
.get('#clearCookie .set-a-cookie').click()
.getCookie('token').should('have.property', 'value', '123ABC')
// clearCookies() returns null
.clearCookie('token').should('be.null')
.getCookie('token').should('be.null')
})
it('cy.clearCookies() - clear browser cookies', function(){

@@ -1213,10 +1267,13 @@

cy
.getCookies().should('not.have.property', 'fakeCookie1')
.getCookies().should('be.empty')
.get('.clear-cookies-btn').click()
.get('#clearCookies .set-a-cookie').click()
.getCookies().should('have.property', 'fakeCookie1', '123ABC')
.getCookies().should('have.length', 1)
// clearCookies() returns cookie represented as an object
.clearCookies().should('not.have.property', 'fakeCookie1')
// clearCookies() returns null
.clearCookies()
.getCookies().should('be.empty')
})

@@ -1419,28 +1476,2 @@

it('Cypress.Cookies.set() - set a cookie by key, value', function(){
Cypress.Cookies.set('fakeCookie', '123ABC')
cy.getCookies().should('have.property', 'fakeCookie', '123ABC')
})
it('Cypress.Cookies.get() - get a cookie by its key', function(){
Cypress.Cookies.set('fakeCookie', '123ABC')
expect(Cypress.Cookies.get('fakeCookie')).to.eq('123ABC')
})
it('Cypress.Cookies.remove() - remove a cookie by its key', function(){
Cypress.Cookies.set('fakeCookie', '123ABC')
expect(Cypress.Cookies.get('fakeCookie')).to.eq('123ABC')
Cypress.Cookies.remove('fakeCookie')
expect(Cypress.Cookies.get('fakeCookie')).to.not.be.ok
})
it('Cypress.Cookies.debug() - enable or disable debugging', function(){

@@ -1451,8 +1482,8 @@

// Cypress will now log in the console when
// cookies are set or removed
Cypress.Cookies.set('fakeCookie', '123ABC')
Cypress.Cookies.remove('fakeCookie')
Cypress.Cookies.set('fakeCookie', '123ABC')
Cypress.Cookies.remove('fakeCookie')
Cypress.Cookies.set('fakeCookie', '123ABC')
// cookies are set or cleared
cy.setCookie('fakeCookie', '123ABC')
cy.clearCookie('fakeCookie')
cy.setCookie('fakeCookie', '123ABC')
cy.clearCookie('fakeCookie')
cy.setCookie('fakeCookie', '123ABC')

@@ -1464,7 +1495,7 @@ })

// normally cookies are reset after each test
expect(Cypress.Cookies.get('fakeCookie')).to.not.be.ok
cy.getCookie('fakeCookie').should('not.be.ok')
// preserving a cookie will not clear it when
// the next test starts
Cypress.Cookies.set('lastCookie', '789XYZ')
cy.setCookie('lastCookie', '789XYZ')
Cypress.Cookies.preserveOnce('lastCookie')

@@ -1479,3 +1510,3 @@

Cypress.Cookies.defaults({
whitelist: "session_id"
whitelist: 'session_id'
})

@@ -1482,0 +1513,0 @@

{
"name": "cypress-example-kitchensink",
"version": "0.1.5",
"version": "0.2.0",
"description": "This is an example app used to showcase Cypress.io testing. For a full reference of our documentation, go to docs.cypress.io",

@@ -22,7 +22,13 @@ "main": "index.js",

"dependencies": {
"http-server": "^0.8.5"
"chai": "^1.10.0",
"chai-as-promised": "^4.1.1",
"chromedriver": "^2.12.0",
"http-server": "^0.8.5",
"mocha": "^2.0.1",
"selenium-webdriver": "2.47.0"
},
"devDependencies": {
"@cypress/core-releaser": "0.1.6"
"@cypress/core-releaser": "0.1.6",
"webdriverio": "^4.0.7"
}
}

@@ -74,2 +74,5 @@ # Kitchen Sink [![Circle CI](https://circleci.com/gh/cypress-io/cypress-example-kitchensink.svg?style=svg)](https://circleci.com/gh/cypress-io/cypress-example-kitchensink) [![Travis CI](https://travis-ci.org/cypress-io/cypress-example-kitchensink.svg?branch=master)](https://travis-ci.org/cypress-io/cypress-example-kitchensink) [![Codeship Status for cypress-io/cypress-example-kitchensink](https://codeship.com/projects/8d6a20c0-b70e-0133-41c6-56e5cd60fbd0/status?branch=master)](https://codeship.com/projects/134609)

#### 0.2.0
- added examples of new cypress cookie commands
#### 0.1.5

@@ -76,0 +79,0 @@ - removed relative cy.visit which causes errors on new projects

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc