Skip to content

Commit 2934cec

Browse files
depfu[bot]NGPixel
andauthored
chore(deps): update all npm dependencies for playwright (ietf-tools#5670)
* chore(deps): update all npm dependencies for playwright * test: fix faker.js deprecations * test: fix faker location deprecation --------- Co-authored-by: depfu[bot] <23717796+depfu[bot]@users.noreply.github.com> Co-authored-by: NGPixel <github@ngpixel.com>
1 parent e5dcc16 commit 2934cec

3 files changed

Lines changed: 409 additions & 100 deletions

File tree

playwright/helpers/meeting.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const sessionsWithWebex = [3, 4]
2222
// Use constant randomness seed
2323
seedrandom(TEST_SEED.toString(), { global: true })
2424
faker.seed(TEST_SEED)
25-
const { sample, sampleSize } = _.runInContext()
25+
const { random, sample, sampleSize } = _.runInContext()
2626

2727
/**
2828
* Generate area response from label + children
@@ -60,7 +60,7 @@ function createGroup ({ label, mayBeBof = false, toggledBy = [] }) {
6060
}
6161

6262
// 10% chance of BoF, if enabled
63-
const isBof = mayBeBof && faker.mersenne.rand(100, 0) < 10
63+
const isBof = mayBeBof && random(0, 100) < 10
6464
if (isBof) {
6565
toggledBy.push('bof')
6666
}
@@ -139,7 +139,7 @@ function createEvent ({
139139
}, floors) {
140140
const floor = sample(floors)
141141
const room = hasLocation ? sample(floor.rooms) : { name: 'Somewhere' }
142-
const eventName = name ?? faker.lorem.sentence(faker.mersenne.rand(5, 2))
142+
const eventName = name ?? faker.lorem.sentence(random(2, 5))
143143
return {
144144
id: ++lastEventId,
145145
sessionId: ++lastSessionId,
@@ -164,7 +164,7 @@ function createEvent ({
164164
'hackathon-sessc'
165165
],
166166
groupAcronym: group.keyword,
167-
groupName: faker.lorem.sentence(faker.mersenne.rand(5, 2)),
167+
groupName: faker.lorem.sentence(random(2, 5)),
168168
groupParent: {
169169
acronym: area.keyword
170170
},
@@ -215,11 +215,11 @@ module.exports = {
215215
break
216216
}
217217
case 'future': {
218-
startDate = DateTime.fromISO(faker.date.future(1).toISOString(), { zone: 'Asia/Tokyo' }).startOf('week').minus({ days: 2 })
218+
startDate = DateTime.fromISO(faker.date.future({ years: 1 }).toISOString(), { zone: 'Asia/Tokyo' }).startOf('week').minus({ days: 2 })
219219
break
220220
}
221221
default: {
222-
startDate = DateTime.fromISO(faker.date.past(5, DateTime.utc().minus({ months: 3 }), { zone: 'Asia/Tokyo' }).toISOString()).startOf('week').minus({ days: 2 })
222+
startDate = DateTime.fromISO(faker.date.past({ years: 5, refDate: DateTime.utc().minus({ months: 3 }) }).toISOString(), { zone: 'Asia/Tokyo' }).startOf('week').minus({ days: 2 })
223223
break
224224
}
225225
}
@@ -236,13 +236,13 @@ module.exports = {
236236
short: `L${floorIdx}`,
237237
width: floor.width,
238238
height: floor.height,
239-
rooms: _.times(faker.mersenne.rand(10, 5), (ridx) => {
239+
rooms: _.times(random(5, 10), (ridx) => {
240240
const roomName = `${faker.science.chemicalElement().name} ${floorIdx}-${ridx + 1}`
241241
// Keep 10% margin on each side
242242
const roomXUnit = Math.round(floor.width / 10)
243243
const roomYUnit = Math.round(floor.height / 10)
244-
const roomX = faker.mersenne.rand(roomXUnit * 8, roomXUnit)
245-
const roomY = faker.mersenne.rand(roomYUnit * 8, roomYUnit)
244+
const roomX = random(roomXUnit, roomXUnit * 8)
245+
const roomY = random(roomYUnit, roomYUnit * 8)
246246
return {
247247
id: floorIdx * 100 + ridx,
248248
name: roomName,
@@ -269,7 +269,7 @@ module.exports = {
269269
for (const area of firstAreasNames) {
270270
firstAreas.push(createArea({
271271
label: area,
272-
children: _.times(faker.mersenne.rand(25, 2), (idx) => {
272+
children: _.times(random(2, 25), (idx) => {
273273
return createGroup({ mayBeBof: true })
274274
})
275275
}))
@@ -282,7 +282,7 @@ module.exports = {
282282
for (const area of ['UVW', 'XYZ0']) {
283283
secondAreas.push(createArea({
284284
label: area,
285-
children: _.times(faker.mersenne.rand(25, 2), (idx) => {
285+
children: _.times(random(2, 25), (idx) => {
286286
return createGroup({ mayBeBof: true })
287287
})
288288
}))
@@ -620,10 +620,10 @@ module.exports = {
620620
return {
621621
meeting: {
622622
number: '123',
623-
city: faker.address.cityName(),
623+
city: faker.location.city(),
624624
startDate: startDate.toISODate(),
625625
endDate: endDate.toISODate(),
626-
updated: faker.date.between(startDate.toISO(), endDate.toISO()).toISOString(),
626+
updated: faker.date.between({ from: startDate.toISO(), to: endDate.toISO() }).toISOString(),
627627
timezone: 'Asia/Tokyo',
628628
infoNote: faker.lorem.paragraph(4),
629629
warningNote: ''

0 commit comments

Comments
 (0)