@revoloo/cypress6
Version:
Cypress.io end to end testing tool
56 lines (43 loc) • 1.47 kB
JavaScript
import { action, computed, observable } from 'mobx'
import localData from '../lib/local-data'
import updateStore from '../update/update-store'
class AppStore {
cypressEnv
os
projectRoot = null
localInstallNoticeDismissed = localData.get('local-install-notice-dimissed')
error
proxyServer
proxyBypassList
proxySource
constructor () {
if (window.Cypress) {
window.AppStore = this // for testing
}
}
get displayVersion () {
return this.isDev ? `${updateStore.version} (dev)` : updateStore.version
}
get isDev () {
return this.cypressEnv === 'development'
}
get isGlobalMode () {
return !this.projectRoot
}
set (props) {
if (props.cypressEnv != null) this.cypressEnv = props.cypressEnv
if (props.os != null) this.os = props.os
if (props.projectRoot != null) this.projectRoot = props.projectRoot
this.proxyServer = props.proxyServer || this.proxyServer
this.proxyBypassList = props.proxyBypassList || this.proxyBypassList
this.proxySource = props.proxySource || this.proxySource
}
setLocalInstallNoticeDismissed (isDismissed) {
this.localInstallNoticeDismissed = isDismissed
localData.set('local-install-notice-dimissed', isDismissed)
}
setError (err) {
this.error = err
}
}
export default new AppStore()