jasmine

how to close selenium webdriver at end of test?

我与影子孤独终老i 提交于 2019-12-11 10:27:00
问题 I have created a e2e test for my angular app. I would like to close down the selenium webdriver at the end of the test: describe('Selenium end', function () { it("close down selenium server", function () { browser.get('http://localhost:4444/selenium-server/driver/?cmd=shutDownSeleniumServer'); var text = element(by.css('pre')).getText(function (text) { expect(text).toEqual('OKOK'); }); }); }); When I run this i get: Message: Error: Error while running testForAngular: ECONNREFUSED connect

Click buttons on page until all will be removed

有些话、适合烂在心里 提交于 2019-12-11 10:23:32
问题 My scenario: On a page, I have multiple buttons. After button is clicked, page is reloaded without the clicked button. I have a problem with the implementation of a proper solution. Currently I have something like this: let selector = 'selector for All button on page'; let buttons = browser.$$(selector); for (int i = 0; i < buttons.length; i++) { let button = browser.$(selector); button.moveToObject(); button.waitForVisible(); button.click(); browser.waitToVisible(elementAfterPageRefresh); }

Why jasmine spy doesn't resolve the function object by reference?

折月煮酒 提交于 2019-12-11 10:14:51
问题 I have the following simple service app.factory('Shoes', function() { function a() {return 12;} function b() {return a();} return { a: a, b: b } }) I want to test if the method a is being called when I call method b . My test looks like this: describe('Testing a Shoes service', function() { var service; beforeEach(module('plunker')); beforeEach(inject(function(Shoes) { service = Shoes; })) it('.b should call .a', function() { spyOn(service, 'a'); service.b(); expect(service.a)

How to run Jasmine beforeAll for all test files

柔情痞子 提交于 2019-12-11 10:02:58
问题 I'm using nodejs to create an end to end test suite for our API. Before each test runs, I need to insert database records for that test. Many of the tables in question do not use native auto-increment type fields for their primary keys. (I know, bad database design. But I don't have control over that.) Instead, they use the sequence pattern common to postgresql. But this is in MS SQL Server. So there is a stored procedure that gets the next sequence number for use in the table, etc. As I

Unable to launch multiple browser instances in Protractor

情到浓时终转凉″ 提交于 2019-12-11 10:01:34
问题 My config file is just launching 1 instance of chrome. I'm expecting it to open 2. This is my config multi capabilities. multiCapabilities: [ { browserName: 'chrome', logName: 'Chrome - Suite 1', shardTestFiles: false, maxInstances: 1, maxSessions: 1, specs: ['test/protractor/test.js'] }, { browserName: 'Chrome', logName: 'Chrome - Suite 2', shardTestFiles: false, maxInstances: 1, maxSessions: 1, specs: ['test/protractor/test2.js'] } ], Now I am facing the error as below: /usr/local/lib/node

protractor-jasmine2-screenshot-reporter not generating screenshots in the required folder

时光毁灭记忆、已成空白 提交于 2019-12-11 09:49:39
问题 My protractor.conf.js has the following content. I was unable to find out whats wrong here. I have manually created target/screenshots in my root folder of angular-cli. When i run protractor conf.js the protractor tests in browser window but the screenshots aren't being generated. Can anyone help me resolve this? // Protractor configuration file const { SpecReporter } = require('jasmine-spec-reporter'); var HtmlScreenshotReporter = require('protractor-jasmine2-screenshot-reporter'); var fs =

Do atomic tests make sense in dynamically created environments?

ぐ巨炮叔叔 提交于 2019-12-11 09:45:02
问题 We´re building a product that allows users to create custom databases and store data within those DBs (WebApp). Our issue for testing of the frontend (coffeescript) is that every test should be atomic but that would require setting up a DB for seeing if an item within that DB can be created and persists or to see how changes in a DB affect items. Essentially, the issue is that the setup code needed to get to the item tests basically sets up a new DB and therefore equals the code that tests

Running code outside the “it” block breaks my Jasmine test

时光总嘲笑我的痴心妄想 提交于 2019-12-11 09:39:03
问题 I am trying to write some test cases (first time) using jasmine describe("Widget App core logic", function () { WAPP.widgets = []; addwidget will add a widget in my WAPP.widgets array WAPP.addWidget('testRecord', 'testRecordContent'); it("added", function () { expect(WAPP.widgets.length).toEqual(1); }); Remove widget will remove same widget WAPP.removeWidget('1'); it("record removed correctly", function () { expect(WAPP.widgets.length).toEqual(0); }) After writing second spec my first spec

Jasmine fails when same test is run twice

我是研究僧i 提交于 2019-12-11 09:35:18
问题 I have this situation where the code is working, but when I run the same test twice, it fails and I don't know why. Looks like there is a gotcha I am not aware of in the beforeEach(); Two beforeEach are run. One in the first one in the top "describe" and the following one that inside the previous "describe". Anyone knows what is the problem here? describe("[data-add-selected].click()", function () { var option; beforeEach(function () { initialize(); option = container.find('.source .option

Should I use Selenium or Jasmine in order to test view files with RSpec?

蓝咒 提交于 2019-12-11 09:31:30
问题 I am using Ruby on Rails 3.2.2, cucumber-rails-1.3.0, rspec-rails-2.8.1 and capybara-1.1.2 with the Selenium driver. After receiving the answer to a my previous question I had a doubt: should I use the Selenium ruby-gem or the Jasmine ruby-gem in order to test view files with RSpec? If so, since I am already using Selenium in order to test JavaScript for view files with Cucumber, why (when testing with RSpec) should I use Jasmine instead of Selenium? That is, why to use two ruby-gems that