Skip to content

Commit 698a0f8

Browse files
netpyne-123 step for checking the saved models filenames
1 parent 801a06b commit 698a0f8

1 file changed

Lines changed: 176 additions & 0 deletions

File tree

tests/frontend/e2e/tests/SaveOpenFile.test.js

Lines changed: 176 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,4 +345,180 @@ describe('Save / Open File testing', () => {
345345

346346
})
347347

348+
it('Check default Saved Model', async () => {
349+
console.log('Checking default saved model ...')
350+
await page.waitForTimeout(PAGE_WAIT * 2)
351+
await page.waitForSelector('div[title="Python"]')
352+
353+
await page.click('div[title="Python"]')
354+
await page.waitForSelector('#pythonConsoleOutput')
355+
356+
const elementHandle = await page.waitForSelector(
357+
'#pythonConsoleFrame'
358+
);
359+
360+
const python_frame = await elementHandle.contentFrame();
361+
362+
await python_frame.waitForSelector('#ipython-main-app')
363+
364+
await python_frame.waitForSelector('div.inner_cell')
365+
const line = await python_frame.$('div.inner_cell')
366+
await line.click()
367+
await line.type('pwd')
368+
369+
await page.keyboard.down('Shift');
370+
await page.keyboard.press('Enter');
371+
await page.keyboard.up('Shift');
372+
373+
await python_frame.waitForSelector('div[class="output_subarea output_text output_result"]')
374+
375+
await page.waitForTimeout(PAGE_WAIT * 3)
376+
377+
const first_code_output = await python_frame.$$eval('div[class="output_subarea output_text output_result"]', pwd_code_outputs => {
378+
return pwd_code_outputs.map(pwd_code_output => pwd_code_output.innerText)
379+
})
380+
381+
expect(first_code_output[0]).toBe("'/home/jovyan/work/NetPyNE-UI/workspace'")
382+
383+
const code_lines = await python_frame.$$('div.inner_cell')
384+
385+
await code_lines[1].type('cd uploads/aut_test/src')
386+
387+
await page.keyboard.down('Shift');
388+
await page.keyboard.press('Enter');
389+
await page.keyboard.up('Shift');
390+
391+
await page.waitForTimeout(PAGE_WAIT * 3)
392+
393+
const second_code_output = await python_frame.$$eval('div[class="output_subarea output_text output_stream output_stdout"]', cd_code_outputs => {
394+
return cd_code_outputs.map(cd_code_output => cd_code_output.innerText)
395+
})
396+
397+
expect(second_code_output[0]).toBe("/home/jovyan/work/NetPyNE-UI/workspace/uploads/aut_test/src\n")
398+
399+
const ls_code_lines = await python_frame.$$('div.inner_cell')
400+
401+
await ls_code_lines[1].type('ls -l')
402+
403+
await page.keyboard.down('Shift');
404+
await page.keyboard.press('Enter');
405+
await page.keyboard.up('Shift');
406+
407+
await page.waitForTimeout(PAGE_WAIT * 3)
408+
409+
const third_code_output = await python_frame.$$eval('div[class="output_subarea output_text output_stream output_stdout"]', ls_code_outputs => {
410+
return ls_code_outputs.map(ls_code_output => ls_code_output.innerText)
411+
})
412+
413+
expect(third_code_output[1]).toContain("cfg.json")
414+
expect(third_code_output[1]).toContain("netParams.json")
415+
416+
console.log('Model saved correctly')
417+
418+
})
419+
420+
it('Check netParams.py Saved Model', async () => {
421+
console.log('Checking netParams.py saved model ...')
422+
423+
await page.waitForSelector('#pythonConsoleOutput')
424+
425+
const elementHandle = await page.waitForSelector(
426+
'#pythonConsoleFrame'
427+
);
428+
429+
const python_frame = await elementHandle.contentFrame();
430+
431+
await python_frame.waitForSelector('#ipython-main-app')
432+
433+
const cd_code_lines = await python_frame.$$('div.inner_cell')
434+
435+
await cd_code_lines[2].type('cd ../../')
436+
437+
await page.keyboard.down('Shift');
438+
await page.keyboard.press('Enter');
439+
await page.keyboard.up('Shift');
440+
441+
await page.waitForTimeout(PAGE_WAIT * 3)
442+
443+
const net_code_lines = await python_frame.$$('div.inner_cell')
444+
445+
await net_code_lines[3].type('cd aut_test_net_params/src')
446+
await page.keyboard.down('Shift');
447+
await page.keyboard.press('Enter');
448+
await page.keyboard.up('Shift');
449+
450+
await page.waitForTimeout(PAGE_WAIT * 3)
451+
452+
const ls_code_lines = await python_frame.$$('div.inner_cell')
453+
454+
await ls_code_lines[3].type('ls -l')
455+
456+
await page.keyboard.down('Shift');
457+
await page.keyboard.press('Enter');
458+
await page.keyboard.up('Shift');
459+
460+
await page.waitForTimeout(PAGE_WAIT * 3)
461+
462+
const netParam_code_output = await python_frame.$$eval('div[class="output_subarea output_text output_stream output_stdout"]', np_code_outputs => {
463+
return np_code_outputs.map(np_code_output => np_code_output.innerText)
464+
})
465+
466+
expect(netParam_code_output[4]).toContain("cfg.json")
467+
expect(netParam_code_output[4]).toContain("netParams.py")
468+
469+
console.log('Model saved correctly')
470+
})
471+
472+
it('Check cfg.py Saved Model', async () => {
473+
console.log('Checking cfg.py saved model ...')
474+
475+
await page.waitForSelector('#pythonConsoleOutput')
476+
477+
const elementHandle = await page.waitForSelector(
478+
'#pythonConsoleFrame'
479+
);
480+
481+
const python_frame = await elementHandle.contentFrame();
482+
483+
await python_frame.waitForSelector('#ipython-main-app')
484+
485+
const cd_code_lines = await python_frame.$$('div.inner_cell')
486+
487+
await cd_code_lines[4].type('cd ../../')
488+
489+
await page.keyboard.down('Shift');
490+
await page.keyboard.press('Enter');
491+
await page.keyboard.up('Shift');
492+
493+
await page.waitForTimeout(PAGE_WAIT * 3)
494+
495+
const net_code_lines = await python_frame.$$('div.inner_cell')
496+
497+
await net_code_lines[5].type('cd aut_test_sim_config/src')
498+
await page.keyboard.down('Shift');
499+
await page.keyboard.press('Enter');
500+
await page.keyboard.up('Shift');
501+
502+
await page.waitForTimeout(PAGE_WAIT * 3)
503+
504+
const ls_code_lines = await python_frame.$$('div.inner_cell')
505+
506+
await ls_code_lines[6].type('ls -l')
507+
508+
await page.keyboard.down('Shift');
509+
await page.keyboard.press('Enter');
510+
await page.keyboard.up('Shift');
511+
512+
await page.waitForTimeout(PAGE_WAIT * 3)
513+
514+
const simConfig_code_output = await python_frame.$$eval('div[class="output_subarea output_text output_stream output_stdout"]', sc_code_outputs => {
515+
return sc_code_outputs.map(sc_code_output => sc_code_output.innerText)
516+
})
517+
518+
expect(simConfig_code_output[7]).toContain("cfg.py")
519+
expect(simConfig_code_output[7]).toContain("netParams.json")
520+
console.log('Model saved correctly')
521+
522+
})
523+
348524
})

0 commit comments

Comments
 (0)