Skip to content

Instantly share code, notes, and snippets.

@charlie632
Created November 24, 2020 19:59
Show Gist options
  • Save charlie632/3b0e7ac79dcbc7bb123f485552cd73b4 to your computer and use it in GitHub Desktop.
Save charlie632/3b0e7ac79dcbc7bb123f485552cd73b4 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
// - XState (all XState exports)
const fetchMachine = Machine({
id: 'fetch',
initial: 'idle',
context: {
retries: 0
},
states: {
idle: {
on: {
START: 'login'
}
},
login: {
on: {
SUCCESS: 'goToPageSettings'
}
},
goToPageSettings: {
on: {
SUCCESS: 'findIframe'
}
},
findIframe: {
on:{
SUCCESS: 'findNewRoleContainer'
}
},
findNewRoleContainer: {
on: {
SUCCESS: 'findAndTypeEmail'
}
},
findAndTypeEmail: {
on: {
SUCCESS: 'pressDownAndEnter'
}
},
pressDownAndEnter: {
on: {
SUCCESS: 'validateInputValue'
}
},
validateInputValue: {
on: {
SUCCESS: 'clickOnRoleDropdown'
}
},
clickOnRoleDropdown: {
on: {
SUCCESS: 'findAndClickRoleNode'
}
},
findAndClickRoleNode: {
on: {
SUCCESS: 'verifyFieldsAndScreenshot'
}
},
verifyFieldsAndScreenshot: {
on: {
SUCCESS: 'clickSubmit',
}
},
clickSubmit: {
on: {
SUCCESS: 'assertPasswordModal'
}
},
assertPasswordModal: {
on: {
FOUND: 'findAndFillPassword',
NOT_FOUND: 'validateRoleInContainer'
}
},
findAndFillPassword: {
on: {
SUCCESS: 'validateRoleInContainer'
}
},
validateRoleInContainer: {
on: {
SUCCESS: 'end'
}
},
end: {
type: 'final'
},
error: {
type: 'final'
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment