• UI5-文档-2.4-Node.js-Based开发环境


    用于修改OpenUI5。环境是基于Node.js,用作服务器,具有一个基于Grunt的构建过程。本节提供关于初始设置、开发工作流和测试执行的信息。

    常规开发过程:

      不需要构建过程,您可以简单地修改任何源文件并重新加载浏览器。

      这种无构建的开发过程不能提供优化的运行时性能(例如,有许多小请求,远程连接不能接受)。

      适用的机制主要有两种:

      ▪Git存储库路径包含一个与各自的控制库(例如sap.m)同名的文件夹,在运行时省略该文件夹。Node.js-based服务器被配置为映射位置。

      ▪在CSS文件被修改后的第一个请求期间,较少的预处理器对CSS文件(服务器端)进行转换。这包括用于从右到左支持的镜像。在CSS修改之后,第一个请求是到相应的库。css文件将花费几百毫秒,这取决于所涉及的css的数量。这是更少的处理时间。

    构建SAPUI5:

      Grunt用于构建SAPUI5的生产版本。构建结果位于目录target/openui5中。

      Usage:grunt build

      还可以选择只构建选定的库,或者跳过复制test-resources文件夹。

      构建过程负责以下任务:

      ▪创建绑定库library.css和library-RTL.css所有可用主题的css文件

      ▪缩小的CSS

      ▪JavaScript的缩小(for library-preload.json files)

      ▪将库的JavaScript模块合并到单个库中library-preload.json文件

      将最重要的SAPUI5 core文件合并到sap-ui-core.js(尚未优化;缩小了)

      请注意:如果遇到如下错误,请重新执行npm安装命令。可能需要先下载一些新的构建工具。

    jit-grunt: Plugin for the "replace" task not found.
    
    If you have installed the plugin already, please setting the static mapping.
    
    See https://github.com/shootaroo/jit-grunt#static-mappings
    
    Warning: Task "replace:target" not found. Use --force to continue.

           Installing the Node.js-Based Development Environment

    本节内容:

           Testing SAPUI5

           Common Installation Issues

     

    1.Installing the Node.js -Based Development Environment

    Node.js的安装步骤:

      a. 从http://nodejs.org下载Node.js并安装。

      请注意:安装包括节点包管理器(npm)。

      b. 在操作系统设置或命令行中设置环境变量。如果你使用HTTP代理,你需要这样做:

    @SET HTTP_PROXY=http://proxy:8080
    
    @SET HTTPS_PROXY=http://proxy:8080
    
    @SET FTP_PROXY=http://proxy:8080
    
    @SET NO_PROXY=localhost,127.0.0.1,.mycompany.corp

      c. 使用以下命令全局安装Grunt命令行接口(Grunt -cli):npm install grunt-cli -g.

      请注意:上面显示的示例用于Windows命令行,您可能需要根据您的特定代理配置来调整设置。

      d. 下载并安装Git:http://git-scm.com/download.

      e. 使用以下命令克隆Git存储库 :git clone https://github.com/SAP/openui5.git.

      f.  在本地安装所有npm依赖项。在openui5目录下执行如下命令:

    cd openui5
    
    npm install

      请注意:有多种配置选项可供您使用。例如,您可以指定参数port=9090来使用不同的HTTP端口。

      g. 启动服务器: with grunt serve.

      h. 将浏览器指向SAPUI5运行的服务器:http://localhost:8080/testsuite/。

    2.Testing SAPUI5

    使用ESLint或单元测试测试您的开发。

    运行静态代码检查(ESLint)

      所有SAPUI5代码必须符合使用ESLint工具检查的特定规则集(有关详细信息,请参阅相关信息)。

      要运行ESLint检查,导航到存储库的根目录并执行:

    grunt lint

      运行单元测试还可以选择只检查所选的库,甚至只检查单个文件或目录。

      SAPUI5单元测试使用jQuery的qUnit测试框架实现,并由一个基于硒的基础设施运行。

      要执行单元测试,导航到存储库的根目录并执行:

    grunt test

      您可以通过指定以下参数来更改此默认行为:警告:默认情况下,此命令将为谷歌Chrome浏览器中的所有库运行测试。对于除Mozilla Firefox之外的所有浏览器,都需要安装额外的Selenium web驱动程序。

    grunt test --browsers="safari,firefox" # run tests of all libraries on Safari and Firefox

     

      相关信息:http://eslint.org

    3.Common Installation Issues

    使用节点时可能遇到的常见安装问题。基于js的开发环境,更新构建工具(任务“replace:target”未找到)。

    如果遇到如下错误,请再次执行npm install命令:可能需要先下载新的构建工具。

    jit-grunt: Plugin for the "replace" task not found.
    
    If you have installed the plugin already, please setting the static mapping.
    
    See https://github.com/shootaroo/jit-grunt#static-mappings
    
    Warning: Task "replace:target" not found. Use --force to continue.

      grunt test将下载selenium-server-standalone.jar服务器。当第一次运行jar文件时。如果您在代理后工作,并且没有为代理设置环境变量,那么第一次运行时将失败。

    代理问题:

    selenium-server-standalone.jar not found. Downloading...
    
    >> Error: getaddrinfo ENOTFOUND

      "Browser not found" issues要解决这个问题,请为代理服务器设置环境变量。更多信息请查看Installing the Node.js-Based Development Environment.

      Selenium需要在路径上找到浏览器的可执行文件,否则您将看到以下错误消息:

    firefox
    
    Fatal error: Cannot find firefox binary in PATH. Make sure firefox is installed.

       要解决此问题,请将Firefox安装文件夹添加到PATH环境变量。

      "Path to the driver executable" issues with browsers other than Mozilla Firefox

      如果您遇到以下错误,请记住您需要为除Mozilla Firefox之外的所有浏览器安装额外的Selenium Web驱动程序:

    Fatal error: The path to the driver executable must be set by the webdriver.chrome.driver system property;
    
    for more information, see http://code.google.com/p/selenium/wiki/ChromeDriver.
    
    The latest version can be downloaded from http://chromedriver.storage.googleapis.com/index.html

      要解决这个问题,请下载相应浏览器的Selenium驱动程序,并确保Selenium Web驱动程序找到它。有关特定的浏览器说明,请参见下表。

    Browser

    Details

    Google Chrome

    1. Download the current chromedriver_*.zip from http://chromedriver.storage.googleapis.com/index.htm
    2. Extract the executable to a suitable location (for example, C:Program Files (x86)Selenium Drivers)
    3. Include the ChromeDriver location in your PATH environment variable

    Internet Explorer (browser type "ie")

    Download the driver from the following location: http://selenium-release.storage.googleapis.com/index.html

    Note

    You may have to adjust the Protected Mode settings on the Security tab under Internet options.

    Other browsers

    Consult their respective driver documentation.

      Undeletable folders

      如果您遇到由于进程锁定而无法删除的源文件夹,一个可能的原因可能是谷歌Chrome或Internet Explorer web驱动程序。检查它们是否处于活动进程中。

  • 相关阅读:
    Dirichlet distribution【转】
    实现Div层里的文字垂直居中的方法
    Kullback–Leibler divergence相对熵【转】
    判别模型、生成模型与朴素贝叶斯方法【转】
    卸载wine只需简单6个步骤【转】
    在ubuntu11.04通过Wine使用中国知网cnki的CAJview阅读器打开*.nh *.caj后缀的文献资料【转】
    网页制作学习网站收集
    XML数据绑定到Table中
    ubuntu10.04教育网更新源sources.list【转有效的】
    cidaemon.exe导致CPU100%的解决办法
  • 原文地址:https://www.cnblogs.com/ricoo/p/10095473.html
Copyright © 2020-2023  润新知