Giter VIP home page Giter VIP logo

cy-graphql-schemas-mock-example's Introduction

Example of using cypress schema-tools and graphql mocking

  • Test-app has dynamic url for API, for now it is simple/v1/cixmkt2ul01q00122mksg82pn but last part will be changed, so all fixtures should be updated with new ID.

API

  • api tests are validating responses against JSON schemas.
  • Schemas are stored as js files which should be included into schemas/index
  • Custom JSON schema formats described in schemas/formats
  • In order to avoid setting all properties as required in JSON shema - normalizeRequired script will set it all automatically, now you should explicitly set required: false to property is not required. Example:
properties: {
                       votes: {
                           type: 'integer',
                           minimum: 0,
                           required: false
                       },
}
  • GraphQL requests are stored as fixture files
  • Schema title should match fixture fileName

UI

  • ui tests are validating UI change with mocked graphql endpoint.
  • In case you are using some external data im mock object, you should pass it as argument
  • Mock could also have first argument request which will obviously match outgoing request.

How to run:

  • clone this repo
  • install deps yarn
  • run tests: yarn test

cy-graphql-schemas-mock-example's People

Watchers

 avatar  avatar

Forkers

vijesh-koroth

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.