const assert = require('assert');
const MockServer  = require('../../../../lib/mockserver.js');
const CommandGlobals = require('../../../../lib/globals/commands.js');

describe('isVisible', function() {
  before(function(done) {
    CommandGlobals.beforeEach.call(this, done);
  });

  afterEach(function() {
    MockServer.removeMock({
      url: '/wd/hub/session/1352110219202/element/0/displayed',
      method: 'GET'
    });
  });

  after(function(done) {
    CommandGlobals.afterEach.call(this, done);
  });

  it('client.isVisible()', function(done) {
    MockServer.addMock({
      url: '/wd/hub/session/1352110219202/element/0/displayed',
      method: 'GET',
      response: JSON.stringify({
        sessionId: '1352110219202',
        status: 0,
        value: true
      })
    });

    this.client.api.isVisible('css selector', '#weblogin', function callback(result) {
      assert.strictEqual(result.value, true);
    }).isVisible('#weblogin', function callback(result) {
      assert.strictEqual(result.value, true);
    });

    this.client.start(done);
  });
});

@@ -1026,32 +1026,597 @@
 true);%0A    %7D);%0A%0A
+    this.client.start(done);%0A  %7D);%0A%0A  it('client.isVisible()', function(done) %7B%0A    MockServer.addMock(%7B%0A      url: '/wd/hub/session/1352110219202/element/0/displayed',%0A      method: 'GET',%0A      response: JSON.stringify(%7B%0A        sessionId: '1352110219202',%0A        status: 0,%0A        value: false%0A      %7D)%0A    %7D);%0A%0A    this.client.api.isVisible('css selector', '#weblogin', function callback(result) %7B%0A      assert.strictEqual(result.value, false);%0A    %7D).isVisible('#weblogin', function callback(result) %7B%0A      assert.strictEqual(result.value, false);%0A    %7D);%0A%0A
     this.client.

test case added for #2539 (#2979)