Skip to content

Commit e2da874

Browse files
clean
1 parent 34fdb5e commit e2da874

File tree

1 file changed

+45
-89
lines changed

1 file changed

+45
-89
lines changed

tests/Customizer.spec.js

Lines changed: 45 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,11 @@ describe('Synthea Customizer', () => {
4545
await page.getByRole('button', { name: 'HL7® FHIR® R4' }).click();
4646
await expect(page.locator('[data-test-id="data-requirements-heading"]')).toBeVisible();
4747

48-
await expect(page.getByRole('button', { name: /I need patients that meet certain clinical criteria/ })).toBeVisible();
49-
await expect(page.getByRole('button', { name: /I need a certain geographic location/ })).toBeVisible();
50-
await expect(page.getByRole('button', { name: /I need a population with specific demographics/ })).toBeVisible();
51-
await expect(page.getByRole('button', { name: /I need to re-create the same exact population/ })).toBeVisible();
52-
await expect(page.getByRole('button', { name: /None of these/ })).toBeVisible();
48+
await expect(page.getByRole('button', { name: 'I need patients that meet certain clinical criteria' })).toBeVisible();
49+
await expect(page.getByRole('button', { name: 'I need a certain geographic location' })).toBeVisible();
50+
await expect(page.getByRole('button', { name: 'I need a population with specific demographics' })).toBeVisible();
51+
await expect(page.getByRole('button', { name: 'I need to re-create the same exact population' })).toBeVisible();
52+
await expect(page.getByRole('button', { name: 'None of these' })).toBeVisible();
5353
});
5454

5555
describe('Export Format Tests', () => {
@@ -67,7 +67,7 @@ describe('Synthea Customizer', () => {
6767
await page.getByRole('button', { name }).click();
6868

6969
// Select "None of these" for data requirements to get to command generation
70-
await page.getByRole('button', { name: /None of these/ }).click();
70+
await page.getByRole('button', { name: 'None of these' }).click();
7171

7272
// Select Basic Setup to generate the command
7373
await page.getByRole('button', { name: 'Basic Setup' }).click();
@@ -76,9 +76,6 @@ describe('Synthea Customizer', () => {
7676
const codeBlock = page.locator('[data-test-id="basic-setup-command"]');
7777
await expect(codeBlock).toBeVisible();
7878
await expect(codeBlock).toContainText('java -jar synthea-with-dependencies.jar');
79-
80-
// In guided mode, configuration is handled via config file, not command line args
81-
// So we just verify the command is generated correctly
8279
});
8380
});
8481
});
@@ -90,62 +87,52 @@ describe('Synthea Customizer', () => {
9087
});
9188

9289
test('selecting "keep" shows clinical criteria fields', async ({ page }) => {
93-
await page.getByRole('button', { name: /I need patients that meet certain clinical criteria/ }).click();
90+
await page.getByRole('button', { name: 'I need patients that meet certain clinical criteria' }).click();
9491

95-
// Should show basic settings
9692
await expect(page.locator('[data-test-id="basic-settings-heading"]')).toBeVisible();
9793
await expect(page.getByLabel('Population')).toBeVisible();
9894

99-
// Should show keep module builder
10095
await expect(page.locator('[data-test-id="keep-module-builder-heading"]')).toBeVisible();
10196
});
10297

10398
test('selecting "geographic" shows geographic fields', async ({ page }) => {
104-
await page.getByRole('button', { name: /I need a certain geographic location/ }).click();
99+
await page.getByRole('button', { name: 'I need a certain geographic location' }).click();
105100

106-
// Should show basic settings
107101
await expect(page.locator('[data-test-id="basic-settings-heading"]')).toBeVisible();
108102

109-
// Should show geographic settings
110103
await expect(page.locator('[data-test-id="geographic-settings-heading"]')).toBeVisible();
111104
await expect(page.getByLabel('State')).toBeVisible();
112105
await expect(page.getByLabel('City')).toBeVisible();
113106
});
114107

115108
test('selecting "demographic" shows demographic fields', async ({ page }) => {
116-
await page.getByRole('button', { name: /I need a population with specific demographics/ }).click();
109+
await page.getByRole('button', { name: 'I need a population with specific demographics' }).click();
117110

118-
// Should show basic settings
119111
await expect(page.locator('[data-test-id="basic-settings-heading"]')).toBeVisible();
120112

121-
// Should show demographic settings
122113
await expect(page.locator('[data-test-id="demographic-settings-heading"]')).toBeVisible();
123114
await expect(page.getByLabel('Gender')).toBeVisible();
124115
await expect(page.getByLabel('Age Min')).toBeVisible();
125116
await expect(page.getByLabel('Age Max')).toBeVisible();
126117
});
127118

128119
test('selecting "reproducibility" shows reproducibility fields', async ({ page }) => {
129-
await page.getByRole('button', { name: /I need to re-create the same exact population/ }).click();
120+
await page.getByRole('button', { name: 'I need to re-create the same exact population' }).click();
130121

131-
// Should show basic settings
132122
await expect(page.locator('[data-test-id="basic-settings-heading"]')).toBeVisible();
133123

134-
// Should show reproducibility settings
135124
await expect(page.locator('[data-test-id="reproducibility-settings-heading"]')).toBeVisible();
136125
await expect(page.getByLabel('Seed', { exact: true })).toBeVisible();
137126
await expect(page.getByLabel('Clinician Seed')).toBeVisible();
138-
await expect(page.getByLabel(/Reference Date/)).toBeVisible();
127+
await expect(page.getByLabel('Reference Date')).toBeVisible();
139128
});
140129

