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

cypress-example-kitchensink - npm Package Compare versions

Comparing version 0.5.3 to 0.6.0

app/commands/spies-stubs-clocks.html

13

app/assets/js/scripts.js

@@ -176,5 +176,16 @@ // initialize highlight.js for JavaScript code highlighting

});
$('#clock-div').on('click', function(e) {
var $div = $(e.currentTarget)
// seconds from the unix epoch
$div.text(new Date().getTime() / 1000)
});
$('#tick-div').on('click', function(e) {
var $div = $(e.currentTarget)
// seconds from the unix epoch
$div.text(new Date().getTime() / 1000)
});
});

@@ -62,3 +62,3 @@ //

// The most commonly used query is 'cy.get()', you can
// think of this like the '$' in jQueury
// think of this like the '$' in jQuery

@@ -139,3 +139,3 @@ it('cy.get() - query DOM elements', function(){

// The most commonly used query is 'cy.get()', you can
// think of this like the '$' in jQueury
// think of this like the '$' in jQuery

@@ -217,3 +217,3 @@ it('cy.children() - get child DOM elements', function(){

// Let's perform some actions on DOM elements
// Move of these involve filling in form elements
// Most of these involve filling in form elements
// But some actions, like click, will often be

@@ -1114,5 +1114,4 @@ // used throughout an application

// https://on.cypress.io/api/readfile
.readFile('app/commands/actions.html')
.then(function (html) {
expect(html).to.include('<!DOCTYPE html>')
.readFile('cypress.json').then(function(json) {
expect(json).to.be.an('object')
})

@@ -1311,2 +1310,79 @@

context('Spies, Stubs, and Clock', function(){
// **** Spies, Stubs, and Clock ****
//
// Cypress comes built in with the ability to stub,
// spy or modify your applications clock -
// such as controlling Date, setTimeout, and setInterval.
// These commands are useful when writing both
// unit tests and integration tests.
it('cy.spy() - wrap a method in a spy', function(){
// https://on.cypress.io/api/spy
cy.visit('http://localhost:8080/commands/spies-stubs-clocks')
var obj = {
foo () {}
}
var spy = cy.spy(obj, "foo").as("anyArgs")
obj.foo()
expect(spy).to.be.called
})
it('cy.stub() - create a stub and/or replace a function with a stub', function(){
// https://on.cypress.io/api/stub
cy.visit('http://localhost:8080/commands/spies-stubs-clocks')
var obj = {
foo () {}
}
var stub = cy.stub(obj, "foo").as("foo")
obj.foo("foo", "bar")
expect(stub).to.be.called
})
it('cy.clock() - control time in the browser', function(){
// create the date in UTC so its always the same
// no matter what local timezone the browser is running in
var now = new Date(Date.UTC(2017, 2, 14)).getTime() // March 14, 2017 timestamp
// https://on.cypress.io/api/clock
cy
.clock(now)
.visit('http://localhost:8080/commands/spies-stubs-clocks')
.get("#clock-div").click()
.should("have.text", "1489449600")
})
it.only('cy.tick() - move time in the browser', function(){
// create the date in UTC so its always the same
// no matter what local timezone the browser is running in
var now = new Date(Date.UTC(2017, 2, 14)).getTime() // March 14, 2017 timestamp
// https://on.cypress.io/api/tick
cy
.clock(now)
.visit('http://localhost:8080/commands/spies-stubs-clocks')
.get("#tick-div").click()
.should("have.text", "1489449600")
.tick(10000) // 10 seconds passed
.get("#tick-div").click()
.should("have.text", "1489449610")
})
})
context('Utilities', function(){

@@ -1360,3 +1436,3 @@ beforeEach(function(){

it('Cypress.Blob.method() - blob utilties and base64 string conversion', function(){
it('Cypress.Blob.method() - blob utilities and base64 string conversion', function(){

@@ -1363,0 +1439,0 @@ // https://on.cypress.io/api/cypress-blob

2

package.json
{
"name": "cypress-example-kitchensink",
"version": "0.5.3",
"version": "0.6.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",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -22,2 +22,3 @@ # 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)

- Cookies
- Spies, Stubs & Clocks

@@ -32,3 +33,2 @@ ## Help + Testing

* [Cypress Docs](https://on.cypress.io)
* [Cypress CLI Tool Docs](https://github.com/cypress-io/cypress-cli)

@@ -76,2 +76,5 @@ ### 1. Install Cypress

#### 0.6.0
- added stubs, spies, clocks example, fix cy.readFile
#### 0.5.3

@@ -78,0 +81,0 @@ - missing var

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc