dimanche 4 février 2018

Zombie JS outcome of button press not showing

I'm trying to write some tests for my single page app in zombie js. When I click the button '1', it should show the number one in my span tag.

However, with my test it does seem to press the button, but doesn't put anything in the span tag afterwards. Am I writing the test incorrectly?

test.js

const Browser = require("zombie");
var chai = require("chai"),
  expect = chai.expect,
  should = chai.should();

var should = require("chai").should();
var url = "http://localhost:8080/";

describe("User visits page", function() {
  const browser = new Browser();

  before(function() {
    return browser.visit(url);
  });

describe("button outcomes", function() {
    it("clicking a button shows it on the scorecard", function(done) {
      browser.pressButton("1");
      browser.text("span").should.equal("1");
      done();
    });
  });
});

zombie error message;

1) User visits page
       button outcomes
         clicking a button shows it on the scorecard:

      AssertionError: expected '' to equal '1'
      + expected - actual

      +1

Aucun commentaire:

Enregistrer un commentaire