Mochawesome not refreshing the tests

I have an issue in refreshing the html and json files from Mochawesome
The setup is with Selenium/NodeJs

Any idea will be welcome!

packaje.json file:
explanation line ("test": "mocha tests.js –reporter mochawesome && concurrently "http-server -a localhost -p 3000" "opener http://localhost:3000/mochawesome-report/mochawesome.html"") – start the tests with mocha, passing the tests to the mochawesome reporter, starting a web server on port 3000 and opening the generated html file with opener package in the default browser.

{
  "name": "selenium_test",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "start": "node index.js",
    "test": "mocha tests.js --reporter mochawesome && concurrently "http-server -a localhost -p 3000" "opener http://localhost:3000/mochawesome-report/mochawesome.html""
  },
  "author": "Adrian Badulescu",
  "license": "MIT",
  "dependencies": {
    "chai": "^4.3.4",
    "concurrently": "^6.2.0",
    "http-server": "^0.12.3",
    "mocha": "^8.4.0",
    "mochawesome": "^6.2.2",
    "opener": "^1.5.2",
    "selenium-webdriver": "^4.0.0-beta.1"
  }
}

tests.js file:
I have 2 tests, one pass and one fails – in CLI I can see the expected test results are correct

mocha CLI result

const { Builder, By, Key, until, Options, Actions, } = require('selenium-webdriver');
const assert = require('chai').assert;
const { guidEmail, randomString, randomNo, randomFloor, randomAlphaNumeric, T, sleep, randomBuildingLevels, randomResistanceStructure, randomConstructionYear, randomRange, generateCNP, randomCounty, randomDate, randomExpiringCIDate, tomorrowDateRomanianFormat, randomArrayItem, constants } = require('./utils');
const { randomItemJob, randomItemCounty, randomItemActivityDomain, randomActivityDomain } = require('./randomClasses');
const chrome = require('selenium-webdriver/chrome');
const { configLogin, randomStruct, randomCurrencyArray, randomPaymentFreqArray, floors, randomLevels, counties } = require('./constants');

describe('Just some random tests suite', function () {
  // const { siaMock_Link, siaMockEmailAddress, siaMockUsername, siaMock_ST_Password, siaMock_UAT_Password, ST_Link, UAT_Link } = new constants();
  const { siaMock_Link, siaMockEmailAddress, siaMockUsername, siaMock_ST_Password, siaMock_UAT_Password, ST_Link, UAT_Link } = new configLogin();
  var randomEmail = guidEmail()
  // instance random Occupation/Job
  const { pageJob, itemJob } = new randomItemJob();
  // instance random randomItemActivityDomain
  const { itemActivityDomain } = new randomActivityDomain();
  // instance tomorrow date
  const { tomorrow } = new tomorrowDateRomanianFormat();
  this.timeout(45000)
  before(async function () {

    driver = await new Builder().forBrowser('chrome').build();
  });

  it('Test if password exists', async function () {
    await driver.get(`${siaMock_Link}`);
    await driver.findElement(By.id('username')).sendKeys(`${siaMockUsername}`);    
    let pass = await driver.findElement(By.id('password'))
    await sleep(500)
    await assert.exists(pass);
    await pass.sendKeys(`${siaMock_ST_Password}`)
  });



  it('This test should fail', async function () {
    await false.should.be.true
  });



  after(async function () { await driver.quit(); process.exit() });
});

But mochawesome is just not refreshing, and is showing me invariable an old result

mochawesome results

Source: Ask Javascript Questions

LEAVE A COMMENT