141130
test('selecting "none" shows only basic fields', async ({ page }) => {
142-
await page.getByRole('button', { name: /None of these/ }).click();
131+
await page.getByRole('button', { name: 'None of these' }).click();
143132

144-
// Should show basic settings
145133
await expect(page.locator('[data-test-id="basic-settings-heading"]')).toBeVisible();
146134
await expect(page.getByLabel('Population')).toBeVisible();
147135

148-
// Should not show other field groups
149136
await expect(page.locator('[data-test-id="geographic-settings-heading"]')).not.toBeVisible();
150137
await expect(page.locator('[data-test-id="demographic-settings-heading"]')).not.toBeVisible();
151138
await expect(page.locator('[data-test-id="reproducibility-settings-heading"]')).not.toBeVisible();
@@ -156,18 +143,18 @@ describe('Synthea Customizer', () => {
156143
beforeEach(async ({ page }) => {
157144
// Select export format and data requirement to get to setup selection
158145
await page.getByRole('button', { name: 'HL7® FHIR® R4' }).click();
159-
await page.getByRole('button', { name: /None of these/ }).click();
146+
await page.getByRole('button', { name: 'None of these' }).click();
160147
});
161148

162149
test('shows setup mode options', async ({ page }) => {
163150
await expect(page.locator('[data-test-id="setup-mode-heading"]')).toBeVisible();
164-
await expect(page.getByRole('button', { name: /Docker/ })).toBeVisible();
165-
await expect(page.getByRole('button', { name: /Basic Setup/ })).toBeVisible();
166-
await expect(page.getByRole('button', { name: /Developer Setup/ })).toBeVisible();
151+
await expect(page.getByRole('button', { name: 'Docker' })).toBeVisible();
152+
await expect(page.getByRole('button', { name: 'Basic Setup' })).toBeVisible();
153+
await expect(page.getByRole('button', { name: 'Developer Setup' })).toBeVisible();
167154
});
168155

169156
test('Docker setup generates docker command', async ({ page }) => {
170-
await page.getByRole('button', { name: /Docker/ }).click();
157+
await page.getByRole('button', { name: 'Docker' }).click();
171158

172159
// Expand the dockerfile accordion to see the content
173160
await page.getByText('View Dockerfile').click();
@@ -178,15 +165,15 @@ describe('Synthea Customizer', () => {
178165
});
179166

180167
test('Basic setup generates jar command', async ({ page }) => {
181-
await page.getByRole('button', { name: /Basic Setup/ }).click();
168+
await page.getByRole('button', { name: 'Basic Setup' }).click();
182169

183170
const codeBlock = page.locator('[data-test-id="basic-setup-command"]');
184171
await expect(codeBlock).toBeVisible();
185172
await expect(codeBlock).toContainText('java -jar synthea-with-dependencies.jar');
186173
});
187174

188175
test('Developer setup generates gradle command', async ({ page }) => {
189-
await page.getByRole('button', { name: /Developer Setup/ }).click();
176+
await page.getByRole('button', { name: 'Developer Setup' }).click();
190177

191178
const codeBlock = page.locator('[data-test-id="developer-run-command"]');
192179
await expect(codeBlock).toBeVisible();
@@ -197,29 +184,26 @@ describe('Synthea Customizer', () => {
197184
describe('Input Field Integration', () => {
198185
test('population input affects generated command', async ({ page }) => {
199186
await page.getByRole('button', { name: 'HL7® FHIR® R4' }).click();
200-
await page.getByRole('button', { name: /None of these/ }).click();
187+
await page.getByRole('button', { name: 'None of these' }).click();
201188

202-
// Fill in population
203189
await page.getByLabel('Population').fill('100');
204190

205-
await page.getByRole('button', { name: /Basic Setup/ }).click();
191+
await page.getByRole('button', { name: 'Basic Setup' }).click();
206192

207193
const codeBlock = page.locator('[data-test-id="basic-setup-command"]');
208194
await expect(codeBlock).toContainText('-p 100');
209195
});
210196

211197
test('geographic inputs affect generated command', async ({ page }) => {
212198
await page.getByRole('button', { name: 'HL7® FHIR® R4' }).click();
213-
await page.getByRole('button', { name: /I need a certain geographic location/ }).click();
199+
await page.getByRole('button', { name: 'I need a certain geographic location' }).click();
214200

215-
// Fill in state
216201
await page.getByLabel('State').click();
217202
await page.getByRole('option', { name: 'California' }).click();
218203

219-
// Fill in city
220204
await page.getByLabel('City').fill('Los Angeles');
221205

222-
await page.getByRole('button', { name: /Basic Setup/ }).click();
206+
await page.getByRole('button', { name: 'Basic Setup' }).click();
223207

224208
const codeBlock = page.locator('[data-test-id="basic-setup-command"]');
225209
await expect(codeBlock).toContainText('California');
@@ -228,33 +212,30 @@ describe('Synthea Customizer', () => {
228212

229213
test('demographic inputs affect generated command', async ({ page }) => {
230214
await page.getByRole('button', { name: 'HL7® FHIR® R4' }).click();
231-
await page.getByRole('button', { name: /I need a population with specific demographics/ }).click();
215+
await page.getByRole('button', { name: 'I need a population with specific demographics' }).click();
232216

233-
// Fill in gender
234217
await page.getByLabel('Gender').click();
235-
await page.getByRole('option', { name: 'M' }).click();
218+
await page.getByRole('option', { name: 'F' }).click();
236219

237-
// Fill in age range
238-
await page.getByLabel('Age Min').fill('25');
220+
await page.getByLabel('Age Min').fill('18');
239221
await page.getByLabel('Age Max').fill('65');
240222

241-
await page.getByRole('button', { name: /Basic Setup/ }).click();
223+
await page.getByRole('button', { name: 'Basic Setup' }).click();
242224

243225
const codeBlock = page.locator('[data-test-id="basic-setup-command"]');
244-
await expect(codeBlock).toContainText('-g M');
245-
await expect(codeBlock).toContainText('-a 25-65');
226+
await expect(codeBlock).toContainText('-g F');
227+
await expect(codeBlock).toContainText('-a 18-65');
246228
});
247229

248230
test('reproducibility inputs affect generated command', async ({ page }) => {
249231
await page.getByRole('button', { name: 'HL7® FHIR® R4' }).click();
250-
await page.getByRole('button', { name: /I need to re-create the same exact population/ }).click();
232+
await page.getByRole('button', { name: 'I need to re-create the same exact population' }).click();
251233

252-
// Fill in reproducibility fields
253234
await page.getByLabel('Seed', { exact: true }).fill('12345');
254235
await page.getByLabel('Clinician Seed').fill('67890');
255-
await page.getByLabel(/Reference Date/).fill('20240101');
236+
await page.getByLabel('Reference Date').fill('20240101');
256237

257-
await page.getByRole('button', { name: /Basic Setup/ }).click();
238+
await page.getByRole('button', { name: 'Basic Setup' }).click();
258239

259240
const codeBlock = page.locator('[data-test-id="basic-setup-command"]');
260241
await expect(codeBlock).toContainText('-s 12345');
@@ -265,15 +246,12 @@ describe('Synthea Customizer', () => {
265246

266247
test('advanced configuration options are available', async ({ page }) => {
267248
await page.getByRole('button', { name: 'HL7® FHIR® R4' }).click();
268-
await page.getByRole('button', { name: /None of these/ }).click();
249+
await page.getByRole('button', { name: 'None of these' }).click();
269250

270-
// Check for advanced configuration accordion
271251
await expect(page.getByText('Advanced Configuration Options')).toBeVisible();
272252

273-
// Expand the accordion
274253
await page.getByText('Advanced Configuration Options').click();
275254

276-
// Should show config options
277255
await expect(page.locator('input[name*="exporter"]').first()).toBeVisible();
278256
});
279257
});
@@ -299,46 +277,32 @@ describe('Synthea Customizer', () => {
299277
});
300278

301279
test('all input fields are visible', async ({ page }) => {
302-
// Basic fields
303280
await expect(page.getByLabel('Population')).toBeVisible();
304-
305-
// Geographic fields
306281
await expect(page.getByLabel('State')).toBeVisible();
307282
await expect(page.getByLabel('City')).toBeVisible();
308-
309-
// Demographic fields
310283
await expect(page.getByLabel('Gender')).toBeVisible();
311284
await expect(page.getByLabel('Age Min')).toBeVisible();
312285
await expect(page.getByLabel('Age Max')).toBeVisible();
313-
314-
// Reproducibility fields
315286
await expect(page.locator('[data-test-id="seed-input"]')).toBeVisible();
316287
await expect(page.getByLabel('Clinician Seed')).toBeVisible();
317-
await expect(page.getByLabel(/Reference Date/)).toBeVisible();
288+
await expect(page.getByLabel('Reference Date')).toBeVisible();
318289
});
319290

320291
test('command updates when inputs change', async ({ page }) => {
321-
// Fill in some values
322292
await page.getByLabel('Population').fill('50');
323-
await page.getByLabel('Seed', { exact: true }).fill('999');
293+
await page.getByLabel('Seed', { exact: true }).fill('999');
324294

325-
// Check command is updated
326295
const codeBlock = page.locator('[data-test-id="command-output"]');
327296
await expect(codeBlock).toContainText('-p 50');
328297
await expect(codeBlock).toContainText('-s 999');
329298
});
330299

331300
test('config builder allows adding settings', async ({ page }) => {
332-
// Click on config dropdown
333301
await page.getByLabel('Choose Setting').click();
334302

335-
// Select a config option
336-
await page.getByRole('option', { name: /exporter.csv.export/ }).click();
337-
338-
// Add the config
303+
await page.getByRole('option', { name: 'exporter.csv.export' }).click();
339304
await page.getByRole('button', { name: 'Add Config' }).click();
340305

341-
// Should show the config field
342306
await expect(page.locator('input[name="exporter.csv.export"]')).toBeVisible();
343307
});
344308

@@ -362,8 +326,8 @@ describe('Synthea Customizer', () => {
362326

363327
await page.getByRole('button', { name: 'Use Guided Mode' }).click();
364328
await page.getByRole('button', { name: 'HL7® FHIR® R4' }).click();
365-
await page.getByRole('button', { name: /None of these/ }).click();
366-
await page.getByRole('button', { name: /Basic Setup/ }).click();
329+
await page.getByRole('button', { name: 'None of these' }).click();
330+
await page.getByRole('button', { name: 'Basic Setup' }).click();
367331

368332
// Check that the code block is visible
369333
const codeBlock = page.locator('[data-test-id="basic-setup-command"]');
@@ -390,35 +354,31 @@ describe('Synthea Customizer', () => {
390354

391355
await page.getByRole('button', { name: 'Use Advanced Mode' }).click();
392356

393-
// Check that the code block is visible
394357
const codeBlock = page.locator('[data-test-id="command-output"]');
395358
await expect(codeBlock).toBeVisible();
396359

397-
// Get the text content of the code block
398360
const codeText = await codeBlock.textContent();
399361

400-
// Find the copy button as a child of the code block
401362
const copyButton = codeBlock.locator('button');
402363
await expect(copyButton).toBeVisible();
403364

404-
// Click the copy button
405365
await copyButton.click();
406366

407-
// Check that the content was copied to clipboard
408367
const clipboardText = await page.evaluate(() => navigator.clipboard.readText());
409368
expect(clipboardText).toContain(codeText);
410369
});
411370

412371
test('config file download button is available', async ({ page }) => {
413372
await page.getByRole('button', { name: 'Use Advanced Mode' }).click();
414373

415-
// Add a config setting first
416374
await page.getByLabel('Choose Setting').click();
417-
await page.getByRole('option', { name: /exporter.csv.export/ }).click();
418-
await page.getByRole('button', { name: 'Add Config' }).click();
375+
await page.getByRole('option', { name: 'exporter.csv.export' }).click();
376+
await page.getByRole('button', { name: 'Add Config' }).click();
377+
await page.locator('input[name="exporter.csv.export"]').click();
419378

420-
// Should show download button
421-
await expect(page.getByRole('button', { name: 'Download Config File' })).toBeVisible();
379+
await expect(page.getByRole('button', { name: 'Download Config File' })).toBeVisible();
380+
381+
// TODO: check downloaded file text
422382
});
423383
});
424384

@@ -429,8 +389,7 @@ describe('Synthea Customizer', () => {
429389
await page.getByRole('button', { name: 'Use Guided Mode' }).click();
430390
await expect(page.getByText('Which data formats do you need?')).toBeVisible();
431391

432-
// Go back to mode selection (this would require a back button or similar navigation)
433-
// For now, we'll reload the page to simulate going back
392+
// Reload to go back to selection
434393
await page.reload();
435394

436395
// Switch to advanced mode
@@ -439,14 +398,11 @@ describe('Synthea Customizer', () => {
439398
});
440399

441400
test('can switch from advanced to guided mode', async ({ page }) => {
442-
// Start in advanced mode
443401
await page.getByRole('button', { name: 'Use Advanced Mode' }).click();
444402
await expect(page.getByRole('heading', { name: 'Command-line Argument Builder' })).toBeVisible();
445403

446-
// Go back to mode selection
447404
await page.reload();
448405

449-
// Switch to guided mode
450406
await page.getByRole('button', { name: 'Use Guided Mode' }).click();
451407
await expect(page.getByText('Which data formats do you need?')).toBeVisible();
452408
});

0 commit comments

Comments
 (0)