对于这已有问题已有答案,但我认为这是一个新的东西.我正在尝试让drone.io在content_
shell中运行我的测试.我按照说明启动了X服务器.通过download_contentshell.sh脚本下载了content_shell.并根据我从这里找到的答案和其他来源获得的说明执行content_shell.问题是它们都不起作用. content_shell不会运行我的测试,除非我给它一个绝对文件路径,但如果我这样做,当它运行测试时,它会失败,因为它不能使用所需的导入.以下是我在drone.io设置中运行测试脚本的操作
sudo start xvfb pub install test/run.sh
这是run.sh脚本
#!/bin/bash which content_shell if [[ $? -ne 0 ]]; then $DART_SDK/../chromium/download_contentshell.sh unzip content_shell-linux-x64-release.zip cs_path=$(ls -d drt-*) PATH=$cs_path:$PATH fi results=$(content_shell --args --dump-render-tree test/index.html 2>&1) echo -e "$results" # check to see if DumpRenderTree tests # fails,since it always returns 0 if [[ "$results" == *"Some tests Failed"* ]] then exit 1 fi if [[ "$results" == *"Exception: "* ]] then exit 1 fi
这是飞镖测试文件
import 'package:unittest/unittest.dart'; import 'package:unittest/html_config.dart'; import 'dart:html'; import 'dart:async'; import 'package:polymer/polymer.dart'; main() { // Ensure polymer is looking for bound variables... addXParent(); initpolymer(); removeXParent(); setUp(addXParent); tearDown(removeXParent); group("encountermap",(){ test('has canvas element',(){ new Timer( new Duration(milliseconds: 2500),expectAsync0((){ expect( querySelector('encounter-map').shadowRoot.querySelector('canvas'),isNotNull ); }) ); }); test("contains file input element",expectAsync0((){ expect( querySelector('encounter-map').shadowRoot.querySelector('input'),isNotNull ); expect( querySelector('encounter-map').shadowRoot.querySelector('input'),new isinstanceOf<FileUploadInputElement>() ); expect( querySelector('encounter-map').shadowRoot.querySelector('input').attributes['type'],contains('file') ); }) ); }); }); } addXParent() { document.body.append(createElement('<encounter-map></encounter-map>')); } removeXParent() { querySelectorAll('encounter-map').forEach((el)=> el.remove()); } createElement(String html) => new Element.html(html,treeSanitizer: new NullTreeSanitizer()); class NullTreeSanitizer implements NodeTreeSanitizer { void sanitizeTree(node) {} }
和index.html文件
<head> <!-- Load component(s) --> <link rel="import" href="packages/RPGHelper/encountermap.html"> <script type="application/dart" src="test.dart"></script> <script src="packages/unittest/test_controller.js"></script> </head>
我已经看过这个测试正在运行,所有发生的事情是content_shell没有退出,停止脚本完成,从而超时.您可以找到此项目的完整来源here
这真的让我起了作用.这是一个错误吗?如果它有所作为我使用的飞镖版本是“Dart SDK版本1.1.0-dev.4.0”
此测试在“Dart编辑器版本1.1.0.dev_04_00(DEV)”中运行完美,而不是在使用content_shell时