diff --git a/lib/tags/requirements.js b/lib/tags/requirements.js index c28e22eb87..d406f6d7c7 100644 --- a/lib/tags/requirements.js +++ b/lib/tags/requirements.js @@ -6,22 +6,22 @@ module.exports = function yields (hexo, args) { // {% requirements dom .click %} // {% requirements dom .children %} - const type = args[0] const cmd = `${args[1]}()` const focus = `${cmd} requires the element to be able to receive focus` - const parentCmd = `${cmd} requires being chained off of cy` const childCmd = `${cmd} requires being chained off a previous command` const childCmdDom = `${cmd} requires being chained off a command that yields DOM element(s)` + const dualCmd = `${cmd} can be chained off of cy or off another command` + const parentCmd = `${cmd} requires being chained off of cy` - const parentOrChild = () => { - return (args[1] === 'cy.get' || args[1] === 'cy.focused') ? parentCmd : childCmdDom - } + const type = args[0] - const none = () => { + const blurability = () => { return `` } @@ -31,129 +31,132 @@ module.exports = function yields (hexo, args) { ` } - const dom = () => { + const clearability = () => { return `` } - const parent = () => { + const checkability = () => { return `` } - const blurability = () => { + const dom = () => { return `` } - const focusability = () => { + const dual = () => { return `` } - const clearability = () => { + const dualExistence = () => { return `` } - const checkability = () => { + const dualExistenceSingleDom = () => { return `` } - const selectability = () => { + const exec = () => { return `` } - const scrollability = () => { + const focusability = () => { return `` } - const submitability = () => { + const none = () => { return `` } - const dual = () => { + const page = () => { return `` } - const dualExistence = () => { + const parent = () => { return `` } - const dualExistenceSingleDom = () => { + const parentOrChild = () => { + return (args[1] === 'cy.get' || args[1] === 'cy.focused') ? parentCmd : childCmdDom + } + + const readFile = () => { return `` } - const spread = () => { + const request = () => { return `` } - const exec = () => { + const scrollability = () => { return `` } - const task = () => { + const selectability = () => { return `` } - const writeFile = () => { + const spread = () => { return `` } - const readFile = () => { + const submitability = () => { return `` } - const page = () => { + const task = () => { return `` } @@ -164,21 +167,29 @@ module.exports = function yields (hexo, args) { ` } - const request = () => { + const wait = () => { + return `` + } + + const writeFile = () => { return `` } switch (type) { - case 'none': - return none() - case 'parent': - return parent() + case 'blurability': + return blurability() + case 'checkability': + return checkability() case 'child': return child() + case 'clearability': + return clearability() case 'dom': return dom() case 'dual': @@ -187,36 +198,36 @@ module.exports = function yields (hexo, args) { return dualExistence() case 'dual_existence_single_dom': return dualExistenceSingleDom() - case 'clearability': - return clearability() - case 'blurability': - return blurability() + case 'exec': + return exec() case 'focusability': return focusability() - case 'checkability': - return checkability() - case 'selectability': - return selectability() + case 'none': + return none() + case 'parent': + return parent() + case 'page': + return page() + case 'read_file': + return readFile() + case 'request': + return request() case 'scrollability': return scrollability() - case 'submitability': - return submitability() + case 'selectability': + return selectability() case 'spread': return spread() - case 'exec': - return exec() + case 'submitability': + return submitability() case 'task': return task() - case 'read_file': - return readFile() - case 'write_file': - return writeFile() - case 'page': - return page() case 'tick': return tick() - case 'request': - return request() + case 'wait': + return wait() + case 'write_file': + return writeFile() default: // error when an invalid usage option was provided throw new Error(`{% requirements %} tag helper was provided an invalid option: ${type}`) diff --git a/source/api/commands/wait.md b/source/api/commands/wait.md index a4565774fe..791d008788 100644 --- a/source/api/commands/wait.md +++ b/source/api/commands/wait.md @@ -213,7 +213,7 @@ This gives you the best of both worlds - a fast error feedback loop when request ## Requirements {% helper_icon requirements %} -{% requirements parent cy.wait %} +{% requirements wait cy.wait %} ## Assertions {% helper_icon assertions %} diff --git a/source/ja/api/commands/wait.md b/source/ja/api/commands/wait.md index a4565774fe..791d008788 100644 --- a/source/ja/api/commands/wait.md +++ b/source/ja/api/commands/wait.md @@ -213,7 +213,7 @@ This gives you the best of both worlds - a fast error feedback loop when request ## Requirements {% helper_icon requirements %} -{% requirements parent cy.wait %} +{% requirements wait cy.wait %} ## Assertions {% helper_icon assertions %} diff --git a/source/zh-cn/api/commands/wait.md b/source/zh-cn/api/commands/wait.md index a4565774fe..791d008788 100644 --- a/source/zh-cn/api/commands/wait.md +++ b/source/zh-cn/api/commands/wait.md @@ -213,7 +213,7 @@ This gives you the best of both worlds - a fast error feedback loop when request ## Requirements {% helper_icon requirements %} -{% requirements parent cy.wait %} +{% requirements wait cy.wait %} ## Assertions {% helper_icon assertions %}