{"id":516,"date":"2018-10-07T20:41:56","date_gmt":"2018-10-07T20:41:56","guid":{"rendered":"https:\/\/thinkcolorful.org\/?p=516"},"modified":"2024-12-13T19:52:58","modified_gmt":"2024-12-13T19:52:58","slug":"outreachy-internship-application-process-part-3-welcome-test","status":"publish","type":"post","link":"https:\/\/thinkcolorful.org\/?p=516","title":{"rendered":"Outreachy Internship Application Process: Part 3 Welcome Test"},"content":{"rendered":"<p>I set out to write a test to check for the &#8216;Welcome&#8217; message in the notifications via the Echo extension. I&#8217;m sure this will take a few drafts but here is the first attempt at writing this up. I&#8217;ve made some assumptions and simplifications so that I could get something out quicker. This first draft uses an existing new user and checks that the element &#8220;.mw-echo-ui-notificationItemWidget-content-message-header&#8221; is present. This element is what contains the &#8216;Welcome&#8217; message. Test passes.<!--more--><\/p>\n<p>echo.page.js file:<\/p>\n<pre>'use strict';\nconst Page = require( 'wdio-mediawiki\/Page' );\n\nclass EchoPage extends Page {\n\n\tget alerts() { return browser.element( '#pt-notifications-alert' ); }\n\tget notices() { return browser.element( '#pt-notifications-notice' ); }\n        get welcomenotice() { return browser.element('.mw-echo-ui-notificationItemWidget-content-message-header'); }\n    \n\n}\nmodule.exports = new EchoPage();\n<\/pre>\n<p>notification_welcome.js<\/p>\n<pre>'use strict';\n\nvar assert = require ('assert'),\n\tEchoPage = require ( '..\/pageobjects\/echo.page' ),\n\tUserLoginPage = require( 'wdio-mediawiki\/LoginPage' );\n\ndescribe ( 'Echo', function() {\n\t\n\tit ( 'check for welcome message after signin', function() {\n\n        UserLoginPage.login( browser.options.username, browser.options.password );\n\tUserLoginPage.open();\n        EchoPage.notices.click();\n        browser.pause(5000);\n        assert( EchoPage.welcomenotice.isExisting() );\n        \n\n\t} );\n\n} );\n\n<\/pre>\n<p>Download the files here: <a href=\"https:\/\/thinkcolorful.org\/wp-content\/uploads\/2018\/10\/echo.page_.js\">echo.page.js<\/a> ,<a href=\"https:\/\/thinkcolorful.org\/wp-content\/uploads\/2018\/10\/notification_welcome.js\">notification_welcome.js<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I set out to write a test to check for the &#8216;Welcome&#8217; message in the notifications via the Echo&#46;&#46;&#46;<\/p>\n","protected":false},"author":2,"featured_media":1334,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[213],"tags":[],"class_list":["post-516","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-outreachy"],"_links":{"self":[{"href":"https:\/\/thinkcolorful.org\/index.php?rest_route=\/wp\/v2\/posts\/516","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=516"}],"version-history":[{"count":6,"href":"https:\/\/thinkcolorful.org\/index.php?rest_route=\/wp\/v2\/posts\/516\/revisions"}],"predecessor-version":[{"id":1088,"href":"https:\/\/thinkcolorful.org\/index.php?rest_route=\/wp\/v2\/posts\/516\/revisions\/1088"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/thinkcolorful.org\/index.php?rest_route=\/wp\/v2\/media\/1334"}],"wp:attachment":[{"href":"https:\/\/thinkcolorful.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=516"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/thinkcolorful.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=516"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/thinkcolorful.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=516"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}