{"id":723,"date":"2019-05-01T03:08:15","date_gmt":"2019-05-01T03:08:15","guid":{"rendered":"https:\/\/thinkcolorful.org\/?p=723"},"modified":"2020-11-21T15:42:49","modified_gmt":"2020-11-21T15:42:49","slug":"mediawiki-extentions-echo-mention-test","status":"publish","type":"post","link":"https:\/\/thinkcolorful.org\/?p=723","title":{"rendered":"Mediawiki Extentions: Echo Mention Test"},"content":{"rendered":"\n<p>I wanted to create a test beyond the smoke test (echo.js) I had made for the Echo. I thought something interesting to test would be the mentioning system and the alerts that are triggered when a user mentions another user. <\/p>\n\n\n\n<!--more-->\n\n\n\n<p>Some insights I learned about writing a good test are that the code should reflect the cucumber format. So in this instance:<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>Given there is a new user who mentions the admin user on their page and the admin user logs in.<\/p><p>When the alert is clicked<\/p><p>Then the alert message notifying that the admin was mentioned is visible<\/p><\/blockquote>\n\n\n\n<p>And the <a href=\"https:\/\/gerrit.wikimedia.org\/r\/#\/c\/mediawiki\/extensions\/Echo\/+\/507536\/\">mention test<\/a> I wrote reflects this structure in terms of spacing\/blocks.<\/p>\n\n\n\n<p><pre>\tit( 'checks if admin gets alert when mentioned', function () {\n\n\t\tvar username = Util.getTestString( 'NewUser-' );\n\t\tvar password = Util.getTestString();\n\t\tbrowser.call( function () {\n\t\t\treturn Api.createAccount( username, password\n\t\t\t).then( function () {\n\t\t\t\treturn Api.edit( `User:${username}`, `Hello [[User:${browser.options.username}]] ~~~~`, username, password );\n\t\t\t} );\n\t\t} );\n\t\tUserLoginPage.login( browser.options.username, browser.options.password );\n\n\t\tEchoPage.alerts.click();\n\n\t\tEchoPage.alertMessage.waitForVisible();\n\t\tlet regexp = \/\u202a.*\u202c mentioned you on \u202aUser:.*.\/;\n\t\tassert( regexp.test( EchoPage.alertMessage.getText() ) );\n\t} );\n<\/pre><\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I wanted to create a test beyond the smoke test (echo.js) I had made for the Echo. I thought&#46;&#46;&#46;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[214,10,216],"tags":[],"class_list":["post-723","post","type-post","status-publish","format-standard","hentry","category-javascript","category-programming","category-qa"],"_links":{"self":[{"href":"https:\/\/thinkcolorful.org\/index.php?rest_route=\/wp\/v2\/posts\/723","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/thinkcolorful.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/thinkcolorful.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/thinkcolorful.org\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/thinkcolorful.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=723"}],"version-history":[{"count":4,"href":"https:\/\/thinkcolorful.org\/index.php?rest_route=\/wp\/v2\/posts\/723\/revisions"}],"predecessor-version":[{"id":1078,"href":"https:\/\/thinkcolorful.org\/index.php?rest_route=\/wp\/v2\/posts\/723\/revisions\/1078"}],"wp:attachment":[{"href":"https:\/\/thinkcolorful.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=723"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/thinkcolorful.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=723"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/thinkcolorful.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=723"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}