Skip to content

Commit

Permalink
simplify usage of faker number generator
Browse files Browse the repository at this point in the history
  • Loading branch information
Maria Lorena Rodriguez Viruel authored and Maria Lorena Rodriguez Viruel committed Oct 31, 2024
1 parent c10da0f commit b99f6d4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const contactPage = require('@page-objects/default/contacts/contacts.wdio.page')
const utils = require('@utils');
const chtConfUtils = require('@utils/cht-conf');
const path = require('path');
const { resizeWindowForScreenshots, generateScreenshot, isMobile } = require('@utils/screenshots');
const { generateScreenshot, isMobile } = require('@utils/screenshots');

describe('Contact and User Management', () => {
const updateContactSummarySettings = async () => {
Expand All @@ -18,7 +18,7 @@ describe('Contact and User Management', () => {
contactSummaryExtras: contactSummaryExtrasFile
});
await utils.updateSettings(
{ contact_summary: contactSummary },
{ contact_summary: contactSummary},
{ revert: true, ignoreReload: true, refresh: true, sync: true }
);
await commonPage.waitForPageLoaded();
Expand Down Expand Up @@ -57,7 +57,8 @@ describe('Contact and User Management', () => {
});

describe('Contact and user overview', () => {
it('should show contacts list, search, profiles (person and family), contact summary', async () => {
it('should show contacts list, search, profiles (person and family), '+
'contact summary', async function() {
await commonPage.goToPeople();
expect(await commonPage.isPeopleListPresent()).to.be.true;
await generateScreenshot('people', 'list');
Expand Down
4 changes: 2 additions & 2 deletions tests/factories/cht/generate.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const deliveryFactory = require('@factories/cht/reports/delivery');
const pregnancyFactory = require('@factories/cht/reports/pregnancy');
const pregnancyVisitFactory = require('@factories/cht/reports/pregnancy-visit');
const immunizationFactory = require('@factories/cht/reports/inmunization');
const Faker = require('@faker-js/faker');
const { faker } = require('@faker-js/faker');

// Fixed collection of real-world data
const PRIMARY_CONTACT_FIRST_NAMES = [
Expand Down Expand Up @@ -41,7 +41,7 @@ date.setDate(date.getDate() - 252);
const LAST_MENSTRUAL_PERIOD = date.toISOString().split('T')[0]; //'YYYY-MM-DD'

const getReportContext = (patient, submitter) => {
const daysAgo = Faker.faker.number.int({ min: 1, max: 10 });
const daysAgo = faker.number.int({ min: 1, max: 10 });
const currentDate = new Date();
currentDate.setDate(currentDate.getDate() - daysAgo);
const context = {
Expand Down

0 comments on commit b99f6d4

Please sign in to comment.