<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Renato Ruk on Medium]]></title>
        <description><![CDATA[Stories by Renato Ruk on Medium]]></description>
        <link>https://medium.com/@renato.ruk?source=rss-41cb702c3d58------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*C4hb4TTdmH-Fb8c1.</url>
            <title>Stories by Renato Ruk on Medium</title>
            <link>https://medium.com/@renato.ruk?source=rss-41cb702c3d58------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 11:49:59 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@renato.ruk/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How to configure Cypress for multiple testing environments]]></title>
            <link>https://medium.com/distant-horizons/how-to-configure-cypress-for-multiple-testing-environments-d8c7062cb45?source=rss-41cb702c3d58------2</link>
            <guid isPermaLink="false">https://medium.com/p/d8c7062cb45</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[testing]]></category>
            <category><![CDATA[cypress]]></category>
            <dc:creator><![CDATA[Renato Ruk]]></dc:creator>
            <pubDate>Mon, 01 Jun 2020 20:40:12 GMT</pubDate>
            <atom:updated>2020-06-02T11:24:43.520Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*UwQgsocsvyJFHh1r.jpg" /></figure><h3><a href="https://www.cypress.io/">Cypress</a> is a great tool for front-end testing. It provides features such as mocking HTTP responses, stubbing objects and methods, and simulating user interaction.</h3><p>It can be used as a fully-fledged front-end testing framework for unit, integration and e2e tests. This post assumes you are already somewhat familiar with Cypress and its methodologies, and it serves as a guide for advanced configuration which can help you structure and organize your tests. So, let’s get straight to the point.</p><p>When first <a href="https://docs.cypress.io/guides/getting-started/installing-cypress.html#Opening-Cypress">installing and running Cypress with npm or yarn</a>, it will generate some default tests and configuration for you.</p><p>At the time of writing, these files and directories are:</p><pre>// configuration<br>./cypress.json<br>// directories with respective files / tests<br>./cypress/fixtures/<br>./cypress/integration/examples/<br>./cypress/plugins/<br>./cypress/support/</pre><p>The default command for running Cypress in interactive mode is <strong>./node_modules/.bin/cypress open</strong> and it will, by default, use <strong>cypress.json</strong> as a configuration file.</p><p>An example of a configuration file:</p><pre>{ <br>  &quot;baseUrl&quot;: &quot;http://localhost:3000&quot;,<br>  &quot;integrationFolder&quot;: &quot;cypress/integration&quot;<br>}</pre><p>Cypress will also, by default, run all tests from the <strong>integration</strong> directory, supporting nested directories. We could add all our unit, integration and e2e tests to the <strong>integration</strong> directory, but we want to configure some things differently — depending on our environment. For example, we could avoid some API calls from the app by completely blocking the host from the configuration file.</p><p>Let’s say we want to mock the response for the <strong>foo</strong> resource from our API. In our Cypress test, we’ll do something like this:</p><pre>describe(&quot;foo&quot;, () =&gt; {<br>    it(&quot;should fetch and render foo&quot;, () =&gt; {<br>      cy.server();<br>      // load fixture and mock response<br>      cy.fixture(&quot;foo&quot;).then((response) =&gt; {<br>        cy.route({<br>          method: &quot;GET&quot;,<br>          // you can also setup base url in cypress config<br>          // it can be used as Cypress.env(&#39;BASE_API_URL&#39;)<br>          url: &quot;https://api.my-app.com/foo/**&quot;,<br>          response: response,<br>        });<br>     });<br>     // …rest of the test<br>}));</pre><p>By specifying the same host of our backend API in blacklistHosts, Cypress will allow creating mock responses for the blocked domain, but it will intercept and disallow any other response to that same domain. This could be a handy setup for integration testing, where you want to test a feature in a very specific scenario, mocking all the requests and data the application needs. This is a powerful configuration, but for e2e tests, we don’t want to block the real API because we need to test front-end with the real back-end services. Therefore, we need to split our configs.</p><p>We’ll first create a <strong>cypress-integration.json</strong> file and place it inside the auto-generated <strong>cypress</strong> directory. And then we specify another path for the location of the tests — for our use case, that is <strong>cypress/tests/integration</strong>. Notice the change from <strong>integration</strong> to <strong>tests</strong> naming. The naming doesn’t need to be replicated, so feel free to use directory names which suit you and your team.</p><p>Example <strong>cypress-integration.json</strong> file:</p><pre>{<br>    &quot;baseUrl&quot;: &quot;http://localhost:3000&quot;,<br>    &quot;integrationFolder&quot;: &quot;cypress/tests/integration&quot;,<br>    &quot;blacklistHosts&quot;: [&quot;api.my-app.com&quot;]<br>}</pre><p>Now, to run only those tests suites for integration tests, we need to add commands in our <strong>package.json</strong>. <strong>“cypress:open:integration”</strong> is for the “interactive” mode, and <strong>cypress:run:integration</strong> is for running in “CI” mode.</p><pre>{<br> &quot;scripts&quot;: {<br>   &quot;cypress:open:integration&quot;: &quot;cypress open --config-file cypress/cypress-integration.json&quot;,<br>   &quot;cypress:run:integration&quot;: &quot;cypress run --config-file cypress/cypress-integration.json&quot;<br> }<br>}</pre><p>Now, you can repeat this process for other environments, such as e2e, storybook or unit tests, and provide different configurations for them. That’s it, thank you for reading!</p><p>_____<br><strong>We’re available for partnerships and open for new projects. <br></strong><a href="https://www.bornfight.com/contact/"><strong>If you have an idea you’d like to discuss, share it with our team!</strong></a></p><p><em>Originally published at </em><a href="https://www.bornfight.com/blog/how-to-configure-cypress-for-multiple-testing-environments/"><em>https://www.bornfight.com</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d8c7062cb45" width="1" height="1" alt=""><hr><p><a href="https://medium.com/distant-horizons/how-to-configure-cypress-for-multiple-testing-environments-d8c7062cb45">How to configure Cypress for multiple testing environments</a> was originally published in <a href="https://medium.com/distant-horizons">Distant Horizons</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Developing interactive HTML5-based games with Kinect]]></title>
            <link>https://medium.com/distant-horizons/developing-interactive-html5-based-games-with-kinect-7d9e25c2d0a4?source=rss-41cb702c3d58------2</link>
            <guid isPermaLink="false">https://medium.com/p/7d9e25c2d0a4</guid>
            <category><![CDATA[games]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[kinect]]></category>
            <category><![CDATA[html5]]></category>
            <dc:creator><![CDATA[Renato Ruk]]></dc:creator>
            <pubDate>Fri, 20 Dec 2019 13:38:29 GMT</pubDate>
            <atom:updated>2019-12-20T15:13:06.408Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BJBlb-U6oTiBwokB2yu9iw.jpeg" /></figure><h3>Video gaming currently exists on many platforms and in many forms. Consoles, PCs, handhelds, and mobiles. But video games, other than casual, competitive or similar, can also be educational.</h3><p>The project we worked on for the <a href="https://ascc.bornfight.com/">Sheikh Abdullah Al Salem Cultural Centre</a>, one of the largest museum complexes in the world, included developing games that accompanied the physical exhibits with interesting content and material for learning about the exhibited subject. Because our goal was to make the viewer interested in the content, we needed to present it in a fun and interactive way. Most of the games were created for <a href="https://www.bornfight.com/blog/designing-for-large-touchscreens/">big touchscreens</a> and supported multiplayer, with gameplay based on the number of players. But three specific games had the requirement to be developed for Microsoft Kinect, so we needed to adapt our mindset and perspective (literally) as all of the three Kinect games were set up with the sensor facing the floor.</p><h4>Vertical placement of Kinect</h4><p>The standard and the only officially supported way of placing the Kinect sensor is on a flat surface, additionally with a slight offset on each axis, but preferably as flat as possible. If the sensor is placed other than this, the official detection API will not work. As we had the <a href="https://www.bornfight.com/blog/interactive-installations-benefits-and-challenges-of-using-kinect/">Kinect placed vertically</a>, we needed to implement our own algorithms for tracking hands, feet and people in general. To access the data from Kinect, we somehow needed to connect to the data the sensor was generating. Fortunately, there is an open source Node.js library called kinect2 that enables just that. Since the official algorithms inside the SDK don’t support tracking in a vertical position, we only used raw depth and color frames from the kinect2 library.</p><h4>Development setup</h4><p>The implementation we developed for tracking was mainly written in JavaScript, and some of it in TypeScript. There were subtle differences in implementation for each of the three apps, but during the development, all of them shared the same concept for transferring the tracking data to the front-end application. As the official Kinect SDK only works on Windows, we had to use a Windows PC with Kinect Studio to record samples.</p><p>Kinect Studio has a built-in functionality that enables the playback of the recorded data, which greatly improves the development experience as the recording could be played in a loop. The streamed data from Kinect is then processed with our tracking software and transferred via web sockets to the client app alongside the necessary information for rendering the particular object in the scene.</p><h4>A journey to performance</h4><p>The UI aspect of these applications was built with HTML5 technologies. For each of the three apps, we chose frameworks that best suited the game’s requirements.</p><p>One of the most challenging applications was the one that was visually the simplest — interactive forest floor projection. The whole gameplay was based on user interaction and we knew that we needed to make the physics as real as possible, otherwise the app would feel unconvincing. The forest contained three surfaces — ground with leaves, snow and a pond. Each section looked and behaved differently, so we applied various principles to their development.</p><p>To create the leaf particles and the water surface, we used Three.js — a JavaScript 3D library that offers great API with various examples that serve as a great starting point. As Three.js is a WebGL library, it could potentially use a lot of computer resources, so we strongly focused on rendering performance. The leaf scene did not contain a gigantic number of particles, but the ones that were rendered were visually complex and needed to be movable by the action of the players. Since the rendering itself, without the movement, already affected the performance, we knew we needed to be cautious when it came time to implement the physics. We did not use a physics engine, but developed our own algorithms for the particle movement that fit better into the art direction we were going for.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*-I85WM2WvtfEKFhf" /></figure><h4>Presenting the movement</h4><p>The exhibit needed to support multiple people simultaneously, therefore we needed to optimize the amount of data we send from the Kinect to the UI, as the streams that the sensor’s SDK creates are huge. Our Kinect detection algorithm triggered a movement event too frequently and we needed to throttle the number of bytes we transfer. The solution we introduced included processing the data and transferring it to the UI in an interval that did not create a delay for the user, but created a lot of headroom in the system for other calculations. As the number of movement events needed to be reduced, we also discovered that we needed to predict the user behavior and movement, so the change in the position on the screen wouldn’t be too linear and sharp — tracking the state of the positions of steps the user made and combining them with a transition resulted in a more realistic experience.</p><h4>HTML as a 2D surface</h4><p>Based on the requirements of the other Kinect applications that we needed to develop, we realized that we don’t need 3D rendering. The design and the general look and feel could be represented with animations, shadows, different backgrounds and similar tricks inside a two-dimensional space, thus mimicking a three-dimensional one while still maintaining the visual identity. The design was crafted in such a way that the optimal way to create game components was to use regular HTML elements and code them as if they represent a 2D model on a canvas.</p><p>Furthermore, those components needed to represent a model in space, and our goal was to enable the user to interact with them by hovering, dragging and grabbing under a certain area. To give those elements mass and a touch of gravity, we reached for a popular JavaScript 2D physics engine. The engine enabled us to give physical attributes to HTML elements, and treat them as if they were entities inside a game engine. By combining events from user gestures captured with Kinect, we established a very natural experience for the player that felt intuitive and fun.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Clujl6M7yeVnSEqd" /></figure><h4>Wrapping up</h4><p>Programming applications with Kinect can be a very refreshing experience for a developer, as it really encourages innovation and makes you rethink the way we interact with user interfaces.</p><p>By combining creative programming with data such as positions of hands or feet, you can build applications that conceptually look futuristic, but at the same time give the user a very familiar feeling. Although the Kinect sensor is not officially supported by Microsoft anymore, it can still be used as a robust sensor for fetching the depth data from the 3D world. With adequate open-source libraries, the development of Kinect based applications can actually be a very entertaining process.</p><p>__________<br> We’re available for partnerships and open for new projects. <a href="https://www.bornfight.com/contact/">If you have an idea you’d like to discuss, share it with our team!</a></p><p><em>Originally published at </em><a href="https://www.bornfight.com/blog/developing-interactive-html5-based-games-with-kinect/"><em>https://www.bornfight.com</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7d9e25c2d0a4" width="1" height="1" alt=""><hr><p><a href="https://medium.com/distant-horizons/developing-interactive-html5-based-games-with-kinect-7d9e25c2d0a4">Developing interactive HTML5-based games with Kinect</a> was originally published in <a href="https://medium.com/distant-horizons">Distant Horizons</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>