Problems with Console reporting and Assertions

I am using Nodejs with Appium on a native iOS app.

I’m currently trying to setup my tests to enable some console reporting and assertions. I wasn’t sure on the best frameworks to use for this, so I have been trialling different ones. I’m currently trying to get Mocha/Chai working and have also even tried some chai-as-promised.

My main issue is that as soon as I run the test using npm run ios (a shortcut from my package.json), my tests instantly pass, even though my simulator hasn’t even yet loaded the app up. If I have an assertion in there, then it instantly fails as it states the result is “pending”. I’ve tried playing around with different forms of assertions and expect statements and also moving them to different places (as well as adding a beforeEach)

Here is my code:

const wdio = require('webdriverio');
const caps = {"platformName":"iOS","platformVersion":"11.4","deviceName":"iPhone 8","app":"/Users/xxx.app","automationName":"XCUITest"};
const driver = wdio.remote({
  protocol: "http",
  host: "localhost",
  port: 4723,
  path: "/wd/hub",
  desiredCapabilities: caps
});

var expect = require('chai').expect;
//var assert = require('chai').assert;

var chai = require('chai');
var chaiAsPromised = require('chai-as-promised');
chai.Should();
chai.use(chaiAsPromised);
chaiAsPromised.transferPromiseness = driver.transferPromiseness;

describe("Onboarding Login Test Desc", function () {

it("Onboarding Login Test It", function(){
driver.init()
  .waitForVisible("~btn_onboarding_right_action")
  .pause(1000)
  .touchAction([
    {action: 'press', x: 320, y: 350},
    {action: 'wait', ms: 100},
    {action: 'moveTo', x: 80, y: 350},
    'release'
    ])
  .pause(500)
  .touchAction([
    {action: 'press', x: 320, y: 350},
    {action: 'wait', ms: 100},
    {action: 'moveTo', x: 80, y: 350},
    'release'
    ])
  .pause(500)
  .touchAction([
    {action: 'press', x: 320, y: 350},
    {action: 'wait', ms: 100},
    {action: 'moveTo', x: 80, y: 350},
    'release'
    ])
  .pause(500)
  .element("~btn_onboarding_login")
  .click()
  .element("~textbox_login_email_address").click()
  .element("~textbox_login_email_address").keys("[email protected]")
  .element("~textbox_login_password").click()
  .element("~textbox_login_password").keys("pa55word")
  .element("~btn_login_login")
  .click()
  .execute('mobile:alert', { action: 'accept' })
  //Assert that we see logged in state here
  .pause(3000);
  //TestResult = assert(driver.element("~btn_cancel").isVisible(), "Verification flow is displayed");
  //console.log(TestResult)
  //expect(driver.element("~btn_cancel").isVisible()).to.be.true;
  //expect(true).to.be.true;
  return expect(true).to.be.true;
  //return promise.should.be.fulfilled;
  driver.end();
  })

it("second test run", function(){

  return expect(true).to.be.true;
})
});

Has anyone else encountered similar issues?

Bump for visibility .