testproject-io / javascript-opensdk

TestProject OpenSDK for Node.js
Apache License 2.0
24 stars 16 forks source link

Failed test steps are reported as Passed #13

Closed Rantzur1992 closed 3 years ago

Rantzur1992 commented 3 years ago

Running the following code:

import { By } from 'selenium-webdriver';
import { Builder } from '@tpio/javascript-opensdk';

describe('Test example using chrome', () => {
  let driver;
  let mocha = require('mocha');

  mocha.before(async () => {
    driver = new Builder()
      .forBrowser('chrome')
      .withProjectName('Examples')
      .withJobName('Example Job')
      .build();
  });

  mocha.after(async () => {
    await driver.quit();
  });

  it('Test that should fail', async () => {
    await driver.get('https://example.testproject.io/web/');
    await driver.findElement(By.css('#nam')).sendKeys('Test 1');
    await driver.findElement(By.css('#password')).sendKeys('12345');
    await driver.findElement(By.css('#login')).click();

    const passed = await driver.findElement(By.css('#logout')).isDisplayed();

    console.log(passed ? 'Test Passed' : 'Test Failed');
  });
});

Results a fail in Mocha:

image

But passes in the Reports:

image