teaspoon

Is it possible to use 'fs' (filesystem) module inside page executed by PhantomJS?

混江龙づ霸主 提交于 2019-12-25 05:36:08
问题 I want to have access to filesystem on a page that is rendering by PhantomJS headless browser. I catch an error when JS code is trying to interact with filesystem var fs = require('fs'); ... ReferenceError: Can't find variable: require Is there some hack/plugin to PhantomJS that allows to do that? P.S. I'm using headless tests runner based on PhantomJS (teaspoon) and I want to store some data from tests on filesystem. 来源: https://stackoverflow.com/questions/30779915/is-it-possible-to-use-fs

angular mock `module` resulting in '[Object object] is not a function'

徘徊边缘 提交于 2019-12-23 06:47:07
问题 I'm trying to create some unit tests in Angular using Jasmine being run through Teaspoon. The tests are running, however I have a simple test just to test the existence of a controller that is failing. I have the following test setup. //= require spec_helper require("angular"); require("angular-mocks"); var app = require("./app"); describe("My App", function() { describe("App Controllers", function() { beforeEach(module("app")) it("Should have created an application controller", inject

Visit pages using PhantomJS directly when writing specs with TeaSpoon - Jasmine

↘锁芯ラ 提交于 2019-12-21 05:43:12
问题 I'm trying to write a Javascript spec for my Rails 3.2 application using Teaspoon (the Jasmine version). I'm trying to write a spec that does something like this describe("Fun", function() { var page = require('webpage').create() //ERROR it("should be so much fun", function() { page.open('/pageToTest/') expect($('#HereIsTheParty')).not.toBe( undefined ); }); }); However, require('webpage') doesn't run ( Error: Module name "system" has not been loaded yet for context ) even though the

How to call $(document).ready(function() {…}); from another file JS

霸气de小男生 提交于 2019-12-11 14:05:10
问题 I would like to know how to call the function below without refactoring from another js file. $(document).ready(function() { check(); function check () { setTimeout(function(){ location.reload(true); }, 10000); } }); I saw a question exist for this issue very old one but I cannot understand how to use the answer for my function. StackOverflow answer from another question I would like to see an example with my function and the proposed solution from the link. My example which does not work

Testing Teaspoon: Expected true to equal false

家住魔仙堡 提交于 2019-12-11 04:20:53
问题 modal.hide() is not closing the modal in tests, but works in manual testing. When I check if I can see the modal variable, I can see it from the 'it' statement, so I am not sure why I get a true when it should be false. describe("Helpers.Bootstrap.Modal", function() { describe("show", function(){ var modal ; describe("When no element Id is assigned to Modal()", function(){ beforeAll(function(){ modal = new Helpers.Bootstrap.Modal(); modal.show('Title','Message','ok','close', null); }) it(