Tag: 茉莉花

节点茉莉花没有失败时,预期

我正在尝试第一次设置node-jasminetesting。 目前我只是试图设置一个简单的testing,看到获得索引返回状态200。 它似乎工作,但我注意到,无论我改变状态号码,它永远不会失败,例如期待666状态,但我不会失败: const request = require("request") const helloWorld = require("../app.js") const base_url = "http://localhost:3002/" describe("Return the index page", function() { describe("GET /", function() { it("returns status code 200", function() { request.get(base_url, function(error, response, body) { expect(response.statusCode).toBe(666) done() }) }) }) }) 哪个返回: Finished in 0.009 seconds 1 test, 0 assertions, 0 failures, 0 skipped […]

量angular器与frisby API的集成

我正在尝试将frisby api与量angular器进行整合。 // An example configuration file. exports.config = { //seleniumAddress: 'http://localhost:4444/wd/hub', directConnect: true, // Capabilities to be passed to the webdriver instance. capabilities: { 'browserName': 'chrome' }, // Framework to use. Jasmine is recommended. framework: 'jasmine', // Spec patterns are relative to the current working directory when // protractor is called. specs: ['/usr/local/lib/node_modules/protractor/SpecFiles/frisby_global_spec.js'], // […]

如何访问茉莉花量angular器执行spec的文件名?

例如我开始我的testing protractor –specs spec1.js,spec2.js config.js 我希望为spec1-tests的每次运行输出一次“spec1.js”,在spec2-tests的每次运行中输出一次“spec2.js”。

量angular器:同一页面上的两个下拉菜单,只能从一个下拉菜单中成功select元素

我正在使用量angular器来运行自动脚本,在其中一个页面上有两个下拉菜单,它们位于下方/上方。 他们两个似乎是相同的,只是他们有不同的ng模型名等。我可以成功地从下拉菜单中select一个元素,但是我不能为另一个。 这是为什么一个工程,而另一个没有破坏我的头。 这里是下拉菜单的代码,我可以select一个元素 <select class="form-control ng-pristine ng-invalid ng-invalid-required" ng-model="user.sourceOfFunds" required="" ng-class="{submitted:invalid}"> <option value="">Select</option> <option value="Savings">Deposit</option> <option value="Inherited">Current</option> <option value="Other">Savings</option> </select> element(by.model('user.sourceOfFunds')).sendKeys('Savings'); 我的其他下拉菜单如下: <select class="form-control ng-pristine ng-invalid ng-invalid-required" ng-model="user.investFigure" required="" ng-class="{submitted:invalid}"> <option value="">Select</option> <option value="<20">Less than 20K</option> <option value="20-50">20K-50K</option> <option value="50-100">50K-100K</option> </select> element(by.model('user.investFigure')).sendKeys('Less than 20K'); or element(by.model('user.investFigure')).sendKeys('20'); 当我尝试从第二个下拉菜单中select一个项目时,我得到“元素未find”。 为什么会发生这种情况,我有点不知所措

茉莉花忽略打字稿testing文件?

这是我第一次和Jasmine一起制作一个项目,我正在跟着一个教程,但马上就要解决问题了。 我已经安装了jasmine-node,typings和typescript。 我也跑了: typings install dt~jasmine –save-dev –global 为茉莉花打字稿。 现在我的./spec文件夹中有一个testing文件,如下所示: import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { DatePickerComponent } from '../src/components/via-datepicker.component'; import * as moment from 'moment'; const Moment: any = (<any>moment).default || moment; describe('DatePickerComponent', () => { let component: DatePickerComponent; let fixture: ComponentFixture<DatePickerComponent>; beforeEach(async(() => { TestBed.configureTestingModule({ declarations: [ DatePickerComponent ] […]

如何在node.js intellisense中启用Jasmine支持

我在我的项目中安装了茉莉花。 现在,当我在*.spec.js写入以下内容时: describe(…) 我得到警告: 未解决的function或方法describe 我读过这个答案 ,我可以添加jasmine作为一个图书馆,并认为这应该解决它。 但似乎并不奏效 – 警告依然存在。 我错过了什么?

用Jasmine和Express嘲笑请求对象

我有一个非常简单的方法: module.exports = { login: function (username, password, req, res) { authModule.check_login({login: username, pass: password}).then(function (user) { req.session.regenerate(function () { req.session.user = username req.session.userID = user.id req.session.fullName = user.fullName req.session.email = user.email res.redirect('/user') }) }).catch(function (err) { res.render('login', { unsuccessful: true }) }) } } 在我的unit testing中,我试图validation这个方法是否正确设置会话variables。 我一直试图通过使用jasmine.createSpy来嘲笑请求对象,但似乎没有工作,例如: describe('user_login.login', function () { it('sets the session […]

茉莉花节点要求*

在我的Jasmine-Node spec_helper中,我require("../app/test") ,并且在那个test文件中就好了。 但是,如果我尝试require("../app/*") ,我得到Error: Cannot find module '../app/*' 。 有没有办法把所有这样的目录的文件/子目录?

幻影茉莉花找不到规格

我正在尝试使用幻影茉莉花 。 我在我的系统(Mountain Lion和Ubuntu)上安装了phantomjs(1.9.1),使用npm安装了phantom-jasmine。 问题是当我尝试运行幻像茉莉花的例子/ TestRunner.html从他们的例子我得到0规范,0失败虽然它应该是3个规格,在输出1失败。 如果我从浏览器打开TestRunner.html,它的行为如预期,但幻影茉莉花似乎无法find规格。 另一件事是当我提供绝对path(phantom-jasmine /home/me/phantom-jasmine/examples/TestRunner.html到TestRunner.html 这发生

做一些事后描述与量angular器与selenium服务器与angularjs

我想在每次描述之后(而不是在每个testing用例之后)做一些事情,在每次描述之前,有没有办法做到这一点? 我已经尝试过下面的格式,但它给了我错误,之前和之后没有定义,是否有可能做一些任务之前和之后的每个描述: describe('testcase', function () { before(function () { ————– }) beforeEach(function () { —————– }) afterEach(function () { ————– }) after(function () { —————– }) it('task1', function () { ———– })it('task2', function () { —————— }) })