Search code examples
javascriptunit-testingextjssiesta

Siesta Test Runner gives 'store' of undefined error


I'm trying to implement Bryntum Siesta 4.3.2-lite to Sencha ExtJS 6.2 maded application and keep following ExtJS Essentials book.

I've created Siesta Test Runner's index.html and index.js as well.. Collected required Siesta files; js and css through in Siesta/resources folder. When I ran the Test Runner on browser, it gives this error:

siesta-all.js:45330 Uncaught TypeError: Cannot read property 'store' of undefined
at constructor.initComponent (http://nuri/webex/oweb/test/Siesta/js/siesta-all.js:45330:1458463)

I found an answer on Bryntum forums and says don't include ExtJS files to harness. I did the same and commented ExtJS parts but still errors continues. Any advice is welcome.

Some snippets: Test Runner (index.html);

<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <title>Siesta Examples</title>

    <link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/extjs/6.2.0/classic/theme-neptune/resources/theme-neptune-all.css">
    <!-- Siesta CSS -->
    <link rel="stylesheet" type="text/css" href="../Siesta/css/siesta-all.css">

    <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/extjs/6.2.0/ext-all-debug.js"></script>
    <!-- Siesta application -->
    <script type="text/javascript" src="../Siesta/js/siesta-all.js"></script>

    <!-- Additional Siesta files, not required if you don't use code coverage feature -->
    <!-- <script type="text/javascript" src="../siesta-coverage-all.js"></script> -->

    <!-- A sample utility class with convenience methods helping you write your tests more efficiently -->
    <!-- <script src="lib/Your.Test.Class.js" type="text/javascript"></script> -->

    <!-- The test harness -->
    <script type="text/javascript" src="index.js"></script>
</head>
<body>
</body>
</html>

Harness (index.js);

var harness = new Siesta.Harness.Browser.ExtJS();
harness.configure({
    title: 'OWeb Test',
    //viewDOM: true,
    preload: [
        //'../../../webex/build/production/OWeb/app.js',
        //'../../../webex/build/production/OWeb/resources/OWeb-all.css',
        //'https://cdnjs.cloudflare.com/ajax/libs/extjs/6.2.0/classic/theme-neptune/resources/theme-neptune-all.css',
        //'https://cdnjs.cloudflare.com/ajax/libs/extjs/6.2.0/ext-all-debug.js'
    ]
});
harness.start(
    {
        group: 'Login',
        items: [
            '010_login.t.js'
        ]
    }
);

Test file (010_login.t.js);

describe('Testing Login screen', function (t) {
    t.it('Should to login', function (t) {
        t.chain(
            {waitForCQ: 'window[title=Login]'},
            {click: '>> textfield[itemId=userName]'},
            {type: 'me@adress.com', target:'>> textfield[itemId=userName]'},
            {click: '>> textfield[itemId=edtPassword]'},
            {type: 'superSecretPass', target:'>> textfield[itemId=edtPassword]'},
            {click: '>> button[text=Submit]'},
            {waitForCQNotFound: 'window[title=Login]', desc: 'Login window should destroy'}
        )
    })
});

Solution

  • In your snippet - you are still including the Ext JS library files on the harness HTML page (from cloudflare). You need to remove these files. A sample harness html page can be found here:

    https://www.bryntum.com/docs/siesta/#!/guide/siesta_getting_started

    <!DOCTYPE html>
    <html>
    <head>
        <meta http-equiv="content-type" content="text/html; charset=UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    
        <title>Sample harness</title>
    
        <link rel="stylesheet" type="text/css" href="__SIESTA_FOLDER__/resources/css/siesta-all.css">
        <script type="text/javascript" src="__SIESTA_FOLDER__/siesta-all.js"></script>
    
        <script type="text/javascript" src="index.js"></script>
    </head>
    
    <body>
    </body>