All Projects → antonfisher → node-mocha-extjs

antonfisher / node-mocha-extjs

Licence: MIT license
Framework for testing ExtJs applications

Programming Languages

javascript
184084 projects - #8 most used programming language
HTML
75241 projects

Projects that are alternatives of or similar to node-mocha-extjs

Grunt Mocha
[MOVED] Grunt task for running mocha specs in a headless browser (PhantomJS)
Stars: ✭ 371 (+1852.63%)
Mutual labels:  mocha, phantomjs
Gulp Mocha Phantomjs
run client-side Mocha tests with PhantomJS
Stars: ✭ 67 (+252.63%)
Mutual labels:  mocha, phantomjs
Karma Webpack Example
Karma + Webpack + Mocha + Chai + Istanbul
Stars: ✭ 88 (+363.16%)
Mutual labels:  mocha, phantomjs
Feathers Vue
A boiler plate template using Feathers with Email Verification, Vue 2 with Server Side Rendering, stylus, scss, jade, babel, webpack, ES 6-8, login form, user authorization, and SEO
Stars: ✭ 195 (+926.32%)
Mutual labels:  mocha
Yarsk
Don't use this, use Create React App
Stars: ✭ 199 (+947.37%)
Mutual labels:  mocha
Eslint Plugin Mocha
ESLint rules for mocha
Stars: ✭ 249 (+1210.53%)
Mutual labels:  mocha
nodejs-integration-tests-best-practices
✅ Beyond the basics of Node.js testing. Including a super-comprehensive best practices list and an example app (April 2022)
Stars: ✭ 2,842 (+14857.89%)
Mutual labels:  mocha
Redux Actions Assertions
Simplify testing of redux action and async action creators
Stars: ✭ 177 (+831.58%)
Mutual labels:  mocha
aurelia-dotnet-template
A starting point for new dotnet projects using the aurelia-framework with typescript and webpack.
Stars: ✭ 13 (-31.58%)
Mutual labels:  mocha
Jshistory Cn
🇨🇳 《JavaScript 二十年》中文版
Stars: ✭ 3,686 (+19300%)
Mutual labels:  mocha
Babel Plugin Tester
Utilities for testing babel plugins
Stars: ✭ 228 (+1100%)
Mutual labels:  mocha
Root Cause
🔍 Root Cause is a tool for troubleshooting Puppeteer and Playwright tests. 🔎
Stars: ✭ 205 (+978.95%)
Mutual labels:  mocha
Express Mongoose Es6 Rest Api
💥 A boilerplate application for building RESTful APIs Microservice in Node.js using express and mongoose in ES6 with code coverage and JsonWebToken Authentication
Stars: ✭ 2,811 (+14694.74%)
Mutual labels:  mocha
Mocha Parallel Tests
Parallel test runner for mocha tests. Looking for maintainer.
Stars: ✭ 197 (+936.84%)
Mutual labels:  mocha
node-rest-api-starter
This repository is a template to avoid rewriting all the basic authentication code for REST API's built with Express.js, MongoDB.
Stars: ✭ 30 (+57.89%)
Mutual labels:  mocha
Mocha.parallel
Run async mocha specs in parallel
Stars: ✭ 194 (+921.05%)
Mutual labels:  mocha
firebase-functions-typescript-starter
Create & test Firebase Cloud Functions in TypeScript
Stars: ✭ 101 (+431.58%)
Mutual labels:  mocha
Aws Lambda Typescript
This sample uses the Serverless Application Framework to implement an AWS Lambda function in TypeScript, deploy it via CloudFormation, publish it through API Gateway to a custom domain registered on Route53, and document it with Swagger.
Stars: ✭ 228 (+1100%)
Mutual labels:  mocha
Co Mocha
Enable support for generators in Mocha tests
Stars: ✭ 216 (+1036.84%)
Mutual labels:  mocha
Nspec
A battle hardened testing framework for C# that's heavily inspired by Mocha and RSpec.
Stars: ✭ 242 (+1173.68%)
Mutual labels:  mocha

mocha-extjs

npm js-standard-style GitHub license status

ExtJs applications testing framework which simulates user actions.

Online demo

Demo

Component search by title, fieldLabel, reference, boxLabel, xtype, text properties:

// click on "Save" button
eTT().button('Save').click(done);

// select first item in the combobox with "Country" fieldLabel.
eTT().combobox('Country').select(1, done);

Getting Started:

Update index.html:

<body>
    ...

    <!-- mocha ui -->
    <div id="mocha"></div>

    <!-- mocha library -->
    <link href="http://cdn.rawgit.com/mochajs/mocha/2.3.0/mocha.css" rel="stylesheet"/>
    <script src="http://cdn.rawgit.com/Automattic/expect.js/0.3.1/index.js"></script>
    <script src="http://cdn.rawgit.com/mochajs/mocha/2.3.0/mocha.js"></script>

    <!-- mocha-extjs library -->
    <link href="https://cdn.rawgit.com/antonfisher/node-mocha-extjs/master/dist/mocha-extjs.css" rel="stylesheet" />
    <script src="https://cdn.rawgit.com/antonfisher/node-mocha-extjs/master/dist/mocha-extjs.js"></script>

    <!-- setup mocha -->
    <script>
        mocha.setup('bdd');
    </script>

    <!-- first test suite -->
    <script src="https://cdn.rawgit.com/antonfisher/node-mocha-extjs/master/test/suites/010-environment.js"></script>

    <!-- run script -->
    <script>
            mocha.checkLeaks();
            mocha.globals(['Ext', 'Sandbox']); // update name here!

            var eTT = new MochaExtJs(); // init testing framework

            window.onload = function () {
                setTimeout(function () {
                    mocha.run();
                }, 1000);
            };
        </script>
