<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Michael Yagudaev</title>
    <description>The latest articles on DEV Community by Michael Yagudaev (@yagudaev).</description>
    <link>https://dev.to/yagudaev</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F190004%2F0b823bf3-cd09-41c2-a483-1d589484397a.jpeg</url>
      <title>DEV Community: Michael Yagudaev</title>
      <link>https://dev.to/yagudaev</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/yagudaev"/>
    <language>en</language>
    <item>
      <title>How to Test On Mobile Devices - The Easy Way</title>
      <dc:creator>Michael Yagudaev</dc:creator>
      <pubDate>Wed, 19 May 2021 15:36:13 +0000</pubDate>
      <link>https://dev.to/yagudaev/how-to-test-on-mobile-devices-the-easy-way-3ana</link>
      <guid>https://dev.to/yagudaev/how-to-test-on-mobile-devices-the-easy-way-3ana</guid>
      <description>&lt;p&gt;If you ever worked with React Native’s Expo, you know what a great mobile development experience feels like. But what about Mobile Web? Is there anything more annoying than trying to find your IP or creating an SSH tunnel with ngrok just to load a website on your phone?!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--m8zUrQgW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8nydbsq9ascbllnrvd7p.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--m8zUrQgW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8nydbsq9ascbllnrvd7p.png" alt="Expo developer tools lets you scan a QR and see device logs in one place" title="Expo developer tools lets you scan a QR and see device logs in one place"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Expo developer tools lets you scan a QR and see device logs in one place.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Luckily, there are a few quick features we can use to make our development experience on mobile web just as fun as using Expo (thanks expo crew for pushing on DX front 😍).&lt;/p&gt;

&lt;p&gt;While you can easily test on your desktop with &lt;code&gt;locahost:3000&lt;/code&gt; and have great tools like &lt;a href="https://www.lambdatest.com/"&gt;LambdaTest&lt;/a&gt; for side-by-side device testing, to get a true feel you need a physical device. There is something magical about touching your design for the first time and testing gestures becomes easier as well.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--wPu-ySpp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xlwkgfakcxkvk5wo59q4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--wPu-ySpp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xlwkgfakcxkvk5wo59q4.png" alt="LT Browser testing side by side virtual devices"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;LT Browser testing side by side virtual devices&lt;/em&gt;&lt;/p&gt;
&lt;h1&gt;
  
  
  QR Codes to the rescue!
&lt;/h1&gt;

&lt;p&gt;Chrome can help us with a new QR code feature. Follow these steps:&lt;/p&gt;

&lt;p&gt;1. Find your local network IP address&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;ipconfig getifaddr en0
&lt;span class="c"&gt;# 192.168.1.140&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;2. Start your server binding to the local ip&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Next.js / Node.js Express&lt;/span&gt;
yarn dev &lt;span class="nt"&gt;-H&lt;/span&gt; 192.168.1.140

&lt;span class="c"&gt;# Rails&lt;/span&gt;
rails s &lt;span class="nt"&gt;-b&lt;/span&gt; 192.168.1.140
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;3. Open chrome and go to the above address adding your port (e.g. &lt;a href="http://192.168.1.140:3000"&gt;http://192.168.1.140:3000&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;4. Right-click on the page and &lt;code&gt;Create QR code for this Page&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--n-x43lAP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7g4oxzhnr8m6qybjl6v6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--n-x43lAP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7g4oxzhnr8m6qybjl6v6.png" alt="Chrome context menu" title="Chrome context menu"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Chrome context menu&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;5. Scan with your phone or tablet. Enjoy!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ZjgPWSrS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/721s0aye47cl4roc9r0a.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ZjgPWSrS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/721s0aye47cl4roc9r0a.png" alt="Chrome QR code" title="Chrome QR code"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Chrome QR code&lt;/em&gt;&lt;/p&gt;
&lt;h1&gt;
  
  
  Bonus points!
&lt;/h1&gt;

&lt;p&gt;Instead of using chrome’s QR code generation, we can use the terminal. You guessed it, there is an NPM package for that!&lt;/p&gt;

&lt;p&gt;1. Install the package&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;yarn global add qrcode-terminal
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;2. Generate QR Code&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;qrcode-terminal &lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;printf&lt;/span&gt; &lt;span class="s1"&gt;'http://%s\n'&lt;/span&gt; &lt;span class="si"&gt;$(&lt;/span&gt;ipconfig getifaddr en0 | &lt;span class="nb"&gt;tr&lt;/span&gt; &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="s1"&gt;'\n'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nb"&gt;echo&lt;/span&gt; :3000 &lt;span class="si"&gt;))&lt;/span&gt;  &lt;span class="se"&gt;\&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--lOaTWqIO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xpmj2h7q8s5j4876iksr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--lOaTWqIO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xpmj2h7q8s5j4876iksr.png" alt="QRCode in the terminal" title="QRCode in the terminal"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;QRCode in the terminal&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;3. Scan with your phone / tablet. Enjoy!&lt;/p&gt;

&lt;p&gt;(Yes, you can print QR codes in the terminal! It blew my mind too! 🤯 )&lt;/p&gt;
&lt;h2&gt;
  
  
  P.S.
&lt;/h2&gt;

&lt;p&gt;Try creating an alias for your shell (ZSH/Bash/etc)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# ~/.zshrc&lt;/span&gt;
&lt;span class="c"&gt;# …&lt;/span&gt;

&lt;span class="nb"&gt;alias &lt;/span&gt;ip-lan&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"ipconfig getifaddr en0"&lt;/span&gt;
&lt;span class="nb"&gt;alias &lt;/span&gt;qrcode-lan&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"qrcode-terminal &lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;printf&lt;/span&gt; &lt;span class="s1"&gt;'http://%s\n'&lt;/span&gt; &lt;span class="si"&gt;$(&lt;/span&gt;ip-lan | &lt;span class="nb"&gt;tr&lt;/span&gt; &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="s1"&gt;'\n'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nb"&gt;echo&lt;/span&gt; :3000 &lt;span class="si"&gt;))&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--1iAw73ut--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0dmrara10cs6wvfp3ked.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--1iAw73ut--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0dmrara10cs6wvfp3ked.png" alt="e.g of using aliases to generate the IP and QR Code" title="e.g of using aliases to generate the IP and QR Code"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Example of using aliases to generate the IP and QR code&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;--&lt;/p&gt;

&lt;p&gt;Originally published at &lt;a href="https://yagudaev.com/posts/testing-on-mobile-devices-the-easy-way"&gt;yagudaev.com&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>mobile</category>
      <category>testing</category>
      <category>tooling</category>
    </item>
  </channel>
</rss>
