1

I'm currently working in a docker container that runs an image of ubuntu.

These are the series of commands I've used to installed Xvfb, firefox, and Nodejs:

apt-get update

apt-get install -y xorg xvfb firefox dbus-x11 xfonts-100dpi xfonts-75dpi xfonts-cyrillic

apt-get install -y python gcc make g++ wget

wget https://nodejs.org/download/rc/v4.0.0-rc.1/node-v4.0.0-rc.1.tar.gz

tar -zxvf node-v4.0.0-rc.1.tar.gz
cd node-v4.0.0-rc.1

./configure

make install

After installing and making sure Node, npm, and Xvfb are working I tried to run some of my tests on firefox headless.

Here are the commands I used to run Xvfb and my test script (I wrote an npm script that calls mocha and the appropriate test):

xvfb-run npm run l-2361:spec

This was my output:

> ui-tests@1.0.0 l-2361:spec /go/src/bitbucket.org/companyName/platform/qe
> npm run env-local mocha test/admin/dashboard/adminUser/pdvi-2361.js -- --reporter spec --slow 0


> ui-tests@1.0.0 env-local /go/src/bitbucket.org/companyName/platform/qe
> env envVar='local' "mocha" "test/admin/dashboard/adminUser/pdvi-2361.js" "--reporter" "spec" "--slow" "0"



  Admin Tests - Role Admin User
    1) "before all" hook
    2) "after all" hook


  0 passing (29s)
  2 failing

  1) Admin Tests - Role Admin User "before all" hook:
     Uncaught NoSuchElementError: Unable to locate element: {"method":"css selector","selector":"input[name=\"email\"]"}
      at new bot.Error (node_modules/selenium-webdriver/lib/atoms/error.js:108:18)
      at Object.bot.response.checkResponse (node_modules/selenium-webdriver/lib/atoms/response.js:109:9)
      at node_modules/selenium-webdriver/lib/webdriver/webdriver.js:379:20
      at promise.Promise.goog.defineClass.invokeCallback_ (node_modules/selenium-webdriver/lib/goog/../webdriver/promise.js:1337:14)
      at promise.ControlFlow.goog.defineClass.goog.defineClass.abort_.error.executeNext_.execute_ (node_modules/selenium-webdriver/lib/goog/../webdriver/promise.js:2776:14)
      at promise.ControlFlow.goog.defineClass.goog.defineClass.abort_.error.executeNext_ (node_modules/selenium-webdriver/lib/goog/../webdriver/promise.js:2758:21)
      at goog.async.run.processWorkQueue (node_modules/selenium-webdriver/lib/goog/async/run.js:124:15)
  From: Task: WebElement.sendKeys()
      at webdriver.WebDriver.schedule (node_modules/selenium-webdriver/lib/webdriver/webdriver.js:362:15)
      at webdriver.WebElement.schedule_ (node_modules/selenium-webdriver/lib/webdriver/webdriver.js:1817:23)
      at webdriver.WebElement.sendKeys (node_modules/selenium-webdriver/lib/webdriver/webdriver.js:1988:17)
      at AdminLogin.fillEmail (pageObject/admin/login/index.js:32:21)
      at Context.<anonymous> (test/admin/dashboard/adminUser/pdvi-2361.js:27:16)

  2) Admin Tests - Role Admin User "after all" hook:
     EBUSY: resource busy or locked, unlink '/go/src/bitbucket.org/companyName/platform/qe/tmp-31175duruauo/amd64/.nfs00000000007d601300000004'
  Error: EBUSY: resource busy or locked, unlink 'tmp-31175duruauo/amd64/.nfs00000000007d601300000004'
      at Error (native)
  From: Task: WebDriver.call(function)
      at webdriver.WebDriver.call (node_modules/selenium-webdriver/lib/webdriver/webdriver.js:642:15)
      at Driver.quit (node_modules/selenium-webdriver/firefox/index.js:296:15)
      at Context.<anonymous> (test/admin/dashboard/adminUser/pdvi-2361.js:35:24)

Here is my test file, I placed my selenium functions/methods inside multiple page objects.

var driver = require('selenium-webdriver');
var sinon = require('sinon');
var chai = require('chai');
var sinonChai = require("sinon-chai");
var expect = chai.expect;
var should = chai.should;
var config = require('../../../../variables');
var AdminLogin = require('../../../../pageObject/admin/login/index.js');
var HeaderProfile = require('../../../../pageObject/admin/login/common/headerProfile/index.js');
var AccountSettings = require('../../../../pageObject/admin/login/accountSettings/index.js');

chai.use(require('chai-as-promised'));
chai.use(sinonChai);

describe('Admin Tests - Role Admin User', function() {
  var adminVar = process.env.envVar;
  var login = config[adminVar].adminSignin;
  var user = config[adminVar].role.adminUser.name;
  var email = config[adminVar].role.adminUser.email;
  var pw = config[adminVar].role.adminUser.password;
  before(function() {
    this.timeout(50000);
    this.driver = new driver.Builder().withCapabilities(driver.Capabilities.firefox()).build();
    this.driver.get(login);

    var adminLogin = new AdminLogin(this.driver);
    adminLogin.fillEmail(email);
    adminLogin.fillPassword(pw);
    adminLogin.signin();

    return this.driver.manage().timeouts().implicitlyWait(250);
  });

  after(function() {
    return this.driver.quit();
  });

  describe('would like to', function() {
    it('verify they have global access', function() {
      var headerProfile = new HeaderProfile(this.driver);
      return expect(headerProfile.getName()).to.eventually.equal(user);
    });
  });

  describe('would like to', function() {
    before(function() {
      var headerProfile = new HeaderProfile(this.driver);
      headerProfile.clickButton();
      return headerProfile.accountSettings();
    });

    it('go to account settings', function() {
      var acctSettings = new AccountSettings(this.driver);
      return expect(acctSettings.titleText()).to.eventually.equal('Account Settings');
    });
  });

});

pdvi-2361.js:35:24 is this function here:

after(function() {
    return this.driver.quit();
  });

The first error is a result of not being able to access the webpage I want to test but I'm not too sure what the second error means.

After trying to run the test it created a tmp folder with subfolders

tmp-311175duruauo/
  amd64/
  extensions/
    fxdriver@googlecode.com/
      platform/
        WINNT_x86-msvc/
          components/
            imehandler.dll
      resource/
        modules/
          timer.js
          web-element-cache.js
  storage/
    permanent/
      chrome/
        .metadata
        idb/
          piupsah.files/
          piupsah.sqlite
          piupsah.sqlite-shm
          piupsh.sqlite-wal

timer.js is only 100 LOC while web-element-cache.js is almost 10,000 LOC. The error above doesn't reference these files so I am guessing they aren't relevant to my problem?

This tmp directory is only created when I run the tests, how would I go about unlinking it and why do I need to unlink it?

azemPC
  • 264
  • 3
  • 15

0 Answers0