PDA

View Full Version : Integration tests with ExtJS 4.1.1 and capybara-webkit: * is not a constructor



scho
28 Aug 2012, 12:37 AM
Hi folks,

we use Ruby on Rails as our back-end and we recently tried to migrate from 4.0.2a to 4.1.1. We didn't run into big problems, except for a very strange one. When we run our integration tests with cucumber and capybara-webkit as a driver, we always get the following error:



http://localhost:3003/extjs/ext-all-dev.js|5462|TypeError: Result of expression 'prototype.configClass' [Ext.Base] is not a constructor.


Here's the code, that fails:



if (parent.$onExtended) {
this.$onExtended = parent.$onExtended.slice();
}

prototype.config = new prototype.configClass(); // This is line 5462
prototype.initConfigList = prototype.initConfigList.slice();
prototype.initConfigMap = Ext.clone(prototype.initConfigMap);
prototype.configMap = Ext.Object.chain(prototype.configMap);


I know, that this is usually a result of missing js files, but shouldn't including the ext-all-dev.js already load everything? Btw, I don't get this error when I test the app by hand with firefox or I use a non headless driver like selenium.

I also debugged into it a bit, and when it throws the error, prototype.configClass() returns a string 'Ext.Base', not a class.

I know, this is a very odd error, but maybe someone out there has an idea.

Thanks for your help guys,

cheers,
scho

scho
30 Aug 2012, 3:34 AM
Since it's rather a capybara-webkit issue than a Ext JS issue, I opened one on the github page of the gem:

https://github.com/thoughtbot/capybara-webkit/issues/383#issuecomment-8156363

It also contains a link to the source code of a project, that demonstrates the bug.

I'll update this thread as soon as I have some news.