@@ -23,27 +23,31 @@ import ModalHeader from "../ModalHeader";
2323import Input from "../FormInput" ;
2424import FlatButton from "../FlatButton" ;
2525import Checkbox from "../Checkbox" ;
26+ import Markdown from "../Markdown" ;
2627
2728export default class SuiteSettings extends React . Component {
2829 constructor ( props ) {
2930 super ( props ) ;
3031 this . state = {
3132 timeout : props . timeout ? props . timeout : "" ,
32- isParallel : ! ! props . isParallel
33+ isParallel : ! ! props . isParallel ,
34+ persistSession : ! ! props . persistSession
3335 } ;
3436 }
3537 static propTypes = {
3638 isEditing : PropTypes . bool ,
3739 timeout : PropTypes . number ,
3840 isParallel : PropTypes . bool ,
41+ persistSession : PropTypes . bool ,
3942 submit : PropTypes . func ,
4043 cancel : PropTypes . func
4144 } ;
4245 componentWillReceiveProps ( nextProps ) {
4346 if ( ! this . props . isEditing && nextProps . isEditing ) {
4447 this . setState ( {
4548 timeout : nextProps . timeout ,
46- isParallel : nextProps . isParallel
49+ isParallel : nextProps . isParallel ,
50+ persistSession : nextProps . persistSession
4751 } ) ;
4852 }
4953 }
@@ -57,7 +61,13 @@ export default class SuiteSettings extends React.Component {
5761 isParallel : e . target . checked
5862 } ) ;
5963 }
64+ onPersistSessionChange ( e ) {
65+ this . setState ( {
66+ persistSession : e . target . checked
67+ } ) ;
68+ }
6069 render ( ) {
70+ const persistSession = ! this . state . isParallel && this . state . persistSession ;
6171 return (
6272 < Modal className = "suite-settings-dialog" isOpen = { this . props . isEditing } onRequestClose = { this . props . cancel } >
6373 < form onSubmit = { ( e ) => { e . preventDefault ( ) ; } } style = { {
@@ -67,10 +77,20 @@ export default class SuiteSettings extends React.Component {
6777 < div className = "form-contents" >
6878 < Input name = "suite-timeout" type = "number" label = "Timeout (seconds)" placeholder = { DEFAULT_TIMEOUT } value = { this . state . timeout } width = { 130 } onChange = { this . onTimeoutChange . bind ( this ) } />
6979 < Checkbox label = "Run in parallel" checked = { this . state . isParallel } width = { 130 } onChange = { this . onIsParallelChange . bind ( this ) } />
80+ < Checkbox label = "Persist session" checked = { persistSession } disabled = { this . state . isParallel } width = { 130 } onChange = { this . onPersistSessionChange . bind ( this ) } />
81+ < div > (not recommended)</ div >
82+ { persistSession && < Markdown className = "markdown" >
83+ { "Persisting session will not reset the WebDriver session and variables between test run, which will result in [\"non-idempotent non-isolated\"](http://jasonpolites.github.io/tao-of-testing/ch4-1.1.html#rule-10-ensure-tests-are-isolated-and-idempotent) tests that are difficult to debug." }
84+ </ Markdown > }
7085 </ div >
7186 < span className = "right" >
7287 < FlatButton onClick = { this . props . cancel } > Cancel</ FlatButton >
73- < FlatButton type = "submit" onClick = { ( ) => { this . props . submit ( { timeout : parseInt ( this . state . timeout ) || DEFAULT_TIMEOUT , isParallel : this . state . isParallel } ) ; } } style = { {
88+ < FlatButton type = "submit" onClick = { ( ) => { this . props . submit ( {
89+ timeout : parseInt ( this . state . timeout ) || DEFAULT_TIMEOUT ,
90+ isParallel : this . state . isParallel ,
91+ persistSession : this . state . persistSession
92+ } ) ;
93+ } } style = { {
7494 marginRight : "0"
7595 } } > Submit</ FlatButton >
7696 </ span >
0 commit comments