</body>

Done. Run your application!

PhantomJs

It works now, but some hack is needed. First of all you will need PhantonJs version 2 and mocha-phantomjs library. After mocha-phantomjs installation, upgrade one of its dependency to the latest version:

$ npm install [email protected] [email protected] [email protected]
$ rm -rf ./node_modules/mocha-phantomjs/node_modules/mocha-phantomjs-core

# check PhantonJs version, should be like this:
$ ./node_modules/.bin/phantomjs --version
2.1.1

Run tests in console:

# http://localhost:3000 - application address
$ ./node_modules/.bin/mocha-phantomjs --timeout 15000 --path ./node_modules/.bin/phantomjs --setting disk-cache=false --view 1024x768 http://localhost:3000

Library's self test with PhantonJs:

$ npm test

Usage

Init the library before running MochaJs

var eTT = new MochaExtJs(); // init testing framework

Add test suite:

// tests/suites/020-buttons.js
describe('Buttons', function () {
    this.bail(true);         // exit when first test fails
    this.timeout(20 * 1000); // necessary timeout for ui operations

    it('Switch to "Buttons" tab', function (done) { // done - async tests callback
        eTT().tab('Buttons').click(done);
    });

    it('Click "Simple button" button', function (done) {
        eTT().button('Simple button').isEnabled().click(done);
    });
});

Supported components and methods:

var eTT = new MochaExtJs();

eTT() -->--->|------->--->|- button ---> (|- '%title%'     )----.
        |    |       |    |- window       |- '%fieldLabel%'     |
        |    |- no --'    |- numberfield  |- '%reference%'      |
        |    |            |- textfield    |- '%boxLabel%'       |
        |    |            |- checkbox     |- '%xtype%'          |
        |    |            |- combobox     `- '%text%'           |
        |    |            |- dataview                           |
        |    |            |- radio                              |
        |    |            |- grid        .----------------------x----------------------.
        |    |            `- tab         |                                             |
        |    |                           |-->|- click -------> (...) ------------------v
        |    |                           |   |- isEnabled                              |
        |    |- waitLoadMask() ------.   |   |- isDisabled                             |
        |    |                       |   |   |- isHidden                               |
        |    `- waitText('%text%')---v   |   |- isVisible                              |
        |                            |   |   |- select                                 |
        |                            |   |   |- checkRowsCount                         |
        |                            |   |   |- clickAction                            |
        |                            |   |   |- edit                                   |
        |                            |   |   `- fill                                   |
        |                            |   |                                             |
        |                            |   `--> cellEditor() --->|- select ---> (...) ---v
        |                            |                         |- click                |
        |                            |                         `- fill                 |
        |                            |                                                 |
        x----------------------------<-------------------------------------------------'
        |
        |
        `--> done.

Examples:

eTT().button('Simple button').isEnabled().click(done);
eTT().button('Hide me').click().isHidden(done);
eTT().tab('Windows').click(done);
eTT().window('Confirm').button('Yes').isEnabled().click(done);
eTT().no.window('Confirm', done);
eTT().textfield('Name').fill('my text', done);
eTT().numberfield('Count').fill(13, done);
eTT().checkbox('include').click(done);
eTT().radio('check B').click(done);
eTT().combobox('Select in list').select(1, done);
eTT().grid('Names').select(1, 1, done);
eTT().grid('Names').checkRowsCount(2, done);
eTT().grid('Names').clickAction(0, 2, 1, done); // row, coll, action index
eTT().grid('Cell editing').cellEditor(1, 0).select(0, done);
eTT().grid('Cell editing').cellEditor(0, 2).fill('test1', done);
eTT().grid('Cell editing').cellEditor(0, 3).click(done);
eTT().grid('customDataviewReference').select(1, done);
eTT().waitLoadMask(done);
eTT().waitText('Result is here!', done);

Taking screenshots

MochaExtJs.screenshot();
MochaExtJs.screenshot('./mypath/');

Installation

  • $ npm install mocha-extjs
  • use files from ./dist folder.

Development

  • install NodeJs v5.10.1 or newer
  • clone repository $ git clone https://github.com/antonfisher/node-mocha-extjs.git
  • copy ExtJs v5 or v6 framework to ./test/sandbox/ext folder
  • build Sandbox application
$ cd ./node-mocha-extjs/test/sandbox
$ sencha app build
  • install dependencies $ npm install
  • run lint: $ npm run lint
  • run gulp: $ npm start.

Contributing

Please take care to maintain the existing coding style, tests for any changed functionality. npm test and npm run lint your code. Push your changes without ./dist/mocha-extjs.* files, to keep commits cleaner between library releases. Thank you!

Releases History

  • 0.2.0 New grid method - clickAction
  • 0.1.7 Move to PhantomJs v2, ExtJs v6, add DataView support (thanks @vadimpopa)
  • 0.1.6 CellEditing plugin support in PhantomJs
  • 0.1.5 Update click method, minor fixes
  • 0.1.4 New grid cell editor methods
  • 0.1.3 Fix previous release trouble
  • 0.1.2 Update documentation
    • ES2015
    • standardjs
    • grid select rows and cells
  • 0.1.1 Update documentation
  • 0.1.0 Initial Alpha release

ToDo

  • update Mocha UI style
  • Self tests
  • Migrate to WebPack
  • Use Sencha test env
  • New components
  • Documentation

License

Copyright (c) 2016 Anton Fisher [email protected]

MIT License. Free use and change.

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].