diff --git a/generated_tests/testautomationpractice.blogspot.com/internal/.accessibility_state_partial___gui_elements_form_completion_and_submission_no_con_pom.json b/generated_tests/testautomationpractice.blogspot.com/internal/.accessibility_state_partial___gui_elements_form_completion_and_submission_no_con_pom.json new file mode 100644 index 0000000..cfc6ba7 --- /dev/null +++ b/generated_tests/testautomationpractice.blogspot.com/internal/.accessibility_state_partial___gui_elements_form_completion_and_submission_no_con_pom.json @@ -0,0 +1,1803 @@ +{ + "accessibility_tree": { + "role": "WebArea", + "name": "Automation Testing Practice", + "children": [ + { + "role": "heading", + "name": "Automation Testing Practice", + "level": 1 + }, + { + "role": "text", + "name": "For Selenium, Cypress & Playwright" + }, + { + "role": "link", + "name": "Home" + }, + { + "role": "link", + "name": "Udemy Courses" + }, + { + "role": "link", + "name": "Online Trainings" + }, + { + "role": "link", + "name": "Blog" + }, + { + "role": "link", + "name": "PlaywrightPractice" + }, + { + "role": "link", + "name": "GUI Elements" + }, + { + "role": "text", + "name": "Name:" + }, + { + "role": "textbox", + "name": "Enter Name", + "required": true, + "value": "Roostai" + }, + { + "role": "text", + "name": "Email:" + }, + { + "role": "textbox", + "name": "Enter EMail", + "value": "roostai@zb.io" + }, + { + "role": "text", + "name": "Phone:" + }, + { + "role": "textbox", + "name": "Enter Phone", + "value": "9999999999" + }, + { + "role": "text", + "name": "Address:" + }, + { + "role": "textbox", + "name": "Address:", + "multiline": true, + "value": "Bangalore , India" + }, + { + "role": "text", + "name": "Gender:" + }, + { + "role": "LineBreak", + "name": "\n" + }, + { + "role": "radio", + "name": "Male", + "checked": true + }, + { + "role": "radio", + "name": "Female", + "checked": false + }, + { + "role": "text", + "name": "Days:" + }, + { + "role": "LineBreak", + "name": "\n" + }, + { + "role": "checkbox", + "name": "Sunday", + "checked": false + }, + { + "role": "checkbox", + "name": "Monday", + "checked": true + }, + { + "role": "checkbox", + "name": "Tuesday", + "checked": true + }, + { + "role": "checkbox", + "name": "Wednesday", + "checked": true + }, + { + "role": "checkbox", + "name": "Thursday", + "checked": true + }, + { + "role": "checkbox", + "name": "Friday", + "checked": true + }, + { + "role": "checkbox", + "name": "Saturday", + "checked": false + }, + { + "role": "text", + "name": "Country:" + }, + { + "role": "combobox", + "name": "Country:", + "haspopup": "menu", + "children": [ + { + "role": "option", + "name": "United States" + }, + { + "role": "option", + "name": "Canada" + }, + { + "role": "option", + "name": "United Kingdom" + }, + { + "role": "option", + "name": "Germany" + }, + { + "role": "option", + "name": "France" + }, + { + "role": "option", + "name": "Australia" + }, + { + "role": "option", + "name": "Japan" + }, + { + "role": "option", + "name": "China" + }, + { + "role": "option", + "name": "Brazil" + }, + { + "role": "option", + "name": "India", + "selected": true + } + ], + "value": "India" + }, + { + "role": "text", + "name": "Colors:" + }, + { + "role": "listbox", + "name": "Colors:", + "multiselectable": true, + "orientation": "vertical", + "children": [ + { + "role": "option", + "name": "Red" + }, + { + "role": "option", + "name": "Blue" + }, + { + "role": "option", + "name": "Green" + }, + { + "role": "option", + "name": "Yellow", + "selected": true + }, + { + "role": "option", + "name": "Red" + }, + { + "role": "option", + "name": "White" + }, + { + "role": "option", + "name": "Green" + } + ] + }, + { + "role": "text", + "name": "Sorted List:" + }, + { + "role": "listbox", + "name": "Sorted List:", + "multiselectable": true, + "orientation": "vertical", + "children": [ + { + "role": "option", + "name": "Cat" + }, + { + "role": "option", + "name": "Cheetah" + }, + { + "role": "option", + "name": "Deer" + }, + { + "role": "option", + "name": "Dog", + "selected": true + }, + { + "role": "option", + "name": "Elephant" + }, + { + "role": "option", + "name": "Fox" + }, + { + "role": "option", + "name": "Giraffe" + }, + { + "role": "option", + "name": "Lion" + }, + { + "role": "option", + "name": "Rabbit" + }, + { + "role": "option", + "name": "Zebra" + } + ] + }, + { + "role": "text", + "name": "Date Picker 1 (mm/dd/yyyy): " + }, + { + "role": "textbox", + "name": "", + "value": "17/02/2026" + }, + { + "role": "text", + "name": "Date Picker 2 (dd/mm/yyyy) : " + }, + { + "role": "textbox", + "name": "", + "focused": true, + "readonly": true + }, + { + "role": "text", + "name": "Date Picker 3: (Select a Date Range)" + }, + { + "role": "Date", + "name": "", + "children": [ + { + "role": "spinbutton", + "name": "Month", + "valuetext": "", + "valuemin": 1, + "valuemax": 12, + "value": 0 + }, + { + "role": "text", + "name": "/" + }, + { + "role": "spinbutton", + "name": "Day", + "valuetext": "", + "valuemin": 1, + "valuemax": 31, + "value": 0 + }, + { + "role": "text", + "name": "/" + }, + { + "role": "spinbutton", + "name": "Year", + "valuetext": "", + "valuemin": 1, + "valuemax": 275760, + "value": 0 + }, + { + "role": "button", + "name": "Show date picker", + "haspopup": "menu" + } + ] + }, + { + "role": "text", + "name": "to" + }, + { + "role": "Date", + "name": "", + "children": [ + { + "role": "spinbutton", + "name": "Month", + "valuetext": "", + "valuemin": 1, + "valuemax": 12, + "value": 0 + }, + { + "role": "text", + "name": "/" + }, + { + "role": "spinbutton", + "name": "Day", + "valuetext": "", + "valuemin": 1, + "valuemax": 31, + "value": 0 + }, + { + "role": "text", + "name": "/" + }, + { + "role": "spinbutton", + "name": "Year", + "valuetext": "", + "valuemin": 1, + "valuemax": 275760, + "value": 0 + }, + { + "role": "button", + "name": "Show date picker", + "haspopup": "menu" + } + ] + }, + { + "role": "button", + "name": "Submit" + }, + { + "role": "link", + "name": "Home" + }, + { + "role": "text", + "name": "Subscribe to: " + }, + { + "role": "link", + "name": "Comments (Atom)" + }, + { + "role": "heading", + "name": "Upload Files", + "level": 2 + }, + { + "role": "button", + "name": "Choose File", + "value": "No file chosen" + }, + { + "role": "button", + "name": "Upload Single File" + }, + { + "role": "button", + "name": "Choose Files", + "value": "No file chosen" + }, + { + "role": "button", + "name": "Upload Multiple Files" + }, + { + "role": "heading", + "name": "Static Web Table", + "level": 2 + }, + { + "role": "text", + "name": "BookName" + }, + { + "role": "text", + "name": "Author" + }, + { + "role": "text", + "name": "Subject" + }, + { + "role": "text", + "name": "Price" + }, + { + "role": "text", + "name": "Learn Selenium" + }, + { + "role": "text", + "name": "Amit" + }, + { + "role": "text", + "name": "Selenium" + }, + { + "role": "text", + "name": "300" + }, + { + "role": "text", + "name": "Learn Java" + }, + { + "role": "text", + "name": "Mukesh" + }, + { + "role": "text", + "name": "Java" + }, + { + "role": "text", + "name": "500" + }, + { + "role": "text", + "name": "Learn JS" + }, + { + "role": "text", + "name": "Animesh" + }, + { + "role": "text", + "name": "Javascript" + }, + { + "role": "text", + "name": "300" + }, + { + "role": "text", + "name": "Master In Selenium" + }, + { + "role": "text", + "name": "Mukesh" + }, + { + "role": "text", + "name": "Selenium" + }, + { + "role": "text", + "name": "3000" + }, + { + "role": "text", + "name": "Master In Java" + }, + { + "role": "text", + "name": "Amod" + }, + { + "role": "text", + "name": "JAVA" + }, + { + "role": "text", + "name": "2000" + }, + { + "role": "text", + "name": "Master In JS" + }, + { + "role": "text", + "name": "Amit" + }, + { + "role": "text", + "name": "Javascript" + }, + { + "role": "text", + "name": "1000" + }, + { + "role": "heading", + "name": "Dynamic Web Table", + "level": 2 + }, + { + "role": "text", + "name": "Name" + }, + { + "role": "text", + "name": "CPU (%)" + }, + { + "role": "text", + "name": "Disk (MB/s)" + }, + { + "role": "text", + "name": "Network (Mbps)" + }, + { + "role": "text", + "name": "Memory (MB)" + }, + { + "role": "text", + "name": "System" + }, + { + "role": "text", + "name": "8.8%" + }, + { + "role": "text", + "name": "0.91 MB/s" + }, + { + "role": "text", + "name": "4.4 Mbps" + }, + { + "role": "text", + "name": "51.2 MB" + }, + { + "role": "text", + "name": "Chrome" + }, + { + "role": "text", + "name": "9.4%" + }, + { + "role": "text", + "name": "0.07 MB/s" + }, + { + "role": "text", + "name": "2.3 Mbps" + }, + { + "role": "text", + "name": "75.7 MB" + }, + { + "role": "text", + "name": "Firefox" + }, + { + "role": "text", + "name": "5.2%" + }, + { + "role": "text", + "name": "0.60 MB/s" + }, + { + "role": "text", + "name": "6.7 Mbps" + }, + { + "role": "text", + "name": "73.6 MB" + }, + { + "role": "text", + "name": "Internet Explorer" + }, + { + "role": "text", + "name": "2.8%" + }, + { + "role": "text", + "name": "0.09 MB/s" + }, + { + "role": "text", + "name": "3.3 Mbps" + }, + { + "role": "text", + "name": "43.0 MB" + }, + { + "role": "text", + "name": "CPU load of Chrome process: " + }, + { + "role": "text", + "name": "9.4%" + }, + { + "role": "text", + "name": "Memory Size of Firefox process: " + }, + { + "role": "text", + "name": "73.6 MB" + }, + { + "role": "text", + "name": "Network speed of Chrome process: " + }, + { + "role": "text", + "name": "2.3 Mbps" + }, + { + "role": "text", + "name": "Disk space of Firefox process: " + }, + { + "role": "text", + "name": "0.60 MB/s" + }, + { + "role": "heading", + "name": "Pagination Web Table", + "level": 2 + }, + { + "role": "text", + "name": "ID" + }, + { + "role": "text", + "name": "Name" + }, + { + "role": "text", + "name": "Price" + }, + { + "role": "text", + "name": "Select" + }, + { + "role": "text", + "name": "1" + }, + { + "role": "text", + "name": "Smartphone" + }, + { + "role": "text", + "name": "$10.99" + }, + { + "role": "checkbox", + "name": "", + "checked": false + }, + { + "role": "text", + "name": "2" + }, + { + "role": "text", + "name": "Laptop" + }, + { + "role": "text", + "name": "$19.99" + }, + { + "role": "checkbox", + "name": "", + "checked": false + }, + { + "role": "text", + "name": "3" + }, + { + "role": "text", + "name": "Tablet" + }, + { + "role": "text", + "name": "$5.99" + }, + { + "role": "checkbox", + "name": "", + "checked": false + }, + { + "role": "text", + "name": "4" + }, + { + "role": "text", + "name": "Smartwatch" + }, + { + "role": "text", + "name": "$7.99" + }, + { + "role": "checkbox", + "name": "", + "checked": false + }, + { + "role": "text", + "name": "5" + }, + { + "role": "text", + "name": "Wireless Earbuds" + }, + { + "role": "text", + "name": "$8.99" + }, + { + "role": "checkbox", + "name": "", + "checked": false + }, + { + "role": "link", + "name": "1" + }, + { + "role": "link", + "name": "2" + }, + { + "role": "link", + "name": "3" + }, + { + "role": "link", + "name": "4" + }, + { + "role": "heading", + "name": "Tabs", + "level": 2 + }, + { + "role": "link", + "name": "" + }, + { + "role": "textbox", + "name": "" + }, + { + "role": "button", + "name": "Submit" + }, + { + "role": "LineBreak", + "name": "\n" + }, + { + "role": "heading", + "name": "Dynamic Button", + "level": 2 + }, + { + "role": "button", + "name": "START" + }, + { + "role": "heading", + "name": "Alerts & Popups", + "level": 2 + }, + { + "role": "button", + "name": "Simple Alert" + }, + { + "role": "LineBreak", + "name": "\n" + }, + { + "role": "button", + "name": "Confirmation Alert" + }, + { + "role": "LineBreak", + "name": "\n" + }, + { + "role": "button", + "name": "Prompt Alert" + }, + { + "role": "LineBreak", + "name": "\n" + }, + { + "role": "button", + "name": "New Tab" + }, + { + "role": "button", + "name": "Popup Windows" + }, + { + "role": "heading", + "name": "Mouse Hover", + "level": 2 + }, + { + "role": "text", + "name": "Move the mouse over the button to open the dropdown menu." + }, + { + "role": "button", + "name": "Point Me" + }, + { + "role": "heading", + "name": "Double Click", + "level": 2 + }, + { + "role": "text", + "name": "Field1: " + }, + { + "role": "textbox", + "name": "", + "value": "Hello World!" + }, + { + "role": "LineBreak", + "name": "\n" + }, + { + "role": "text", + "name": "Field2: " + }, + { + "role": "textbox", + "name": "" + }, + { + "role": "LineBreak", + "name": "\n" + }, + { + "role": "LineBreak", + "name": "\n" + }, + { + "role": "button", + "name": "Copy Text" + }, + { + "role": "text", + "name": "Double click on button, the text from Field1 will be copied into Field2." + }, + { + "role": "heading", + "name": "Drag and Drop", + "level": 2 + }, + { + "role": "text", + "name": "Drag me to my target" + }, + { + "role": "text", + "name": "Drop here" + }, + { + "role": "heading", + "name": "Slider", + "level": 2 + }, + { + "role": "text", + "name": "Price range:" + }, + { + "role": "textbox", + "name": "Price range:", + "readonly": true, + "value": "$75 - $300" + }, + { + "role": "generic", + "name": "" + }, + { + "role": "generic", + "name": "" + }, + { + "role": "heading", + "name": "SVG Elements", + "level": 2 + }, + { + "role": "heading", + "name": "Scrolling DropDown", + "level": 2 + }, + { + "role": "textbox", + "name": "Select an item" + }, + { + "role": "heading", + "name": "Labels And Links", + "level": 2 + }, + { + "role": "heading", + "name": "Mobile Labels", + "level": 4 + }, + { + "role": "text", + "name": "Samsung" + }, + { + "role": "text", + "name": "Real Me" + }, + { + "role": "text", + "name": "Moto" + }, + { + "role": "heading", + "name": "Laptop Links", + "level": 4 + }, + { + "role": "link", + "name": "Apple" + }, + { + "role": "link", + "name": "Lenovo" + }, + { + "role": "link", + "name": "Dell" + }, + { + "role": "heading", + "name": "Broken Links", + "level": 4 + }, + { + "role": "link", + "name": "Errorcode 400" + }, + { + "role": "link", + "name": "Errorcode 401" + }, + { + "role": "link", + "name": "Errorcode 403" + }, + { + "role": "link", + "name": "Errorcode 404" + }, + { + "role": "link", + "name": "Errorcode 408" + }, + { + "role": "link", + "name": "Errorcode 500" + }, + { + "role": "link", + "name": "Errorcode 502" + }, + { + "role": "link", + "name": "Errorcode 503" + }, + { + "role": "heading", + "name": "Visitors", + "level": 2 + }, + { + "role": "image", + "name": "A chart." + }, + { + "role": "text", + "name": "0" + }, + { + "role": "text", + "name": "73" + }, + { + "role": "text", + "name": "1" + }, + { + "role": "text", + "name": "80" + }, + { + "role": "text", + "name": "2" + }, + { + "role": "text", + "name": "90" + }, + { + "role": "text", + "name": "3" + }, + { + "role": "text", + "name": "61" + }, + { + "role": "text", + "name": "4" + }, + { + "role": "text", + "name": "43" + }, + { + "role": "text", + "name": "5" + }, + { + "role": "text", + "name": "39" + }, + { + "role": "text", + "name": "6" + }, + { + "role": "text", + "name": "64" + }, + { + "role": "text", + "name": "7" + }, + { + "role": "text", + "name": "74" + }, + { + "role": "text", + "name": "8" + }, + { + "role": "text", + "name": "74" + }, + { + "role": "text", + "name": "9" + }, + { + "role": "text", + "name": "87" + }, + { + "role": "text", + "name": "10" + }, + { + "role": "text", + "name": "100" + }, + { + "role": "text", + "name": "11" + }, + { + "role": "text", + "name": "55" + }, + { + "role": "text", + "name": "12" + }, + { + "role": "text", + "name": "42" + }, + { + "role": "text", + "name": "13" + }, + { + "role": "text", + "name": "77" + }, + { + "role": "text", + "name": "14" + }, + { + "role": "text", + "name": "82" + }, + { + "role": "text", + "name": "15" + }, + { + "role": "text", + "name": "94" + }, + { + "role": "text", + "name": "16" + }, + { + "role": "text", + "name": "85" + }, + { + "role": "text", + "name": "17" + }, + { + "role": "text", + "name": "64" + }, + { + "role": "text", + "name": "18" + }, + { + "role": "text", + "name": "49" + }, + { + "role": "text", + "name": "19" + }, + { + "role": "text", + "name": "56" + }, + { + "role": "text", + "name": "20" + }, + { + "role": "text", + "name": "96" + }, + { + "role": "text", + "name": "21" + }, + { + "role": "text", + "name": "71" + }, + { + "role": "text", + "name": "22" + }, + { + "role": "text", + "name": "85" + }, + { + "role": "text", + "name": "23" + }, + { + "role": "text", + "name": "80" + }, + { + "role": "text", + "name": "24" + }, + { + "role": "text", + "name": "60" + }, + { + "role": "text", + "name": "25" + }, + { + "role": "text", + "name": "45" + }, + { + "role": "text", + "name": "26" + }, + { + "role": "text", + "name": "40" + }, + { + "role": "text", + "name": "27" + }, + { + "role": "text", + "name": "69" + }, + { + "role": "text", + "name": "28" + }, + { + "role": "text", + "name": "75" + }, + { + "role": "text", + "name": "29" + }, + { + "role": "text", + "name": "21" + }, + { + "role": "text", + "name": "6,629,135" + }, + { + "role": "heading", + "name": "Form", + "level": 2 + }, + { + "role": "heading", + "name": "Section 1", + "level": 4 + }, + { + "role": "text", + "name": "This is a paragraph in Section 1." + }, + { + "role": "textbox", + "name": "" + }, + { + "role": "button", + "name": "Submit" + }, + { + "role": "heading", + "name": "Section 2", + "level": 4 + }, + { + "role": "text", + "name": "This is a paragraph in Section 2." + }, + { + "role": "textbox", + "name": "" + }, + { + "role": "button", + "name": "Submit" + }, + { + "role": "heading", + "name": "Section 3", + "level": 4 + }, + { + "role": "text", + "name": "This is a paragraph in Section 3." + }, + { + "role": "textbox", + "name": "" + }, + { + "role": "button", + "name": "Submit" + }, + { + "role": "heading", + "name": "Footer Links", + "level": 2 + }, + { + "role": "link", + "name": "Home" + }, + { + "role": "link", + "name": "Hidden Elements & AJAX" + }, + { + "role": "link", + "name": "Download Files" + }, + { + "role": "heading", + "name": "ShadowDOM", + "level": 2 + }, + { + "role": "text", + "name": "Mobiles" + }, + { + "role": "LineBreak", + "name": "\n" + }, + { + "role": "text", + "name": "Laptops" + }, + { + "role": "LineBreak", + "name": "\n" + }, + { + "role": "link", + "name": "Blog" + }, + { + "role": "LineBreak", + "name": "\n" + }, + { + "role": "textbox", + "name": "" + }, + { + "role": "LineBreak", + "name": "\n" + }, + { + "role": "checkbox", + "name": "", + "checked": false + }, + { + "role": "LineBreak", + "name": "\n" + }, + { + "role": "button", + "name": "Choose File", + "value": "No file chosen" + }, + { + "role": "LineBreak", + "name": "\n" + }, + { + "role": "LineBreak", + "name": "\n" + }, + { + "role": "link", + "name": "Youtube" + }, + { + "role": "LineBreak", + "name": "\n" + }, + { + "role": "text", + "name": "Theme images by " + }, + { + "role": "link", + "name": "merrymoonmary" + }, + { + "role": "text", + "name": ". Powered by " + }, + { + "role": "link", + "name": "Blogger" + }, + { + "role": "text", + "name": "." + }, + { + "role": "text", + "name": "Prev" + }, + { + "role": "text", + "name": "Next" + }, + { + "role": "combobox", + "name": "Select month", + "haspopup": "menu", + "children": [ + { + "role": "option", + "name": "Jan" + }, + { + "role": "option", + "name": "Feb" + }, + { + "role": "option", + "name": "Mar", + "selected": true + }, + { + "role": "option", + "name": "Apr" + }, + { + "role": "option", + "name": "May" + }, + { + "role": "option", + "name": "Jun" + }, + { + "role": "option", + "name": "Jul" + }, + { + "role": "option", + "name": "Aug" + }, + { + "role": "option", + "name": "Sep" + }, + { + "role": "option", + "name": "Oct" + }, + { + "role": "option", + "name": "Nov" + }, + { + "role": "option", + "name": "Dec" + } + ], + "value": "Mar" + }, + { + "role": "combobox", + "name": "Select year", + "haspopup": "menu", + "children": [ + { + "role": "option", + "name": "2016" + }, + { + "role": "option", + "name": "2017" + }, + { + "role": "option", + "name": "2018" + }, + { + "role": "option", + "name": "2019" + }, + { + "role": "option", + "name": "2020" + }, + { + "role": "option", + "name": "2021" + }, + { + "role": "option", + "name": "2022" + }, + { + "role": "option", + "name": "2023" + }, + { + "role": "option", + "name": "2024" + }, + { + "role": "option", + "name": "2025" + }, + { + "role": "option", + "name": "2026", + "selected": true + }, + { + "role": "option", + "name": "2027" + }, + { + "role": "option", + "name": "2028" + }, + { + "role": "option", + "name": "2029" + }, + { + "role": "option", + "name": "2030" + }, + { + "role": "option", + "name": "2031" + }, + { + "role": "option", + "name": "2032" + }, + { + "role": "option", + "name": "2033" + }, + { + "role": "option", + "name": "2034" + }, + { + "role": "option", + "name": "2035" + }, + { + "role": "option", + "name": "2036" + } + ], + "value": "2026" + }, + { + "role": "text", + "name": "Su" + }, + { + "role": "text", + "name": "Mo" + }, + { + "role": "text", + "name": "Tu" + }, + { + "role": "text", + "name": "We" + }, + { + "role": "text", + "name": "Th" + }, + { + "role": "text", + "name": "Fr" + }, + { + "role": "text", + "name": "Sa" + }, + { + "role": "link", + "name": "1" + }, + { + "role": "link", + "name": "2" + }, + { + "role": "link", + "name": "3" + }, + { + "role": "link", + "name": "4" + }, + { + "role": "link", + "name": "5" + }, + { + "role": "link", + "name": "6" + }, + { + "role": "link", + "name": "7" + }, + { + "role": "link", + "name": "8" + }, + { + "role": "link", + "name": "9" + }, + { + "role": "link", + "name": "10" + }, + { + "role": "link", + "name": "11" + }, + { + "role": "link", + "name": "12" + }, + { + "role": "link", + "name": "13" + }, + { + "role": "link", + "name": "14" + }, + { + "role": "link", + "name": "15" + }, + { + "role": "link", + "name": "16" + }, + { + "role": "link", + "name": "17" + }, + { + "role": "link", + "name": "18" + }, + { + "role": "link", + "name": "19" + }, + { + "role": "link", + "name": "20" + }, + { + "role": "link", + "name": "21" + }, + { + "role": "link", + "name": "22" + }, + { + "role": "link", + "name": "23" + }, + { + "role": "link", + "name": "24" + }, + { + "role": "link", + "name": "25" + }, + { + "role": "link", + "name": "26" + }, + { + "role": "link", + "name": "27" + }, + { + "role": "link", + "name": "28" + }, + { + "role": "link", + "name": "29" + }, + { + "role": "link", + "name": "30" + }, + { + "role": "link", + "name": "31" + }, + { + "role": "text", + "name": " " + }, + { + "role": "text", + "name": " " + }, + { + "role": "text", + "name": " " + }, + { + "role": "text", + "name": " " + } + ] + }, + "url": "https://testautomationpractice.blogspot.com/" +} \ No newline at end of file diff --git a/generated_tests/testautomationpractice.blogspot.com/playwright_tests/.roost/metadata.json b/generated_tests/testautomationpractice.blogspot.com/playwright_tests/.roost/metadata.json new file mode 100644 index 0000000..544feb4 --- /dev/null +++ b/generated_tests/testautomationpractice.blogspot.com/playwright_tests/.roost/metadata.json @@ -0,0 +1,82 @@ +{ + "metadata_version": "1.0", + "created_at": "2026-03-11T06:02:02.177578", + "last_updated": "2026-03-11T06:21:12.231857", + "pom_files": [ + { + "url": "https://testautomationpractice.blogspot.com/", + "file_name": "HomePage.js", + "file_path": "/var/tmp/Roost/RoostGPT/Ui-test-pr/a1d2fb5c-80c6-47bb-9c19-135331942ba4/source/UI-Testing-ATID/generated_tests/testautomationpractice.blogspot.com/playwright_tests/pom_tests/pom/HomePage.js" + } + ], + "Login_File": { + "name": null, + "path": null, + "hash": null, + "agent_workflow_completed": false, + "agent_workflow_file_path": null, + "agent_interaction_file_path": null, + "agent_activity_summary": null, + "agent_activity_error": null, + "agent_activity_outcome": null, + "agent_recommendation": null, + "agent_completion_level": null, + "agent_steps_completed": null, + "scenario_name": null, + "scenario_file_path": null, + "test_generated": false, + "test_generation_error": null, + "test_file_path": null, + "test_executed_success": null, + "test_execution_error": null, + "pom_test_name": null, + "pom_test_file_path": null, + "pom_test_executed_success": null, + "pom_test_execution_error": null, + "pom_files": null + }, + "User_Scenarios_File": [ + { + "name": "testautomations user scenario.docx", + "path": "/var/tmp/Roost/RoostGPT/Ui-test-pr/a1d2fb5c-80c6-47bb-9c19-135331942ba4/testautomations user scenario.docx", + "hash": "77dd1069b11b2f9a2340eba5c990219437554398b9ebfb40d9892bd3792aff96", + "agent_workflow_completed": false, + "agent_workflow_file_path": "/var/tmp/Roost/RoostGPT/Ui-test-pr/a1d2fb5c-80c6-47bb-9c19-135331942ba4/temp_info/testautomationpractice.blogspot.com/extracted_data/interaction_data_0fbe6b244d0da75d14415e97c246f45224ce2ea2bc4cc0692d1d817a5f358d8d.json", + "agent_activity_summary": [ + "The agent navigated to the Automation Testing Practice homepage and sequentially completed all required actions in the 'GUI Elements' form. This included entering the specified Name, Email, Phone, and Address, selecting the Male gender, checking all required weekdays, choosing 'India' from the Country dropdown, selecting 'Yellow' from the Colors list, selecting 'Dog' from the Sorted List, and entering the specified dates in all three date pickers. The agent then clicked the Submit button to submit the form. After submission, the agent attempted to verify successful form submission by searching for a confirmation message or page state change. Upon not finding any visible confirmation, the agent retried the form submission by clicking the Submit button a second time and repeated the verification process. No confirmation message or page change was detected after either submission attempt." + ], + "agent_activity_error": [ + "At steps 19 and 20, the agent did not detect any visible confirmation message or page change after submitting the form. To recover, the agent attempted to resubmit the form by clicking the Submit button again in step 21 and repeated the verification process. Despite these recovery attempts, no confirmation of successful submission was observed." + ], + "agent_activity_outcome": [ + "The agent successfully completed all form interactions as specified in the user scenario, but the final goal of confirming form submission could not be verified due to the absence of any visible confirmation message or page state change after submission." + ], + "agent_recommendation": "Review the application under test to ensure that a clear confirmation message or page state change is triggered upon successful form submission. If no such feedback is provided by design, consider updating the test scenario to define alternative verification criteria (e.g., field reset, network request validation).", + "agent_completion_level": "partial", + "agent_steps_completed": null, + "scenario_analysis_result_file_path": "/var/tmp/Roost/RoostGPT/Ui-test-pr/a1d2fb5c-80c6-47bb-9c19-135331942ba4/temp_info/testautomationpractice.blogspot.com/extracted_data/user_scenario_0fbe6b244d0da75d14415e97c246f45224ce2ea2bc4cc0692d1d817a5f358d8d.json", + "scenario_name": "partial_-_gui_elements_form_completion_and_submission_no_con", + "scenario_file_path": "scenarios/partial_-_gui_elements_form_completion_and_submiss.json", + "feature_file_path": "scenarios/features/Discovered_Workflow_Partial_GUI_Elements_Form_Comp.feature", + "feature_file_name": "Discovered_Workflow_Partial_GUI_Elements_Form_Comp.feature", + "test_generated": false, + "test_generation_error": null, + "test_name": null, + "test_file_path": null, + "test_execution_error": null, + "test_executed_success": null, + "pom_test_name": "partial___gui_elements_form_completion_and_submission_no_con_pom.noauth.spec.js", + "pom_test_file_path": "pom_tests/partial___gui_elements_form_completion_and_submission_no_con_pom.noauth.spec.js", + "pom_test_executed_success": null, + "pom_test_execution_error": null, + "pom_files": [ + { + "url": "https://testautomationpractice.blogspot.com/", + "file_name": "HomePage.js", + "file_path": "/var/tmp/Roost/RoostGPT/Ui-test-pr/a1d2fb5c-80c6-47bb-9c19-135331942ba4/source/UI-Testing-ATID/generated_tests/testautomationpractice.blogspot.com/playwright_tests/pom_tests/pom/HomePage.js" + } + ] + } + ], + "Exploration_Scenarios": [] +} \ No newline at end of file diff --git a/generated_tests/testautomationpractice.blogspot.com/playwright_tests/README.md b/generated_tests/testautomationpractice.blogspot.com/playwright_tests/README.md new file mode 100644 index 0000000..ff80463 --- /dev/null +++ b/generated_tests/testautomationpractice.blogspot.com/playwright_tests/README.md @@ -0,0 +1,77 @@ +# Playwright Test Suite + +## RoostGpt Generated playwright test + +This project contains Playwright-based automated tests located in the `playwright_tests` directory. + +## 📁 Directory Structure + +```bash + playwright_tests/ + ├── README.md + ├── scenarios/ + ├── scenarios_summary.md + ├── *.json (scenario files) + ├── features/ + │ ├── *.feature (feature files) + ├── tests/ + ├── package.json + ├── playwright.config.js + ├── .env.template + ├── *.spec.js (test files) + ├── test_summary.md +``` + +## 🧩 Prerequisites + +Make sure you have the following installed: + +- [Node.js](https://nodejs.org/) (version 18 or higher recommended) +- npm (comes with Node.js) + +## 📦 Setup + +1. Navigate to the Playwright tests directory: + +2. Install dependencies: + + ```bash + cd tests + cp .env.template .env + npm install + ``` + +3. Edit the `.env` file to set any required environment variables. +## 🚀 Running Tests + +To execute all Playwright tests: + +```bash +npx playwright test +``` + +You can also run a specific test file: + +```bash +npx playwright test example.spec.js +``` + +> Replace `example.spec.js` with the actual test file you want to run. + +## 📂 Test Reports + +After the tests run, Playwright will generate a report. To view the report: + +```bash +npx playwright show-report +``` + +## ⚙️ Configuration + +Test configuration is defined in `playwright.config.js`. + +You can modify settings like test directory, timeout etc., in this file. + +## 📘 More Info + +For detailed Playwright documentation, visit: [https://playwright.dev](https://playwright.dev) diff --git a/generated_tests/testautomationpractice.blogspot.com/playwright_tests/pom_tests/.debugging_notes_partial___gui_elements_form_completion_and_submission_no_con_pom.md b/generated_tests/testautomationpractice.blogspot.com/playwright_tests/pom_tests/.debugging_notes_partial___gui_elements_form_completion_and_submission_no_con_pom.md new file mode 100644 index 0000000..c70ff58 --- /dev/null +++ b/generated_tests/testautomationpractice.blogspot.com/playwright_tests/pom_tests/.debugging_notes_partial___gui_elements_form_completion_and_submission_no_con_pom.md @@ -0,0 +1,2 @@ +# Debugging Notes + diff --git a/generated_tests/testautomationpractice.blogspot.com/playwright_tests/pom_tests/.env.template b/generated_tests/testautomationpractice.blogspot.com/playwright_tests/pom_tests/.env.template new file mode 100644 index 0000000..7ed0d77 --- /dev/null +++ b/generated_tests/testautomationpractice.blogspot.com/playwright_tests/pom_tests/.env.template @@ -0,0 +1,13 @@ +# Environment Configuration Template +# This file contains safe placeholder values for version control +# Actual credentials will be injected at runtime from your source env file + +# Application Configuration +BASE_HOST_URL='https://testautomationpractice.blogspot.com' +BASE_URL='https://testautomationpractice.blogspot.com' +CI='' +COOKIE_GRACE_PERIOD_MINUTES='' + +# Authentication & Credentials (POPULATED AT RUNTIME) +# These values are automatically loaded during test execution +# DO NOT enter real credentials here \ No newline at end of file diff --git a/generated_tests/testautomationpractice.blogspot.com/playwright_tests/pom_tests/package-lock.json b/generated_tests/testautomationpractice.blogspot.com/playwright_tests/pom_tests/package-lock.json new file mode 100644 index 0000000..bb57879 --- /dev/null +++ b/generated_tests/testautomationpractice.blogspot.com/playwright_tests/pom_tests/package-lock.json @@ -0,0 +1,93 @@ +{ + "name": "pom-playwright-tests", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "pom-playwright-tests", + "version": "1.0.0", + "license": "ISC", + "devDependencies": { + "@playwright/test": "1.55.0", + "dotenv": "^16.4.5" + } + }, + "node_modules/@playwright/test": { + "version": "1.55.0", + "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.55.0.tgz", + "integrity": "sha512-04IXzPwHrW69XusN/SIdDdKZBzMfOT9UNT/YiJit/xpy2VuAoB8NHc8Aplb96zsWDddLnbkPL3TsmrS04ZU2xQ==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "playwright": "1.55.0" + }, + "bin": { + "playwright": "cli.js" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/dotenv": { + "version": "16.6.1", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.6.1.tgz", + "integrity": "sha512-uBq4egWHTcTt33a72vpSG0z3HnPuIl6NqYcTrKEg2azoEyl2hpW0zqlxysq2pK9HlDIHyHyakeYaYnSAwd8bow==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://dotenvx.com" + } + }, + "node_modules/fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/playwright": { + "version": "1.55.0", + "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.55.0.tgz", + "integrity": "sha512-sdCWStblvV1YU909Xqx0DhOjPZE4/5lJsIS84IfN9dAZfcl/CIZ5O8l3o0j7hPMjDvqoTF8ZUcc+i/GL5erstA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "playwright-core": "1.55.0" + }, + "bin": { + "playwright": "cli.js" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "fsevents": "2.3.2" + } + }, + "node_modules/playwright-core": { + "version": "1.55.0", + "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.55.0.tgz", + "integrity": "sha512-GvZs4vU3U5ro2nZpeiwyb0zuFaqb9sUiAJuyrWpcGouD8y9/HLgGbNRjIph7zU9D3hnPaisMl9zG9CgFi/biIg==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "playwright-core": "cli.js" + }, + "engines": { + "node": ">=18" + } + } + } +} diff --git a/generated_tests/testautomationpractice.blogspot.com/playwright_tests/pom_tests/package.json b/generated_tests/testautomationpractice.blogspot.com/playwright_tests/pom_tests/package.json new file mode 100644 index 0000000..d116d90 --- /dev/null +++ b/generated_tests/testautomationpractice.blogspot.com/playwright_tests/pom_tests/package.json @@ -0,0 +1,24 @@ + + { + "name": "pom-playwright-tests", + "version": "1.0.0", + "type": "module", + "description": "A robust suite of end-to-end tests using Playwright.", + "scripts": { + "test": "npx playwright test", + "test:headed": "npx playwright test --headed", + "report": "npx playwright show-report" + }, + "keywords": [ + "playwright", + "testing", + "e2e", + "automation" + ], + "author": "", + "license": "ISC", + "devDependencies": { + "@playwright/test": "1.55.0", + "dotenv": "^16.4.5" + } + } diff --git a/generated_tests/testautomationpractice.blogspot.com/playwright_tests/pom_tests/partial___gui_elements_form_completion_and_submission_no_con_pom.noauth.spec.js b/generated_tests/testautomationpractice.blogspot.com/playwright_tests/pom_tests/partial___gui_elements_form_completion_and_submission_no_con_pom.noauth.spec.js new file mode 100644 index 0000000..06a2557 --- /dev/null +++ b/generated_tests/testautomationpractice.blogspot.com/playwright_tests/pom_tests/partial___gui_elements_form_completion_and_submission_no_con_pom.noauth.spec.js @@ -0,0 +1,105 @@ +import 'dotenv/config'; +import { test, expect } from '@playwright/test'; +import { HomePage } from './pom/HomePage.js'; +import fs from 'fs'; +import path from 'path'; +import { fileURLToPath } from 'url'; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); + +const BASE_URL = process.env.BASE_URL; +const BASE_HOST_URL = process.env.BASE_HOST_URL; +let stepTimeout30 = { timeout: 30000 }; + +// Scenario: Discovered Workflow: Partial - GUI Elements Form Completion and Submission (No Confirmation) +test('partial___gui_elements_form_completion_and_submission_no_con', async ({ page }) => { + // Step 1: Navigate to homepage + await page.goto(BASE_URL || BASE_HOST_URL, { waitUntil: 'domcontentloaded' }); + + // Instantiate HomePage POM + const homePage = new HomePage(page); + + // Step 2: Input Name + await homePage.fillNameField('Roostai'); + + // Step 3: Input Email + await homePage.fillEmailField('roostai@zb.io'); + + // Step 4: Input Phone + await homePage.fillPhoneField('9999999999'); + + // Step 5: Input Address + await homePage.fillAddressField('Bangalore , India'); + + // Step 6: Select Male Gender + await homePage.selectGenderMale(); + + // Step 7: Check Monday + await homePage.checkMonday(); + + // Step 8: Check Tuesday + await homePage.checkTuesday(); + + // Step 9: Check Wednesday + await homePage.checkWednesday(); + + // Step 10: Check Thursday + await homePage.checkThursday(); + + // Step 11: Check Friday + await homePage.checkFriday(); + + // Step 12: Select Country + await homePage.selectCountryIndia(); + + // Step 13: Select Color + await homePage.selectColorYellow(); + + // Step 14: Select Sorted List + await homePage.selectSortedListDog(); + + // Step 15: Input Date Picker 1 + await homePage.fillDatePicker1('17/02/2026'); + + // Step 16: Input Date Picker 2 + await homePage.fillDatePicker2('01/01/2026'); + + // Step 17: Input Date Picker 3 Start Date + await homePage.fillDatePicker3Start('2026-01-10'); + + // Step 18: Input Date Picker 3 End Date + await homePage.fillDatePicker3End('2026-03-10'); + + // Step 19: Click Submit + await homePage.submitForm(); + + // Step 20: Capture Visible Messages + const messages = await homePage.captureVisibleMessages(); + if (messages && messages.length > 0) { + console.log('Visible messages after submit:', messages); + } else { + console.log('No visible confirmation message after submit.'); + } + + // Step 21: Retry Submit + await homePage.retrySubmitForm(); + + // Step 22: Finalize Scenario + await homePage.finalizeScenario(); +}); + +test.afterEach(async ({ page }, testInfo) => { + if (testInfo.status !== 'passed') { + try { + const accessibilityTree = await page.accessibility.snapshot(); + const fileName = path.basename(testInfo.file) + .replace('.auth.spec.js', '').replace('.noauth.spec.js', '').replace('.spec.js', ''); + const stateFile = path.join(__dirname, '..', `.accessibility_state_${fileName}.json`); + fs.writeFileSync(stateFile, JSON.stringify({ + accessibility_tree: accessibilityTree, + url: page.url() + }, null, 2)); + } catch (e) { /* Silent fail */ } + } +}); diff --git a/generated_tests/testautomationpractice.blogspot.com/playwright_tests/pom_tests/playwright.config.js b/generated_tests/testautomationpractice.blogspot.com/playwright_tests/pom_tests/playwright.config.js new file mode 100644 index 0000000..1b76d02 --- /dev/null +++ b/generated_tests/testautomationpractice.blogspot.com/playwright_tests/pom_tests/playwright.config.js @@ -0,0 +1,208 @@ + +import { defineConfig } from "@playwright/test"; +import * as fs from "fs"; +import * as path from "path"; +import { fileURLToPath } from 'url'; + +const __filename = fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); + +/** + * @see https://playwright.dev/docs/test-configuration + * + * This configuration automatically reuses authentication session with smart cookie validation: + * 1. Checks if storage state exists AND cookies are still valid + * 2. If cookies expired → login test runs first to regenerate fresh cookies + * 3. If cookies valid → authenticated tests run directly (no login needed!) + * 4. Login tests always run with fresh browser + */ + +// Check if storage state file exists +const storageStatePath = path.join(__dirname, '.auth', 'storage-state.json'); +const storageStateExists = fs.existsSync(storageStatePath); + +/** + * Validates if authentication cookies in storage state are still valid + * + * Smart validation that only checks auth-critical cookies (not analytics/tracking): + * - Configurable via AUTH_COOKIE_NAMES env var (comma-separated patterns) + * - Default patterns: session, auth, token, sid, JSESSIONID, etc. + * - Grace period: Triggers re-login N minutes before expiration (COOKIE_GRACE_PERIOD_MINUTES) + * - Ignores non-auth cookies to prevent unnecessary re-logins + * + * @returns {boolean} true if auth cookies are valid, false if expired/missing + */ +function isStorageStateValid() { + if (!storageStateExists) { + return false; + } + + try { + const storageState = JSON.parse(fs.readFileSync(storageStatePath, 'utf-8')); + + // Check if cookies array exists + if (!storageState.cookies || !Array.isArray(storageState.cookies)) { + return false; + } + + // Configure authentication cookie patterns + // Override via AUTH_COOKIE_NAMES environment variable (comma-separated) + const authCookiePatterns = (process.env.AUTH_COOKIE_NAMES || + 'session,auth,token,sid,oauth,JSESSIONID,connect.sid,access_token,refresh_token,jwt,bearer,_session').split(','); + + // Configure grace period (minutes before expiration to trigger re-login) + const gracePeriodMinutes = parseInt(process.env.COOKIE_GRACE_PERIOD_MINUTES || '1'); + const gracePeriodSeconds = gracePeriodMinutes * 60; + const now = Date.now() / 1000; // Convert to seconds + + // Filter to only auth-critical cookies + const authCookies = storageState.cookies.filter((cookie) => + authCookiePatterns.some((pattern) => + cookie.name.toLowerCase().includes(pattern.toLowerCase()) + ) + ); + + if (authCookies.length === 0) { + return false; + } + + // Check auth cookies for expiration (with grace period) + // @ts-ignore - Cookie type from storage state + const expiredAuthCookies = authCookies.filter((cookie) => + cookie.expires && + cookie.expires !== -1 && + cookie.expires < (now + gracePeriodSeconds) + ); + + if (expiredAuthCookies.length > 0) { + return false; + } + + return true; + } catch (error) { + return false; + } +} + +// Validate storage state (exists + cookies not expired) +const storageStateValid = isStorageStateValid(); + +export default defineConfig({ + testDir: ".", + fullyParallel: false, + forbidOnly: !!process.env.CI, + retries: process.env.CI ? 2 : 0, + workers: 1, + reporter: "html", + globalTimeout: 600000, + timeout: 120000, + + use: { + locale: "en-US", + trace: "on-first-retry", + screenshot: "only-on-failure", + viewport: null, // Use actual browser window size + launchOptions: { + args: [ + "--start-maximized", + "--disable-blink-features=AutomationControlled", + "--disable-dev-shm-usage", + "--no-sandbox", + ], + }, + // Do NOT set storageState here globally + // Each project will specify its own storage state needs + }, + + projects: [ + // ========================================== + // LOGIN TEST - Always runs with fresh browser + // ========================================== + { + name: 'login-test', + testMatch: /login_analysis.*\.spec\.js/, + use: { + browserName: 'chromium', + viewport: null, + // No storageState - fresh browser for login + }, + }, + + // ========================================== + // AUTHENTICATED TESTS - Need login (use storage state) + // ========================================== + { + name: 'chromium-authenticated', + testMatch: /.*\.auth\.spec\.js/, + // Smart dependency: Only depend on login if storage state is invalid + dependencies: storageStateValid ? [] : ['login-test'], + use: { + browserName: 'chromium', + viewport: null, + // Only set storage state if file exists + ...(storageStateExists ? { storageState: storageStatePath } : {}) + }, + }, + + // ========================================== + // UNAUTHENTICATED TESTS - Public pages (no login) + // ========================================== + { + name: 'chromium-noauth', + testMatch: /.*\.noauth\.spec\.js/, + use: { + browserName: 'chromium', + viewport: null, + // No storageState - fresh browser for public pages + }, + }, + + // // ========================================== + // // FIREFOX BROWSER + // // ========================================== + // { + // name: 'firefox-authenticated', + // testMatch: /.*\.auth\.spec\.js/, + // use: { + // browserName: 'firefox', + // viewport: null, + // storageState: '.auth/storage-state.json', + // }, + // dependencies: ['setup'], + // }, + // { + // name: 'firefox-noauth', + // testMatch: /.*\.noauth\.spec\.js/, + // use: { browserName: 'firefox', viewport: null }, + // }, + // { + // name: 'firefox-login-tests', + // testMatch: /login.*\.spec\.js/, + // use: { browserName: 'firefox', viewport: null }, + // }, + + // // ========================================== + // // WEBKIT (Safari) BROWSER + // // ========================================== + // { + // name: 'webkit-authenticated', + // testMatch: /.*\.auth\.spec\.js/, + // use: { + // browserName: 'webkit', + // viewport: null, + // storageState: '.auth/storage-state.json', + // }, + // dependencies: ['setup'], + // }, + // { + // name: 'webkit-noauth', + // testMatch: /.*\.noauth\.spec\.js/, + // use: { browserName: 'webkit', viewport: null }, + // }, + // { + // name: 'webkit-login-tests', + // testMatch: /login.*\.spec\.js/, + // use: { browserName: 'webkit', viewport: null }, + // }, + ], +}); diff --git a/generated_tests/testautomationpractice.blogspot.com/playwright_tests/pom_tests/pom/BasePage.js b/generated_tests/testautomationpractice.blogspot.com/playwright_tests/pom_tests/pom/BasePage.js new file mode 100644 index 0000000..04c9bfd --- /dev/null +++ b/generated_tests/testautomationpractice.blogspot.com/playwright_tests/pom_tests/pom/BasePage.js @@ -0,0 +1,41 @@ +export class BasePage { + /** + * @param {import('playwright').Page} page + */ + constructor(page) { + this.page = page; + } + + /** + * Waits for the page to load with DOMContentLoaded event. + * @param {string} url + * @param {number} [timeout=60000] - Timeout in ms (default: 60s) + * @returns {Promise} + */ + async goto(url, timeout = 60000) { + await this.page.goto(url, { waitUntil: 'domcontentloaded', timeout }); + return this; + } + + /** + * Waits for a selector to be visible. + * @param {string} selector + * @param {number} [timeout=30000] + * @returns {Promise} + */ + async waitForVisible(selector, timeout = 30000) { + await this.page.waitForSelector(selector, { state: 'visible', timeout }); + return this; + } + + /** + * Captures all visible messages on the page (for confirmation/error feedback). + * @param {number} [timeout=15000] + * @returns {Promise} + */ + async captureVisibleMessages(timeout = 15000) { + // Try to capture visible messages (alerts, confirmations, etc.) + const messages = await this.page.locator('[role="alert"], .alert, .confirmation, .error, .success').allInnerTexts(); + return messages; + } +} diff --git a/generated_tests/testautomationpractice.blogspot.com/playwright_tests/pom_tests/pom/HomePage.js b/generated_tests/testautomationpractice.blogspot.com/playwright_tests/pom_tests/pom/HomePage.js new file mode 100644 index 0000000..1cb8917 --- /dev/null +++ b/generated_tests/testautomationpractice.blogspot.com/playwright_tests/pom_tests/pom/HomePage.js @@ -0,0 +1,273 @@ +import { BasePage } from './BasePage.js'; + +export class HomePage extends BasePage { + /** + * @param {import('playwright').Page} page + */ + constructor(page) { + super(page); + // GUI Elements Form selectors + // Name field + this.nameInput = this.page.getByRole('textbox', { name: 'Enter Name' }); + // Email field + this.emailInput = this.page.getByRole('textbox', { name: 'Enter EMail' }); + // Phone field + this.phoneInput = this.page.getByRole('textbox', { name: 'Enter Phone' }); + // Address field + this.addressInput = this.page.getByRole('textbox', { name: 'Address:' }); + // Gender radio button (Male) + this.genderMaleRadio = this.page.getByRole('radio', { name: 'Male', exact: true }); + // Days checkboxes + this.mondayCheckbox = this.page.getByRole('checkbox', { name: 'Monday' }); + this.tuesdayCheckbox = this.page.getByRole('checkbox', { name: 'Tuesday' }); + this.wednesdayCheckbox = this.page.getByRole('checkbox', { name: 'Wednesday' }); + this.thursdayCheckbox = this.page.getByRole('checkbox', { name: 'Thursday' }); + this.fridayCheckbox = this.page.getByRole('checkbox', { name: 'Friday' }); + // Country dropdown + this.countryDropdown = this.page.getByLabel('Country:'); + // Colors dropdown + this.colorsDropdown = this.page.getByLabel('Colors:'); + // Sorted List + this.sortedListDropdown = this.page.getByLabel('Sorted List:'); + // Date Picker 1 + this.datePicker1 = this.page.locator('#datepicker'); + // Date Picker 2 + this.datePicker2 = this.page.locator('#txtDate'); + // Date Picker 3 Start Date + this.datePicker3Start = this.page.getByPlaceholder('Start Date'); + // Date Picker 3 End Date + this.datePicker3End = this.page.getByPlaceholder('End Date'); + // Submit button + this.submitButton = this.page.locator('#post-body-1307673142697428135').getByRole('button', { name: 'Submit' }); + } + + /** + * Fills the Name field. + * @param {string} name + * @returns {Promise} + */ + async fillNameField(name) { + await this.nameInput.fill(name, { timeout: 30000 }); + return this; + } + + /** + * Fills the Email field. + * @param {string} email + * @returns {Promise} + */ + async fillEmailField(email) { + await this.emailInput.fill(email, { timeout: 30000 }); + return this; + } + + /** + * Fills the Phone field. + * @param {string} phone + * @returns {Promise} + */ + async fillPhoneField(phone) { + await this.phoneInput.fill(phone, { timeout: 30000 }); + return this; + } + + /** + * Fills the Address field. + * @param {string} address + * @returns {Promise} + */ + async fillAddressField(address) { + await this.addressInput.fill(address, { timeout: 30000 }); + return this; + } + + /** + * Selects Male gender radio button. + * @returns {Promise} + */ + async selectGenderMale() { + await this.genderMaleRadio.click({ timeout: 15000 }); + return this; + } + + /** + * Checks Monday checkbox. + * @returns {Promise} + */ + async checkMonday() { + await this.mondayCheckbox.check({ timeout: 15000 }); + return this; + } + + /** + * Checks Tuesday checkbox. + * @returns {Promise} + */ + async checkTuesday() { + await this.tuesdayCheckbox.check({ timeout: 15000 }); + return this; + } + + /** + * Checks Wednesday checkbox. + * @returns {Promise} + */ + async checkWednesday() { + await this.wednesdayCheckbox.check({ timeout: 15000 }); + return this; + } + + /** + * Checks Thursday checkbox. + * @returns {Promise} + */ + async checkThursday() { + await this.thursdayCheckbox.check({ timeout: 15000 }); + return this; + } + + /** + * Checks Friday checkbox. + * @returns {Promise} + */ + async checkFriday() { + await this.fridayCheckbox.check({ timeout: 15000 }); + return this; + } + + /** + * Selects 'India' from Country dropdown. + * @returns {Promise} + */ + async selectCountryIndia() { + await this.countryDropdown.selectOption({ label: 'India' }, { timeout: 15000 }); + return this; + } + + /** + * Selects 'Yellow' from Colors dropdown. + * @returns {Promise} + */ + async selectColorYellow() { + await this.colorsDropdown.selectOption({ label: 'Yellow' }, { timeout: 15000 }); + return this; + } + + /** + * Selects 'Dog' from Sorted List dropdown. + * @returns {Promise} + */ + async selectSortedListDog() { + await this.sortedListDropdown.selectOption({ label: 'Dog' }, { timeout: 15000 }); + return this; + } + + /** + * Fills Date Picker 1 with provided date string. + * @param {string} date + * @returns {Promise} + */ + async fillDatePicker1(date) { + await this.datePicker1.fill(date, { timeout: 30000 }); + return this; + } + + /** + * Fills Date Picker 2 with provided date string. + * @param {string} date (format: DD/MM/YYYY) + * @returns {Promise} + */ + async fillDatePicker2(date) { + // The input is readonly, so we must use the datepicker widget. + // Parse the date string (expected format: DD/MM/YYYY) + const [day, month, year] = date.split('/'); + // Click the input to open the datepicker + await this.datePicker2.click({ timeout: 10000 }); + + // Wait for the datepicker widget to appear + const datepickerWidget = this.page.locator('.ui-datepicker'); + await datepickerWidget.waitFor({ state: 'visible', timeout: 10000 }); + + // Select the correct month and year + // The widget has .ui-datepicker-month and .ui-datepicker-year