{"id":18331478,"url":"https://github.com/antonfisher/node-mocha-extjs","last_synced_at":"2025-04-06T03:33:18.519Z","repository":{"id":57299801,"uuid":"49410120","full_name":"antonfisher/node-mocha-extjs","owner":"antonfisher","description":"Framework for testing ExtJs applications","archived":false,"fork":false,"pushed_at":"2019-05-22T07:34:29.000Z","size":2010,"stargazers_count":19,"open_issues_count":1,"forks_count":6,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-03-21T16:11:07.339Z","etag":null,"topics":["extjs","mocha","nodejs","phantomjs"],"latest_commit_sha":null,"homepage":"http://antonfisher.com/posts/2016/05/02/testing-extjs-with-mocha-js/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/antonfisher.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-01-11T07:41:55.000Z","updated_at":"2022-10-27T12:41:39.000Z","dependencies_parsed_at":"2022-08-26T21:51:45.158Z","dependency_job_id":null,"html_url":"https://github.com/antonfisher/node-mocha-extjs","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antonfisher%2Fnode-mocha-extjs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antonfisher%2Fnode-mocha-extjs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antonfisher%2Fnode-mocha-extjs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antonfisher%2Fnode-mocha-extjs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/antonfisher","download_url":"https://codeload.github.com/antonfisher/node-mocha-extjs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247430837,"owners_count":20937873,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["extjs","mocha","nodejs","phantomjs"],"created_at":"2024-11-05T19:32:33.599Z","updated_at":"2025-04-06T03:33:18.508Z","avatar_url":"https://github.com/antonfisher.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mocha-extjs\n\n[![npm](https://img.shields.io/npm/dt/mocha-extjs.svg?maxAge=86400)](https://www.npmjs.com/package/mocha-extjs)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/)\n[![GitHub license](https://img.shields.io/github/license/antonfisher/node-mocha-extjs.svg)](https://github.com/antonfisher/node-mocha-extjs/blob/master/LICENSE)\n![status](https://img.shields.io/badge/status-alpha-lightgray.svg)\n\nExtJs applications testing framework which simulates user actions.\n\n[Online demo](http://antonfisher.com/demo/mocha-extjs/)\n\n![Demo](https://raw.githubusercontent.com/antonfisher/node-mocha-extjs/docs/images/mocha-extjs-v1.gif)\n\nComponent search by _title_, _fieldLabel_, _reference_, _boxLabel_, _xtype_, _text_ properties:\n\n```javascript\n// click on \"Save\" button\neTT().button('Save').click(done);\n\n// select first item in the combobox with \"Country\" fieldLabel.\neTT().combobox('Country').select(1, done);\n```\n\n## Getting Started:\n\nUpdate _index.html_:\n\n```html\n\u003cbody\u003e\n    ...\n\n    \u003c!-- mocha ui --\u003e\n    \u003cdiv id=\"mocha\"\u003e\u003c/div\u003e\n\n    \u003c!-- mocha library --\u003e\n    \u003clink href=\"http://cdn.rawgit.com/mochajs/mocha/2.3.0/mocha.css\" rel=\"stylesheet\"/\u003e\n    \u003cscript src=\"http://cdn.rawgit.com/Automattic/expect.js/0.3.1/index.js\"\u003e\u003c/script\u003e\n    \u003cscript src=\"http://cdn.rawgit.com/mochajs/mocha/2.3.0/mocha.js\"\u003e\u003c/script\u003e\n\n    \u003c!-- mocha-extjs library --\u003e\n    \u003clink href=\"https://cdn.rawgit.com/antonfisher/node-mocha-extjs/master/dist/mocha-extjs.css\" rel=\"stylesheet\" /\u003e\n    \u003cscript src=\"https://cdn.rawgit.com/antonfisher/node-mocha-extjs/master/dist/mocha-extjs.js\"\u003e\u003c/script\u003e\n\n    \u003c!-- setup mocha --\u003e\n    \u003cscript\u003e\n        mocha.setup('bdd');\n    \u003c/script\u003e\n\n    \u003c!-- first test suite --\u003e\n    \u003cscript src=\"https://cdn.rawgit.com/antonfisher/node-mocha-extjs/master/test/suites/010-environment.js\"\u003e\u003c/script\u003e\n\n    \u003c!-- run script --\u003e\n    \u003cscript\u003e\n            mocha.checkLeaks();\n            mocha.globals(['Ext', 'Sandbox']); // update name here!\n\n            var eTT = new MochaExtJs(); // init testing framework\n\n            window.onload = function () {\n                setTimeout(function () {\n                    mocha.run();\n                }, 1000);\n            };\n        \u003c/script\u003e\n\u003c/body\u003e\n```\nDone. Run your application!\n\n## PhantomJs\n\nIt works now, but some hack is needed.\nFirst of all you will need _PhantonJs_ version 2 and `mocha-phantomjs` library.\nAfter `mocha-phantomjs` installation, upgrade one of its dependency to the latest version:\n\n```bash\n$ npm install mocha-phantomjs@4.0.2 mocha-phantomjs-core@2.0.1 phantomjs-prebuilt@2.1.7\n$ rm -rf ./node_modules/mocha-phantomjs/node_modules/mocha-phantomjs-core\n\n# check PhantonJs version, should be like this:\n$ ./node_modules/.bin/phantomjs --version\n2.1.1\n```\n\nRun tests in console:\n\n```bash\n# http://localhost:3000 - application address\n$ ./node_modules/.bin/mocha-phantomjs --timeout 15000 --path ./node_modules/.bin/phantomjs --setting disk-cache=false --view 1024x768 http://localhost:3000\n```\n\nLibrary's self test with _PhantonJs_:\n\n```bash\n$ npm test\n```\n\n## Usage\n\n### Init the library before running MochaJs\n\n```javascript\nvar eTT = new MochaExtJs(); // init testing framework\n```\n\n### Add test suite:\n\n```javascript\n// tests/suites/020-buttons.js\ndescribe('Buttons', function () {\n    this.bail(true);         // exit when first test fails\n    this.timeout(20 * 1000); // necessary timeout for ui operations\n\n    it('Switch to \"Buttons\" tab', function (done) { // done - async tests callback\n        eTT().tab('Buttons').click(done);\n    });\n\n    it('Click \"Simple button\" button', function (done) {\n        eTT().button('Simple button').isEnabled().click(done);\n    });\n});\n```\n\n### Supported components and methods:\n\n```\nvar eTT = new MochaExtJs();\n\neTT() --\u003e---\u003e|-------\u003e---\u003e|- button ---\u003e (|- '%title%'     )----.\n        |    |       |    |- window       |- '%fieldLabel%'     |\n        |    |- no --'    |- numberfield  |- '%reference%'      |\n        |    |            |- textfield    |- '%boxLabel%'       |\n        |    |            |- checkbox     |- '%xtype%'          |\n        |    |            |- combobox     `- '%text%'           |\n        |    |            |- dataview                           |\n        |    |            |- radio                              |\n        |    |            |- grid        .----------------------x----------------------.\n        |    |            `- tab         |                                             |\n        |    |                           |--\u003e|- click -------\u003e (...) ------------------v\n        |    |                           |   |- isEnabled                              |\n        |    |- waitLoadMask() ------.   |   |- isDisabled                             |\n        |    |                       |   |   |- isHidden                               |\n        |    `- waitText('%text%')---v   |   |- isVisible                              |\n        |                            |   |   |- select                                 |\n        |                            |   |   |- checkRowsCount                         |\n        |                            |   |   |- clickAction                            |\n        |                            |   |   |- edit                                   |\n        |                            |   |   `- fill                                   |\n        |                            |   |                                             |\n        |                            |   `--\u003e cellEditor() ---\u003e|- select ---\u003e (...) ---v\n        |                            |                         |- click                |\n        |                            |                         `- fill                 |\n        |                            |                                                 |\n        x----------------------------\u003c-------------------------------------------------'\n        |\n        |\n        `--\u003e done.\n```\n\nExamples:\n\n```javascript\neTT().button('Simple button').isEnabled().click(done);\neTT().button('Hide me').click().isHidden(done);\neTT().tab('Windows').click(done);\neTT().window('Confirm').button('Yes').isEnabled().click(done);\neTT().no.window('Confirm', done);\neTT().textfield('Name').fill('my text', done);\neTT().numberfield('Count').fill(13, done);\neTT().checkbox('include').click(done);\neTT().radio('check B').click(done);\neTT().combobox('Select in list').select(1, done);\neTT().grid('Names').select(1, 1, done);\neTT().grid('Names').checkRowsCount(2, done);\neTT().grid('Names').clickAction(0, 2, 1, done); // row, coll, action index\neTT().grid('Cell editing').cellEditor(1, 0).select(0, done);\neTT().grid('Cell editing').cellEditor(0, 2).fill('test1', done);\neTT().grid('Cell editing').cellEditor(0, 3).click(done);\neTT().grid('customDataviewReference').select(1, done);\neTT().waitLoadMask(done);\neTT().waitText('Result is here!', done);\n```\n\n### Taking screenshots\n\n```javascript\nMochaExtJs.screenshot();\nMochaExtJs.screenshot('./mypath/');\n```\n\n## Installation\n\n- `$ npm install mocha-extjs`\n- use files from `./dist` folder.\n\n## Development\n\n- install _NodeJs v5.10.1_ or newer\n- clone repository `$ git clone https://github.com/antonfisher/node-mocha-extjs.git`\n- copy _ExtJs v5_ or _v6_ framework to `./test/sandbox/ext` folder\n- build _Sandbox_ application\n```bash\n$ cd ./node-mocha-extjs/test/sandbox\n$ sencha app build\n```\n- install dependencies `$ npm install`\n- run _lint_: `$ npm run lint`\n- run _gulp_: `$ npm start`.\n\n## Contributing\n\nPlease take care to maintain the existing coding style, tests for any changed functionality.\n`npm test` and `npm run lint` your code.\nPush your changes without `./dist/mocha-extjs.*` files, to keep commits cleaner between library releases.\nThank you!\n\n## Releases History\n\n* 0.2.0 New grid method - clickAction\n* 0.1.7 Move to _PhantomJs v2_, _ExtJs v6_, add _DataView_ support (thanks [@vadimpopa](https://github.com/antonfisher/node-mocha-extjs/pull/1))\n* 0.1.6 _CellEditing_ plugin support in _PhantomJs_\n* 0.1.5 Update click method, minor fixes\n* 0.1.4 New grid cell editor methods\n* 0.1.3 Fix previous release trouble\n* 0.1.2 Update documentation\n    * ES2015\n    * standardjs\n    * grid select rows and cells\n* 0.1.1 Update documentation\n* 0.1.0 Initial Alpha release\n\n## ToDo\n\n- [x] update Mocha UI style\n- [x] Self tests\n- [ ] Migrate to WebPack\n- [ ] Use Sencha test env\n- [ ] New components\n- [ ] Documentation\n\n## License\n\nCopyright (c) 2016 Anton Fisher \u003ca.fschr@gmail.com\u003e\n\nMIT License. Free use and change.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantonfisher%2Fnode-mocha-extjs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fantonfisher%2Fnode-mocha-extjs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantonfisher%2Fnode-mocha-extjs/lists"}