<?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 PLa Tanate on Medium]]></title>
        <description><![CDATA[Stories by PLa Tanate on Medium]]></description>
        <link>https://medium.com/@iPiranhaa?source=rss-4d639d5b7bfa------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*7UPdlYPXN7juJFGH6IKQLA.jpeg</url>
            <title>Stories by PLa Tanate on Medium</title>
            <link>https://medium.com/@iPiranhaa?source=rss-4d639d5b7bfa------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 28 May 2026 00:14:38 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@iPiranhaa/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 intercept GraphQL requests with Playwright]]></title>
            <link>https://medium.com/@iPiranhaa/how-to-intercept-graphql-requests-with-playwright-7ddaec3d9f9f?source=rss-4d639d5b7bfa------2</link>
            <guid isPermaLink="false">https://medium.com/p/7ddaec3d9f9f</guid>
            <category><![CDATA[testing]]></category>
            <category><![CDATA[cypress]]></category>
            <category><![CDATA[graphql]]></category>
            <category><![CDATA[playwrights]]></category>
            <category><![CDATA[front-end-development]]></category>
            <dc:creator><![CDATA[PLa Tanate]]></dc:creator>
            <pubDate>Mon, 30 May 2022 11:53:32 GMT</pubDate>
            <atom:updated>2022-05-30T11:53:32.231Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DeVn_Ymv9F0f7LBMV1OhVA.png" /></figure><p>If you want to do integration testing for the frontend application with <a href="https://playwright.dev/">Playwright</a>, any simple requests work perfectly by class <a href="https://playwright.dev/docs/api/class-route">Route</a> but every GraphQL requests is not easy to do like that because every requests send to a single path.</p><p>Absolutely, How to mock a single GraphQL path with many responses? That is the problem.</p><h4>Let’s get started!</h4><p>As you can see the GraphQL request use POST method on HTTP request with many payloads.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2PtCrWHyesdayscvMAyxUg.png" /></figure><p>You can clarify 2 types of method below<br>1. query used for getting some data.<br>2. mutation using to mutate data on backend side.</p><p>The key is a operation name after GraphQL methods above. You need to declare every single request first before go the next steps.</p><h4>Solution</h4><p>In case, You need to intercept any POST method with specific path for GraphQL requests.</p><p>First, create functions to verify which are query or mutation with the request name.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XASSinUBmNSbuDXUnAroOg.png" /></figure><p>Second, when a request name match, return a mock response instead of bypass the request to backend side.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*05qri9IqJI7fpsuWfSJB5Q.png" /></figure><p>Last, you can make a function for a request interception like this<br>image</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PhRffUSEGxyPtVpWFtko6Q.png" /></figure><p>And then you have it!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5XyJkIR6OsLm2mD-FUwFPg.png" /></figure><p>IMO, this solution worked but was not perfect. If you guys have any solutions, please advise me :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7ddaec3d9f9f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[วิธีทำให้ไลน์แจ้งเตือนเวลา BTS เสียที่ใครๆก็ทำได้]]></title>
            <link>https://medium.com/@iPiranhaa/%E0%B8%A7%E0%B8%B4%E0%B8%98%E0%B8%B5%E0%B8%97%E0%B8%B3%E0%B9%83%E0%B8%AB%E0%B9%89%E0%B9%84%E0%B8%A5%E0%B8%99%E0%B9%8C%E0%B9%81%E0%B8%88%E0%B9%89%E0%B8%87%E0%B9%80%E0%B8%95%E0%B8%B7%E0%B8%AD%E0%B8%99%E0%B9%80%E0%B8%A7%E0%B8%A5%E0%B8%B2-bts-%E0%B9%80%E0%B8%AA%E0%B8%B5%E0%B8%A2%E0%B8%97%E0%B8%B5%E0%B9%88%E0%B9%83%E0%B8%84%E0%B8%A3%E0%B9%86%E0%B8%81%E0%B9%87%E0%B8%97%E0%B8%B3%E0%B9%84%E0%B8%94%E0%B9%89-ddc5fe270a29?source=rss-4d639d5b7bfa------2</link>
            <guid isPermaLink="false">https://medium.com/p/ddc5fe270a29</guid>
            <dc:creator><![CDATA[PLa Tanate]]></dc:creator>
            <pubDate>Tue, 26 Jun 2018 15:32:39 GMT</pubDate>
            <atom:updated>2018-06-26T15:37:56.793Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*DDhZL6oL5MmBia1-" /><figcaption>“People waiting on a railway station with a blue train leaving the neighbouring platform” by <a href="https://unsplash.com/@callumchapman?utm_source=medium&amp;utm_medium=referral">Callum Chapman</a> on <a href="https://unsplash.com?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>จะว่าไปช่วงนี้ชาวกรุงฯอย่างเราประสบปัญหา BTS เสียกันถ้วนหน้า ทำให้หลายคนต้องไปทำงานสายทั้งๆที่เดินทางออกจากบ้านกันเวลาเดิม <br>แน่นอนครับ ผมก็เป็นหนึ่งในผู้ประสบปัญหานี้เหมือนกับคุณนั่นแหละ :(</p><p>อันที่จริงก็มีหลายวิธีด้วยกันที่ทำให้เราสามารถรับรู้สถานการณ์ของ BTS ณ ตอนนั้นเช่น</p><ol><li>เปิด Twitter ของ <a href="https://twitter.com/bts_skytrain">BTS_SkyTrain</a></li><li>ฟัง จส. 100 เอา</li></ol><p>จากตัวอย่างด้านบน เห็นไหมว่าเราต้องเป็นคนไปหาข้อมูลมาเอง ซึ่งมันก็หลายขั้นตอนอยู่ <br>จะดีแค่ไหนกันถ้าคุณสามารถรับรู้ถึงสถานการณ์ของ<strong>ไอ้หนูด่วน</strong>ได้จากไลน์ของคุณเองหละ</p><p>ในตัวอย่างนี้ผมเลือกที่จะนำ Tweet ของ BTS มาเป็นข้อความสำหรับแจ้งในไลน์ เพราะจากที่ดูแล้ว Account นี้ส่วนใหญ่เค้าก็ Tweet แต่เรื่องปัญหารถเสียนี่แหละ</p><h3>สิ่งที่ต้องเตรียม</h3><ol><li>พระเอกของเราในบทความนี้ นั่นคือเจ้า <a href="https://ifttt.com/">IFTTT</a> จะใช้งานบนคอมพิวเตอร์ หรือโหลดแอปฯมาก็ตามสะดวกครับ Sign up/Sign in กันให้เรียบร้อย</li><li>Twitter account</li><li>Line account ที่ Add Line Notify Bot แล้ว ซึ่งเราสามารถทำได้ง่ายๆแค่เพิ่มเค้าเป็นเพื่อนเหมือนคนอื่นๆ ดูรายละเอียดได้ทางนี้เลยครับ <a href="https://notify-bot.line.me/th/">Line Notify Bot</a></li></ol><h3>ลงมือ!</h3><blockquote>บทความนี้ขอยกตัวอย่างการใช้งาน IFTTT บน iOS แบบคร่าวๆ <br>ซึ่งมีการข้ามขั้นตอนการ Sign in IFTTT, Twitter และ Line account เพื่อความสะดวกครับ</blockquote><ol><li>เปิดเจ้าแอปฯ IFTTT ขึ้นมา เลือกเมนู <strong>My Applets</strong> จากนั้นกดปุ่ม <strong>+</strong> ด้านบนขวา</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/397/1*Vb2gDX66gKQYiEW-Z7j0Qg.jpeg" /></figure><p>2. จิ้มไปที่ <strong>this</strong> ตัวสีฟ้า</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/397/1*1J_LDId0jMgmUrAsUPyEyQ.jpeg" /></figure><p>3. Search หา Twitter service ด้วยคำว่า <strong>Twitter </strong>จิ้มที่ Twitter service จากนั้นเลื่อนหา <strong>New tweet by a specific user </strong>แล้วก็จิ้มอีกที</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/397/1*UWvewq-4iWFSJ95oslX3zw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/397/1*qg321i08-0h2jjUp3yENNw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/397/1*3vSX8VmXLML_k12RgJL1-g.jpeg" /></figure><p>4. ที่ช่อง Username to watch กรอก account ชื่อ <strong>BTS_SkyTrain</strong> จากนั้นกดปุ่ม Create trigger เป็นอันเสร็จขั้นตอนฝั่ง Twitter</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/397/1*Amhod3exng4mIbY_gqJARQ.jpeg" /></figure><p>จะเห็นว่าจาก <strong>this</strong> ในขั้นตอนที่ 2. เปลี่ยนเป็นโลโก้ Twitter แล้ว<br>ในขั้นตอนต่อไปให้เราเลือก <strong>that</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/397/1*127B6W6sR4vm0bPqL_oDAg.jpeg" /></figure><p>5. Search Line service ด้วยคำว่า <strong>Line </strong>จากนั้นจิ้มไปที่<strong> </strong>Line service จะเห็นได้ว่ามีเมนูให้เลือกอันเดียว ก็เลือกอันนี้แหละ</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/397/1*hBdsv9w2WwhA9SfQHoQUrA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/397/1*5p9JzlsBWj0cLBiETBhd8w.jpeg" /></figure><p>6. ในหน้า Setting ของ Line service นี้จะแบ่งเป็น 3 ส่วนด้วยกัน คือ</p><p>— <strong>Recipient</strong> เป็นจุดให้เลือกว่าเราจะส่งข้อความจากต้นทาง (Twitter) ไปที่ไหนในไลน์ ซึ่งในรูปจะเป็นการแชทแบบ 1–1 อธิบายง่ายๆก็คือ เราจะได้ข้อความนี้เพียงคนเดียวเท่านั้น</p><p>— <strong>Message</strong> เป็นตัวกำหนดรูปแบบข้อความของเรา ผมแนะนำให้ลบทุกอย่างจนเหลือแค่ TweetEmbedCode ก็เพียงพอแล้วครับ</p><p>— <strong>Photo URL</strong> เป็นการแนบรูปไปกับข้อความโดยที่ต้องใช้เป็น URL ของรูปที่เราต้องการ (ไม่ต้องใส่ก็ได้)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/397/1*aOd7p8jQUAxohhJUjc7RLg.jpeg" /></figure><p>หลังจากทำทุกอย่างเสร็จเรียบร้อยแล้ว กดปุ่ม Create action</p><p>มาถึงขั้นตอนสุดท้ายกันแล้ว เราสามารถตั้งชื่อ Applet นี้ตามต้องการ ส่วนจะตั้งไม่ตั้งก็ตามใจเลยครับ เสร็จแล้วกด <strong>Finish</strong> เป็นอันเสร็จสิ้นขั้นตอนทั้งปวง</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/397/1*dzMmJ-1tRrjxnbhgPn6m2Q.jpeg" /></figure><p>เรามาดูตัวอย่างการใช้งานจริงกันครับ ในรูปผมเลือก Recipient เป็น Line group ที่ชื่อว่า BTS Notify (ในกรณีถ้าเลือกเป็นกลุ่มแบบนี้เราต้อง Add Line Notify Bot เข้ามาในกลุ่มด้วยนะครับ)</p><p>ทุกๆครั้งที่ Twitter BTS_SkyTrain tweet ข้อความ ก็จะมีข้อความส่งมาใน Line group เราแบบนี้เลย <br>โดยจากที่ผมทดลองมาทั้งวัน ข้อความที่ส่งมาจะดีเลย์จาก Twitter อยู่บ้าง แต่ก็ไม่นานเกิน 10 นาทีครับ</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/459/1*Lu2VG1fWQXc3M6LgnljQOw.png" /></figure><h3>สรุป</h3><p>แนะนำให้ทุกคนทำติดตัวไว้เพื่อความอุ่นใจ จะได้หาช่องทางการโดยสารอื่นทันเวลาครับ :)<br>ส่วนเจ้า IFTTT เนี่ยมันยังสามารถนำไปประยุกต์ใช้ได้หลากหลายมากๆ ถ้ามีเวลาก็ลองไปจิ้มๆเล่นกันดูนะครับทุกคน</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ddc5fe270a29" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>