Tag: casperjs

CasperJS不会加载由Angular路由器注入的内容

我在GitHub上准备了一个示例项目 ,以配合我正在编写的关于如何为dockerized应用程序编写functiontesting的课程。 该应用程序有一个是Angular2单页面应用程序的一部分,我试图用CasperJStesting这个应用程序(我也试过与下面解释的相同问题的Behat)。 当在CasperJS中运行testing时,就好像Angular中的路由不会加载testing,因此我可以断言索引模板中的东西存在(例如页面标题),但是<app-root></app-root>标记不会加载testing。 代码 这里是索引模板: <!doctype html> <html lang="en"> <head <meta charset="utf-8"> <title>TestProject</title> <base href="/"> <meta name="viewport" content="width=device-width, initial-scale=1"> </head> <body> <app-root></app-root> </body> </html> testing是: casper.test.begin('Tests homepage structure', function suite(test) { casper.start('http://web', function() { // This works because the title is set in the "parent" template. test.assertTitle("TestProject", "Title is correct"); casper.wait(2000); // This fails, […]

从Docker容器访问本地主机

我想要访问Docker容器外部的本地Web服务器。 我有一个testing套件(casperjs)在一个Docker容器内部打开一个浏览器到localhost:8002 / etc,但是“localhost”在这里是指我的本地机器,而不是在docker容器内。 我怎样才能做到这一点?