11//IMPORTS:
22import 'expect-puppeteer' ;
3- import { click } from './utils' ;
43import { toMatchImageSnapshot } from 'jest-image-snapshot'
54expect . extend ( { toMatchImageSnapshot } )
65const path = require ( 'path' ) ;
@@ -27,6 +26,57 @@ const SNAPSHOT_OPTIONS = {
2726
2827let r = ( Math . random ( ) + 1 ) . toString ( 36 ) . substring ( 2 ) ;
2928
29+ const EDITED_MODEL = `\"popParams\": {
30+ \"E2\": {
31+ \"cellType\": \"E\",
32+ \"numCells\": 5,
33+ \"yRange\": [
34+ 100,
35+ 300
36+ ]
37+ },
38+ \"E4\": {
39+ \"cellType\": \"E\",
40+ \"numCells\": 5,
41+ \"yRange\": [
42+ 300,
43+ 600
44+ ]
45+ },
46+ \"E5\": {
47+ \"cellType\": \"E\",
48+ \"numCells\": 5,
49+ \"ynormRange\": [
50+ 0.6,
51+ 1.0
52+ ]
53+ },
54+ \"I2\": {
55+ \"cellType\": \"I\",
56+ \"numCells\": 5,
57+ \"yRange\": [
58+ 100,
59+ 300
60+ ]
61+ },
62+ \"I4\": {
63+ \"cellType\": \"I\",
64+ \"numCells\": 5,
65+ \"yRange\": [
66+ 300,
67+ 600
68+ ]
69+ },
70+ \"I5\": {
71+ \"cellType\": \"I\",
72+ \"numCells\": 5,
73+ \"ynormRange\": [
74+ 0.6,
75+ 1.0
76+ ]
77+ }
78+ },`
79+
3080//USERS:
3181const USERNAME = `TestUser${ r } `
3282const PASSWORD = 'testpassword'
@@ -521,4 +571,38 @@ describe('Save / Open File testing', () => {
521571
522572 } )
523573
574+ it ( 'Check the edited Populations of the Saved Model' , async ( ) => {
575+
576+ console . log ( 'Checking cfg.py saved model ...' )
577+
578+ await page . waitForSelector ( '#pythonConsoleOutput' )
579+
580+ const elementHandle = await page . waitForSelector (
581+ '#pythonConsoleFrame'
582+ ) ;
583+
584+ const python_frame = await elementHandle . contentFrame ( ) ;
585+
586+ await python_frame . waitForSelector ( '#ipython-main-app' )
587+
588+ const code_lines = await python_frame . $$ ( 'div.inner_cell' )
589+
590+ await code_lines [ 7 ] . type ( 'cat netParams.json ' )
591+
592+ await page . keyboard . down ( 'Shift' ) ;
593+ await page . keyboard . press ( 'Enter' ) ;
594+ await page . keyboard . up ( 'Shift' ) ;
595+
596+ await page . waitForTimeout ( PAGE_WAIT * 3 )
597+
598+ const cat_code_output = await python_frame . $$eval ( 'div[class="output_subarea output_text output_stream output_stdout"]' , cat_code_outputs => {
599+ return cat_code_outputs . map ( cat_code_output => cat_code_output . innerText )
600+ } )
601+
602+ expect ( cat_code_output [ 8 ] ) . toContain ( EDITED_MODEL )
603+
604+ } )
605+
606+
607+
524608} )
0 commit comments