PDA

View Full Version : [FIXED] Ext.create is not a function



kakasab.havale
5 May 2016, 2:02 AM
I am trying to explore Sencha Test trial version before we go for it with our existing project (ExtJS 4.2.0), added a login page validation test, after running the test I am getting "Ext.create is not a function" error. What is missing here?


describe("formBind true", function() {
it("should disable button if email is not valid", function(done) {


// Create and reference the WindowEditor and then
// get reference to the button and textfield
var loginView = Ext.create('MyApp.view.LoginView'),
loginformview = loginView.down('loginformview'),
button = loginformview.down('button'),
field = loginformview.query('textfield'),
panelField = loginformview.query('combo');


// Set the field's value to a valid email address
// in order to have the button fire an enable event
field[0].setValue('User Name');
field[1].setValue('test123');
field[2].setValue('1');
panelField.setValue('India');
field[3].setValue('1');


button.on('enable', function() {


// Set the field's value to an invalid email address (nothing)
// in order to have the button fire a disable event
field.setValue('');


button.on('disable', function() {


// Once the disable event has been called after setting a
// bad value, we can safely say that the button is properly
// hooked into the form's validity. Thusly, we can
// alert the spec to return by calling the done function.
done();
});
});
});
});


ST Version: 1.0.1.38

kakasab.havale
9 May 2016, 2:57 AM
Since our code base is using Ext 4.2.0.663 and Sencha CMD version 5.0.0.160 to build the application, is there any restriction with this Sencha Test is not recognizing ithttps://www.sencha.com/forum/images/icons/icon5.png As it uses Sencha CMD Version 6+

On my system both the versions of Sencha CMDs are installed but ST doesn't have option to select version less than 6.

https://www.sencha.com/forum/images/icons/icon4.pnghttps://www.sencha.com/forum/images/icons/icon4.pngNeed your urgent attention on this before our trial version gets expires https://www.sencha.com/forum/images/icons/icon4.pnghttps://www.sencha.com/forum/images/icons/icon4.png

vojtech.cerveny
9 May 2016, 8:18 AM
Hi kakasab.havale,
try move your object initialize to block beforeAll(function(){ }) before block it();

SenchaTest is able test ExtJS frameworks version 4.2 and higher.
SenchaTest supports Cmd 6.x, but you can test remote app.

kakasab.havale
9 May 2016, 7:46 PM
Hi vojtech.cerveny,

Thanks for your reply, I tried creating like an application which is given in this below URL:

http://docs.sencha.com/sencha_test/guides/testing_applications.html

As per your suggestion tried moving the object creation before it block but still same issue.


describe("loginValidation", function() {
loginView = Ext.create('MyApp.view.LoginView') ;
it("should pass", function() {
...............
});
});

vojtech.cerveny
10 May 2016, 12:20 AM
Hi,
I think that problem is in sync in your code.

Try this - it() waits for executing beforeAll and beforeEach (not this case) and then run itself. So try put creating your object to beforeAll as I have. Look on doc http://jasmine.github.io/2.4/introduction.html#section-11 , I hope that will help.


describe('Some suite', function () {
beforeAll(function () {
Ext.create('Ext.Button', {
text: 'Click me',
renderTo: Ext.getBody(),
id: 'senchaButton'
});
});
it('some test', function () {
ST.button('#senchaButton')
.visible()
.and(function(button){
expect(button).toBeDefined();
})
.click();
});
});

kakasab.havale
10 May 2016, 3:33 AM
Thanks vojtech.cerveny for your reply.

Looks like some problem in initializing ExtJS (Not very sure, is there anything I can try to check here?)

When I tried using your approach and ran the test then its keep on loading (running) for infinite times, even I tried with your code as well then also same loading issue!!!

When I try to refresh the Frameworks/Ext JS, i see there is some log getting generated which I have attached herewith, please find it.

54484

Request your help in this regard to move further...

Thanks in Advance!!!

vojtech.cerveny
18 May 2016, 12:43 AM
Thanks for the report! I have opened a bug in our bug tracker.

kakasab.havale
19 May 2016, 2:46 AM
Good to know that you have fixed this in "1.0.2" version.

Can you please tell us by when we can get this version for download? As we are completely blocked and can't proceed without this fix....

vojtech.cerveny
19 May 2016, 4:25 AM
I don't know a date, maybe some developers can provide some date.Can you test your working app? It is not unittest, but still better than nothing :)