javascript - Siesta Test Runner 给出 'store' 未定义错误

标签 javascript unit-testing extjs siesta

我正在尝试将 Bryntum Siesta 4.3.2-lite 实现为 Sencha ExtJS 6.2 制作的应用程序,并继续遵循 ExtJS Essentials book .

我还创建了 Siesta Test Runner 的 index.htmlindex.js。收集了所需的 Siesta 文件; js 和 css 位于 Siesta/resources 文件夹中。当我在浏览器上运行测试运行程序时,出现以下错误:

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)

我在 Bryntum 上找到了答案 forums并表示不要包含要利用的 ExtJS 文件。我做了同样的事情并评论了 ExtJS 部分,但错误仍然存​​在。欢迎任何建议。

一些片段: 测试运行程序 (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>

安全带 (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'
        ]
    }
);

测试文件 (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'}
        )
    })
});

最佳答案

在您的代码片段中 - 您仍然在harness HTML 页面上包含Ext JS 库文件(来自cloudflare)。您需要删除这些文件。可以在此处找到示例线束 html 页面:

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>

关于javascript - Siesta Test Runner 给出 'store' 未定义错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46526491/

相关文章:

unit-testing - 如何对文件管理器类进行单元测试?

c# - 使用 InMemoryDatabase 和 Identity 列进行测试,如何处理?

javascript - sencha touch 中具有类和属性的元素的 css 选择器是什么

javascript - ExtJS 4 : cloning stores

javascript - Angular JS 页面的原始呈现

javascript - ReactJS onClick 不触发

javascript - JQuery 不适用于提交按钮

java - 从没有 SparkContext 的列表创建 JavaRDD

extjs - 扩展js 4 : Add new tab in center region

javascript - Autodesk Viewer 中出现 webGL 错误