testproject-io / javascript-opensdk

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

Test Suite reports all steps in the last Test #12

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 1', async () => {
    await driver.get('https://example.testproject.io/web/');
    await driver.findElement(By.css('#name')).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');
  });

  it('Test 2', async () => {
    await driver.get('https://example.testproject.io/web/');
    await driver.findElement(By.css('#name')).sendKeys('Test 2');
    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 in the following report:

image

Only the last test is reported, with all the previous tests steps inside.