จากหน้าเว็บทั้งหน้า สู่ component ที่ทดสอบแยกได้

Playwright 1.62.0 เพิ่มแนวทาง Component Testing แบบ stories and galleries พร้อม fixtures.mount() ทำให้ทีมสามารถทดสอบ component ใน state ที่ต้องการได้เป็นระบบขึ้น โดยไม่ต้องเริ่มจาก flow ของทั้งแอปทุกครั้ง

แนวทางนี้เหมาะกับ component ที่มี state ซับซ้อน เช่น form validation, loading, error และ empty state เพราะแต่ละ story กลายเป็นจุดตั้งต้นที่ review และทำซ้ำได้

ลด flaky test ด้วยการควบคุม retry

ตัวเลือก retryStrategy: isolated ทำให้ retry ที่เกิดจากความล้มเหลวถูกรันแยกหลังชุดทดสอบหลักจบลง ลดโอกาสที่ retry จะรบกวนลำดับหรือ resource ของการทดสอบอื่น

อีกจุดที่น่าสนใจคือ AbortSignal สำหรับยกเลิก action, navigation, wait และ assertion ที่ใช้เวลานาน ทีม QA ควรกำหนด timeout ให้สัมพันธ์กับระบบจริงแทนการเพิ่ม timeout ทุกจุดจนซ่อนปัญหา

Source note

This article is an original summary and analysis. Facts are based on the linked primary source; performance figures remain vendor-reported where noted.

#Playwright#Component testing#QA automation