All Projects → outbrain → Leonardo

outbrain / Leonardo

Licence: MIT License
Your mocking ninja - an add-on tool for centralizing your client side mocking

Programming Languages

typescript
32286 projects
Less
1899 projects
javascript
184084 projects - #8 most used programming language
HTML
75241 projects

Projects that are alternatives of or similar to Leonardo

software-testing-resource-pack
Various files useful for manual testing and test automation etc.
Stars: ✭ 38 (-58.24%)
Mutual labels:  e2e-tests, ui-tests
nightwatch-boilerplate
boilerplate for nightwatch.js with selenium
Stars: ✭ 16 (-82.42%)
Mutual labels:  e2e-tests
CryptoStupidity
Проект по обучению ручной и автоматической торговли криптовалютами.
Stars: ✭ 22 (-75.82%)
Mutual labels:  leonardo
testcafe-reporter-cucumber-json
TestCafe reporter to generate json in cucumber format
Stars: ✭ 18 (-80.22%)
Mutual labels:  e2e-tests
curso-javascript-testes
Código-fonte do curso "Aprenda a testar Aplicações Javascript"
Stars: ✭ 60 (-34.07%)
Mutual labels:  e2e-tests
mock-spy-module-import
JavaScript import/require module testing do's and don'ts with Jest
Stars: ✭ 40 (-56.04%)
Mutual labels:  mocking
ionic-workflow-guide
Create a full and powerful worflow with Ionic (Unit Testing, Environment variables, Automatic documentation, Production App Server, Automatic deployment)
Stars: ✭ 46 (-49.45%)
Mutual labels:  e2e-tests
ynm3k
ynm3k.readthedocs.io
Stars: ✭ 20 (-78.02%)
Mutual labels:  mocking
livecoding-frontend-projects
Repositório com projetos Front-End
Stars: ✭ 70 (-23.08%)
Mutual labels:  front-end-development
RillAdmin
vue + openresty/nodejs web admin
Stars: ✭ 34 (-62.64%)
Mutual labels:  front-end-development
ineeda
Mocking library for TypeScript and JavaScript using Proxies!
Stars: ✭ 53 (-41.76%)
Mutual labels:  mocking
spy rb
🔍 Transparent Test Spies for Ruby
Stars: ✭ 28 (-69.23%)
Mutual labels:  mocking
angular-material-boilerplate
A straightforward and well structured boilerplate based on Google's Angular Material project.
Stars: ✭ 28 (-69.23%)
Mutual labels:  e2e-tests
Oud
🎵 The frontend of Oud, an online music streaming service that is a mimic of Spotify with all its functionalities built using ReactJS, React-Router, Bootstrap.
Stars: ✭ 48 (-47.25%)
Mutual labels:  front-end-development
twilio mock
Mock Twilio gem for Ruby
Stars: ✭ 26 (-71.43%)
Mutual labels:  mocking
better-mock
Forked from Mockjs, Generate random data & Intercept ajax request. Support miniprogram.
Stars: ✭ 140 (+53.85%)
Mutual labels:  mocking
mocxx
A versatile C++ function mocking framework.
Stars: ✭ 103 (+13.19%)
Mutual labels:  mocking
vuetube
Video resources that will help you to improve your Vue skills
Stars: ✭ 54 (-40.66%)
Mutual labels:  front-end-development
expo-detox-typescript-example
Sample Expo app with e2e tests using detox, jest and typescript
Stars: ✭ 81 (-10.99%)
Mutual labels:  e2e-tests
nala
🦁 Nala - A delightful test framework for C projects.
Stars: ✭ 58 (-36.26%)
Mutual labels:  mocking
Mocking and testing made simple and consistent. Developed by Outbrain.

Leonardo

Client side mocking for the server side

travis-ci workflow status NPM version Package Quality

Install

npm

$ npm install leonardojs --save-dev

Example

Full Application Example

Video Example - AngularJS Israel Conference (Hebrew)

Getting Started

1. Add Leonardo script

Require in your code

    // in dev environment
    import 'leonardojs';

Or directly in html

 <!DOCTYPE HTML>
 <html>
 <body>
   //.....
   <script src="[node_modules|other]/leonardo/dist/leonardo.js"></script>
 </body>
 </html>

2. Run your app

You should now see Leonardo's icon on the bottom right corner. Click It.

3. Start mocking your http calls via the recorder tab

Mocking and testing made simple and consistent. Developed by Outbrain.

4. Turn your mocking on and off as you wish

Mocking and testing made simple and consistent. Developed by Outbrain.

5. Change your responses as you wish

Mocking and testing made simple and consistent. Developed by Outbrain.

Javascript API

Automate your mocks using Leonardo's API

State:

  • name: (string) State name, must be unique
  • url: (string) request url, treated as regex
  • verb: (string) request http verb
  • options (StateOption array)

StateOption:

  • name: (string) option name
  • status: (number) http status code
  • data: (primitive | Object | Function) the data to be returned in response body.
    • Use function to dynamically control the response (first parameter is the request object).

Add States

addState(State array)

 //.....
    Leonardo.addStates([
        {
          name: 'Get Data',
          url: '/api/user/43435',
          verb: 'GET',
          options: [
            {name: 'success', status: 200, data: { name: "Master Splinter" }},
            {name: 'error 500', status: 500}
          ]
        },{
          name: 'Get Data',
          url: '/api/user/43435',
          verb: 'GET',
          options: [
            {name: 'success', status: 200, data: { name: "Master Splinter" }},
            {name: 'error 500', status: 500}
          ]
        },
        {
          name: 'Get Characters',
          url: '/api/character',
          verb: 'GET',
          options: [
            {
              name: 'success', 
              status: 200,
              data: function(request) {
                if (request.url.indexOf('term=Donatello') > 0) {
                  return { name: "Donatello" };
                } else {
                  return { name: "Raphael" };                  
                }
              }
            },
          ]
        }
  ]);

Activate State Option

activateStateOption(stateName, optionName)

Activates state option, mocked response will be returned when calling the state url

//.....
    Leonardo.activateStateOption('Update Data', 'success');
    $http.put('/api/user/43435', { name: "Master Splinter" }).success(function(data, status) {
        console.log(status); // 200 
    });
    
    Leonardo.activateStateOption('Update Data', 'error 500');
    $http.put('/api/user/43435', { name: "Master Splinter" }).error(function(data, status) {
        console.log(status); // 500 
    });
//.....

Deactivate State

deactivateState(stateName)

Deactivates a specific state, when calling the state url request will pass through to the server

//.....
    Leonardo.deactivateState('Update Data');
//.....

Hide/Show Leonardo icon

You can hide Leonardo activator icon by clicking ctrl + shift + l.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].