cypress-example-kitchensink
Advanced tools
Comparing version 1.5.1 to 1.5.2
/// <reference types="Cypress" /> | ||
/// JSON fixture file can be loaded directly using | ||
// the built-in JavaScript bundler | ||
// @ts-ignore | ||
const requiredExample = require('../../fixtures/example') | ||
context('Files', () => { | ||
@@ -7,2 +12,9 @@ beforeEach(() => { | ||
}) | ||
beforeEach(() => { | ||
// load example.json fixture file and store | ||
// in the test context object | ||
cy.fixture('example.json').as('example') | ||
}) | ||
it('cy.fixture() - load a fixture', () => { | ||
@@ -16,2 +28,5 @@ // https://on.cypress.io/fixture | ||
cy.fixture('example.json').as('comment') | ||
// when application makes an Ajax request matching "GET comments/*" | ||
// Cypress will intercept it and reply with object | ||
// from the "comment" alias | ||
cy.route('GET', 'comments/*', '@comment').as('getComment') | ||
@@ -51,2 +66,15 @@ | ||
it('cy.fixture() or require - load a fixture', function () { | ||
// we are inside the "function () { ... }" | ||
// callback and can use test context object "this" | ||
// "this.example" was loaded in "beforeEach" function callback | ||
expect(this.example, 'fixture in the test context') | ||
.to.deep.equal(requiredExample) | ||
// or use "cy.wrap" and "should('deep.equal', ...)" assertion | ||
// @ts-ignore | ||
cy.wrap(this.example, 'fixture vs require') | ||
.should('deep.equal', requiredExample) | ||
}) | ||
it('cy.readFile() - read a files contents', () => { | ||
@@ -53,0 +81,0 @@ // https://on.cypress.io/readfile |
@@ -78,3 +78,2 @@ /// <reference types="Cypress" /> | ||
// https://on.cypress.io/moment | ||
// eslint-disable-next-line no-unused-vars | ||
const time = Cypress.moment().utc('2014-04-25T19:38:53.196Z').format('h:mm A') | ||
@@ -86,2 +85,18 @@ | ||
.should('have.class', 'badge') | ||
// the time in the element should be between 3pm and 5pm | ||
const start = Cypress.moment('3:00 PM', 'LT') | ||
const end = Cypress.moment('5:00 PM', 'LT') | ||
cy.get('.utility-moment .badge') | ||
.should(($el) => { | ||
// parse American time like "3:38 PM" | ||
const m = Cypress.moment($el.text().trim(), 'LT') | ||
// display hours + minutes + AM|PM | ||
const f = 'h:mm A' | ||
expect(m.isBetween(start, end), | ||
`${m.format(f)} should be between ${start.format(f)} and ${end.format(f)}`).to.be.true | ||
}) | ||
}) | ||
@@ -88,0 +103,0 @@ |
{ | ||
"name": "cypress-example-kitchensink", | ||
"version": "1.5.1", | ||
"description": "This is an example app used to showcase Cypress.io testing. For a full reference of our documentation, go to docs.cypress.io", | ||
"version": "1.5.2", | ||
"description": "This is an example app used to showcase Cypress.io testing. For a full reference of our documentation, go to https://docs.cypress.io", | ||
"main": "index.js", | ||
@@ -59,5 +59,5 @@ "files": [ | ||
"colon-names": "1.0.0", | ||
"cypress": "3.1.5", | ||
"eslint": "5.15.1", | ||
"eslint-plugin-cypress": "2.2.0", | ||
"cypress": "3.2.0", | ||
"eslint": "5.16.0", | ||
"eslint-plugin-cypress": "2.2.1", | ||
"eslint-plugin-cypress-dev": "2.0.0", | ||
@@ -68,6 +68,6 @@ "eslint-plugin-mocha": "5.3.0", | ||
"semantic-release": "15.13.3", | ||
"start-server-and-test": "1.7.11", | ||
"start-server-and-test": "1.7.12", | ||
"stop-build": "1.1.0", | ||
"stop-only": "3.0.1", | ||
"typescript": "3.3.3333" | ||
"typescript": "3.4.1" | ||
}, | ||
@@ -74,0 +74,0 @@ "engines": { |
125
README.md
@@ -17,4 +17,4 @@ # Kitchen Sink [![renovate-app badge][renovate-badge]][renovate-app] | ||
AppVeyor | [![AppVeyor CI](https://ci.appveyor.com/api/projects/status/bo4x59pha1eb18de?svg=true)](https://ci.appveyor.com/project/cypress-io/cypress-example-kitchensink) | [appveyor.yml](appveyor.yml) | ||
Azure CI | [![Build Status](https://cypress-io.visualstudio.com/cypress-example-kitchensink/_apis/build/status/cypress-example-kitchensink)](https://cypress-io.visualstudio.com/cypress-example-kitchensink/_build/latest?definitionId=1) | [basic/azure-ci.yml](basic/azure-ci.yml) | ||
Buildkite | [![Buildkite CI](https://badge.buildkite.com/d1bd1f093d97de34475da7d545c80eb2be9749eefe1c7133f0.svg)](https://buildkite.com/cypress-io/cypress-example-kitchensink) | [.buildkite/pipeline.yml](.buildkite/pipeline.yml) | ||
Azure CI | [![Build Status](https://cypress-io.visualstudio.com/cypress-example-kitchensink/_apis/build/status/cypress-io.cypress-example-kitchensink?branchName=master)](https://cypress-io.visualstudio.com/cypress-example-kitchensink/_build/latest?definitionId=2&branchName=master) | [basic/azure-ci.yml](basic/azure-ci.yml) | [azure-ci.yml](azure-ci.yml) | ||
Buildkite | | [.buildkite/pipeline.yml](.buildkite/pipeline.yml) | ||
Circle | [![Circle CI](https://circleci.com/gh/cypress-io/cypress-example-kitchensink.svg?style=svg)](https://circleci.com/gh/cypress-io/cypress-example-kitchensink) | [basic/circle.yml](basic/circle.yml) | [circle.yml](circle.yml) | ||
@@ -31,2 +31,4 @@ Codeship Pro | [ ![Codeship Pro CI](https://app.codeship.com/projects/8d6a20c0-b70e-0133-41c6-56e5cd60fbd0/status?branch=master)](https://app.codeship.com/projects/134609) | [basic/codeship-pro](basic/codeship-pro) | ||
If you are looking for BitBucket Pipelines example, check out [bitbucket.org/cypress-io/cypress-example-kitchensink](https://bitbucket.org/cypress-io/cypress-example-kitchensink). | ||
## Help + Testing | ||
@@ -82,118 +84,3 @@ | ||
#### 1.0.4 - *(12/05/18)* | ||
- update image placeholder links to https | ||
- update cy.trigger example | ||
- add cy.request example with query params | ||
- update deps | ||
#### 1.0.3 - *(12/05/18)* | ||
- update image placeholder links to https | ||
- update cy.trigger example | ||
- add cy.request example with query params | ||
- update deps | ||
#### 1.0.2 - *(06/28/18)* | ||
- updated dependencies | ||
- add Cypress.Screenshot.defaults test | ||
- improvements to build and deploy process | ||
- bump to node 8 | ||
#### 1.0.1 - *(05/14/18)* | ||
- updated README to link to correct examples folder | ||
- added assertion to prevUntil test | ||
#### 1.0.0 - *(04/13/18)* | ||
- split example_spec into seperate files | ||
- convert all JS from ES5 -> ES6 | ||
- update all code content to match actual specs | ||
- move all Cypress API examples into 1 page | ||
- have nav be active when visiting page | ||
- add GitHub link to repo in main nav | ||
- add link to docs from every header | ||
- general grammar and link fixes | ||
#### 0.8.3 - *(12/19/17)* | ||
- add platform check to cy.exec() example | ||
- fix typo | ||
#### 0.8.2 - *(11/30/17)* | ||
- eslint tests and js script | ||
#### 0.8.1 - *(10/16/17)* | ||
- updated .prev html to match test | ||
- added contributing doc | ||
#### 0.8.0 - *(09/10/17)* | ||
- updated for cypress 0.20.0 | ||
- added new cy commands | ||
- update support files for new scaffolding | ||
#### 0.7.0 | ||
- new traversal commands | ||
#### 0.6.2 | ||
- fix flaky location calls | ||
#### 0.6.1 | ||
- remove .only | ||
#### 0.6.0 | ||
- added stubs, spies, clocks example, fix cy.readFile | ||
#### 0.5.3 | ||
- missing var | ||
#### 0.5.2 | ||
- bump up default config values | ||
#### 0.5.1 | ||
- prevent file server caching | ||
#### 0.5.0 - *(09/01/16)* | ||
- renamed Fixtures section to Files | ||
- added examples for writeFile | ||
- added example for readFile | ||
- added examples for using modifier keys on cy.type | ||
- fixed some formatting | ||
#### 0.4.2 | ||
- rename commandTimeout -> defaultCommandTimeout | ||
#### 0.4.1 | ||
- remove spacejam visit, use https | ||
#### 0.4.0 | ||
- added cy.screenshot example | ||
#### 0.3.0 | ||
- added cy.exec() command examples | ||
#### 0.2.3 | ||
- fix for clearing 3rd party cookies after visit | ||
#### 0.2.2 | ||
- removed methods on Cypress.Cookies | ||
#### 0.2.1 | ||
- removed selenium references | ||
#### 0.2.0 | ||
- added examples of new cypress cookie commands | ||
#### 0.1.5 | ||
- removed relative cy.visit which causes errors on new projects | ||
#### 0.1.4 | ||
- updated node version to 5.10.0 | ||
#### 0.1.3 | ||
- renamed visitTimeout option to pageLoadTimeout | ||
#### 0.1.2 | ||
- updated links to be https | ||
#### 0.1.1 | ||
- added cy.reload(true) example | ||
#### 0.1.0 | ||
- initial release | ||
- after v1.0.4 at [cypress-example-kitchensink/releases](https://github.com/cypress-io/cypress-example-kitchensink/releases) | ||
- before at [CHANGELOG_OLD.md](CHANGELOG_OLD.md) |
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
2263978
63
2986
84