{"action":"created","issue":{"url":"https://api.github.com/repos/DevExpress/testcafe/issues/802","repository_url":"https://api.github.com/repos/DevExpress/testcafe","labels_url":"https://api.github.com/repos/DevExpress/testcafe/issues/802/labels{/name}","comments_url":"https://api.github.com/repos/DevExpress/testcafe/issues/802/comments","events_url":"https://api.github.com/repos/DevExpress/testcafe/issues/802/events","html_url":"https://github.com/DevExpress/testcafe/issues/802","id":176882339,"number":802,"title":"We need to figure out `test` extensions syntax","user":{"login":"inikulin","id":453071,"avatar_url":"https://avatars.githubusercontent.com/u/453071?v=3","gravatar_id":"","url":"https://api.github.com/users/inikulin","html_url":"https://github.com/inikulin","followers_url":"https://api.github.com/users/inikulin/followers","following_url":"https://api.github.com/users/inikulin/following{/other_user}","gists_url":"https://api.github.com/users/inikulin/gists{/gist_id}","starred_url":"https://api.github.com/users/inikulin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/inikulin/subscriptions","organizations_url":"https://api.github.com/users/inikulin/orgs","repos_url":"https://api.github.com/users/inikulin/repos","events_url":"https://api.github.com/users/inikulin/events{/privacy}","received_events_url":"https://api.github.com/users/inikulin/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/DevExpress/testcafe/labels/!IMPORTANT!","name":"!IMPORTANT!","color":"eb6420"},{"url":"https://api.github.com/repos/DevExpress/testcafe/labels/SYSTEM:%20API","name":"SYSTEM: API","color":"bfe5bf"},{"url":"https://api.github.com/repos/DevExpress/testcafe/labels/TYPE:%20proposal","name":"TYPE: proposal","color":"f7c6c7"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2016-09-14T11:26:53Z","updated_at":"2016-09-14T12:35:54Z","closed_at":null,"body":"Some planned features require the way to attach methods to `test`, e.g. `before` or `skip`. For `skip` many frameworks use `test` postfix:\r\n\r\n```js\r\ntest.skip('Some name', t=> {..});\r\n```\r\n\r\nThis approach is quite ergonomic since you don't need to modify test code much: just add dot and `skip`. But the problem is that our directive may have parameters, e.g. `before`. `skip` can also have parameter to specify predicate that will allow you to choose in which browsers you need to skip tests. I've tried some variations, but none of them satisfies me:\r\n\r\n**1. Move body afterwards**\r\n```js\r\ntest('Some test')\r\n   .before(async t => {...})\r\n   .skip(browserInfo => {...})\r\n   .fn(async t => {\r\n        // test code here\r\n    });\r\n```\r\n*Pros:* Looks OK, kinda...\r\n*Cons*: If you have existing test you need a lot of modifications to the existing test code. `fn` looks a little bit akward.\r\n\r\n**2. Directives afterwards**\r\n```js\r\ntest('Some test', async t => {\r\n        // test code here\r\n    })\r\n   .before(async t => {...})\r\n   .skip(browserInfo => {...});\r\n```\r\n*Pros:* Minimal modifications to the existing code to add directive\r\n*Cons:* Prerequisites of the test goes after the test.\r\n\r\n**3. Options object**\r\n```js\r\ntest('Some test', {\r\n    before: async t => {...},\r\n    skip: browserInfo => {...}\r\n}, async t => {\r\n   // test code here\r\n});\r\n```\r\n*Pros:* Minimal modifications to the existing code to add directive. Prerequisites goes before test.\r\n*Cons:* Looks a little bit weird. Inconsistent with `fixture` directive where we have chained syntax.\r\n\r\nIf you have any other ideas, please, share them.\r\n\r\n\\cc @DevExpress/testcafe "},"comment":{"url":"https://api.github.com/repos/DevExpress/testcafe/issues/comments/246998920","html_url":"https://github.com/DevExpress/testcafe/issues/802#issuecomment-246998920","issue_url":"https://api.github.com/repos/DevExpress/testcafe/issues/802","id":246998920,"user":{"login":"helen-dikareva","id":12034551,"avatar_url":"https://avatars.githubusercontent.com/u/12034551?v=3","gravatar_id":"","url":"https://api.github.com/users/helen-dikareva","html_url":"https://github.com/helen-dikareva","followers_url":"https://api.github.com/users/helen-dikareva/followers","following_url":"https://api.github.com/users/helen-dikareva/following{/other_user}","gists_url":"https://api.github.com/users/helen-dikareva/gists{/gist_id}","starred_url":"https://api.github.com/users/helen-dikareva/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/helen-dikareva/subscriptions","organizations_url":"https://api.github.com/users/helen-dikareva/orgs","repos_url":"https://api.github.com/users/helen-dikareva/repos","events_url":"https://api.github.com/users/helen-dikareva/events{/privacy}","received_events_url":"https://api.github.com/users/helen-dikareva/received_events","type":"User","site_admin":false},"created_at":"2016-09-14T12:35:54Z","updated_at":"2016-09-14T12:35:54Z","body":"can we use someting more descriptive than `fn`?\r\nlike just variant like in mocha:\r\n```\r\nit('Some test')\r\n   .before(async t => {...})\r\n   .skip(browserInfo => {...})\r\n   .test(async t => {\r\n        // test code here\r\n    });\r\n```\r\nOr may be `do` or may be smtng better."}}
{"actor":{"display_login":"helen-dikareva"}}