Created
May 13, 2020 16:23
-
-
Save vojtech-cerveny/7b17fdcb7d9ae1a474d04b53db4951c2 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const feedbackMachine = Machine({ | |
id: 'comment', | |
initial: 'comment_tab_closed', | |
//context: { wasClosed: false }, | |
states: { | |
comment_tab_closed: { | |
on: { | |
OPEN_COMMENTS: 'comment_tab_opened', | |
}, | |
meta: { | |
test: async (browser) => { | |
await browser.$('.CommentsPanel_commentsPanel__2Rb51'); | |
}, | |
}, | |
}, | |
comment_tab_opened: { | |
on: { | |
SUBMIT_COMMENT: 'comment_added', | |
HIDE_COMMENTS: 'comment_tab_closed', | |
}, | |
meta: { | |
test: async (browser) => { | |
const panel = await browser.$('.CommentsPanel_commentsPanel__2Rb51'); | |
expect(await panel.isDisplayed()).to.be.true; | |
}, | |
}, | |
}, | |
comment_added: { | |
on: { | |
HIDE_COMMENTS: 'comment_tab_closed', | |
EDIT_COMMENT: 'comment_editing', | |
DELETE_COMMENT: 'deleted_comment', | |
}, | |
meta: { | |
test: async (browser) => { | |
await browser.pause(500); | |
const comments = await browser.$$('div[data-qa-id="mailup-bee-commenting.commentText"]'); | |
const lastComment = await comments[comments.length - 1]; | |
expect(await lastComment.getText()).to.be.eqls(vars.actual_comment); | |
}, | |
}, | |
}, | |
comment_editing: { | |
on: { | |
HIDE_COMMENTS: 'comment_tab_closed', | |
SAVE_EDIT: 'comment_save_edit', | |
DISCARD_EDIT: 'comment_discard_edit' | |
}, | |
meta: { | |
test: async (browser) => { | |
const textarea = await browser.$('textarea[data-qa-id="mailup-bee-commenting.textareaEditingComment"]'); | |
expect(await textarea.isDisplayed()).to.be.true; | |
expect(await textarea.getValue()).to.be.eqls(`${vars.actual_comment}`); | |
} | |
} | |
}, | |
comment_save_edit: { | |
on: { | |
SUBMIT_COMMENT: 'comment_added', | |
HIDE_COMMENTS: 'comment_tab_closed', | |
EDIT_COMMENT: 'comment_editing', | |
DELETE_COMMENT: 'deleted_comment', | |
}, | |
meta: { | |
test: async (browser) => { | |
await browser.pause(500); | |
const comments = await browser.$$('div[data-qa-id="mailup-bee-commenting.commentText"]'); | |
const lastComment = await comments[comments.length - 1]; | |
expect(await lastComment.getText()).to.be.eqls(vars.actual_comment); | |
} | |
}, | |
//exit: assign({ wasClosed: true }), | |
}, | |
comment_discard_edit: { | |
on: { | |
SUBMIT_COMMENT: 'comment_added', | |
HIDE_COMMENTS: 'comment_tab_closed', | |
EDIT_COMMENT: 'comment_editing', | |
}, | |
meta: { | |
test: async (browser) => { | |
await browser.pause(500); | |
const comments = await browser.$$('div[data-qa-id="mailup-bee-commenting.commentText"]'); | |
const lastComment = await comments[comments.length - 1]; | |
expect(await lastComment.getText()).to.be.eqls(vars.actual_comment); | |
} | |
}, | |
//exit: assign({ wasClosed: true }), | |
}, | |
deleted_comment: { | |
on: { | |
}, | |
meta: { | |
test: async (browser) => { | |
await browser.pause(500); | |
const comments = await browser.$$('div[data-qa-id="mailup-bee-commenting.commentText"]'); | |
const lastComment = await comments[comments.length - 1]; | |
expect(await lastComment.getText()).to.be.eqls(vars.actual_comment); | |
} | |
}, | |
}, | |
// comment_resolved: {}, | |
// comment_reopen: {}, | |
// thread_opened: {}, | |
// thread_added_comment: {}, | |
// thread_comment_editing: {}, | |
// thread_comment_save_edit: {}, | |
// thread_comment_discard_edit: {}, | |
// thread_comment_deleted: {}, | |
// thread_resolved: {}, | |
// thread_reopen: {}, | |
// showing_only_unresolved_threads: {}, | |
// showing_all_threads: {}, | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment