0

I am facing a problem with Chutzpah in Visual Studio 2017. I have some Tests for my jQuery Code, which run successfully in the Browser (Firefox, Edge & Chrome), but fail when running them in VS with Chutzpah.

First of all my setup:

  • Jasmin Version 2.5.2
  • Jasmin-jQuery Version 2.1.1
  • jQuery Version 3.1.1
  • Chutzpah 4.3.4
  • Visual Studio 2017 Version 15.1

My tests written in Jasmin with the extension Jasmin-jQuery.

var progressbarHTML = '<a id="progressbarCaption"></a>' +
       '<div id="progressContainer">' +
       '<div id="progressArea">' +
       '<div id="progressbar">' +
       '<div id="progresslabel" class="progress-label">' +
       '</div></div></div></div>';

describe("CSS Classes are loaded?", function() {
  beforeEach(function() {
    var html = '<div id="controlAddIn">' + progressbarHTML + '</div>';
    setFixtures(html);
    environment = {"Platform" : 0};
    InitializeControl();
  });

  it("Is CSS for progressbarCaption set", function() {
    expect($("#progressbarCaption")).toHaveClass("progressbarCaptionWidowsClient");
  });

  it("Is CSS for progressContainer set", function() {
    expect($("#progressContainer")).toHaveClass("progressContainerWindowsClient");
  });

  it("Is CSS for progresslabel set", function() {
    expect($("#progresslabel")).toHaveCss({'top': "1px"});
  });

});

When I run the tests in the browser i get

Test in Browser

enter image description here

which is totally fine. But when I run the test in VS with right click on the HTML file and "Run JS Tests". I get

Test 'CSS Classes are loaded?:Is CSS for progresslabel set' failed
    Expected ({ 0: HTMLNode, length: 1 }) to have css Object({ top: '1px' }).
    buildExpectationResult@file:///C:/Temp/Progressbar/DEV%20DE%20CU00%2013682%20BL%203151/Control%20Add-Ins%20JS/ProgressBar/Progressbar/Resource/Tests/lib/jasmine-2.5.2/jasmine.js:1610:19
    expectationResultFactory@file:///C:/Temp/Progressbar/DEV%20DE%20CU00%2013682%20BL%203151/Control%20Add-Ins%20JS/ProgressBar/Progressbar/Resource/Tests/lib/jasmine-2.5.2/jasmine.js:655:40
    addExpectationResult@file:///C:/Temp/Progressbar/DEV%20DE%20CU00%2013682%20BL%203151/Control%20Add-Ins%20JS/ProgressBar/Progressbar/Resource/Tests/lib/jasmine-2.5.2/jasmine.js:342:58
    addExpectationResult@file:///C:/Temp/Progressbar/DEV%20DE%20CU00%2013682%20BL%203151/Control%20Add-Ins%20JS/ProgressBar/Progressbar/Resource/Tests/lib/jasmine-2.5.2/jasmine.js:599:41
    file:///C:/Temp/Progressbar/DEV%20DE%20CU00%2013682%20BL%203151/Control%20Add-Ins%20JS/ProgressBar/Progressbar/Resource/Tests/lib/jasmine-2.5.2/jasmine.js:1564:32
in C:\Temp\Progressbar\DEV DE CU00 13682 BL 3151\Control Add-Ins JS\ProgressBar\Progressbar\Resource\Tests\SpecRunner.html (line 0)

Suddenly the last test fails and I have no idea why.

halfer
  • 19,824
  • 17
  • 99
  • 186
Torben
  • 438
  • 1
  • 7
  • 22
  • Can you share your chutzpah.json file? – Matthew Manela Apr 13 '17 at 03:36
  • I do not have one. The default settings will be used. – Torben Apr 13 '17 at 06:09
  • I am having same issue. Suddenly tests fail. No idea what's going on. Any help? – Don Box Nov 22 '17 at 17:06
  • Has there been any update on this? I am facing the same issue and it appears that the Chutzpah headless browser being used is IE9. I too am asserting the width and left position of an element which is a different number in IE 9 than in modern browsers. If I update my tests to assert the output from IE 9, running headless works perfectly but fails in modern browsers. Is there any way I can target chrome within the Chutzpah.json file? After googling for an hour, I saw that there was work being done back in December 2017 to update Chutzpah to use headless chrome but not sure if it is complete. On – Nathan Moebus Jun 18 '18 at 12:42
  • IE 9 conditonal comments were a fail. – Nathan Moebus Jun 18 '18 at 12:57

0 Answers0