diff --git a/Scripts/TC0/Script1732526297013.groovy b/Scripts/TC0/Script1732526297013.groovy new file mode 100644 index 0000000..7ceb7f2 --- /dev/null +++ b/Scripts/TC0/Script1732526297013.groovy @@ -0,0 +1,63 @@ +import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject + +import com.kms.katalon.core.testobject.TestObject +import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI + +/** + * This script visits the page at https://katalon-demo-cura.herokuapp.com/ and the linked pages + * without highlighting elements + */ + +// open browser and navigate to the AUT +WebUI.openBrowser('') +WebUI.setViewPortSize(1024, 768) +WebUI.navigateToUrl('https://katalon-demo-cura.herokuapp.com/') +WebUI.delay(1) + +TestObject a_MakeAppointment = findTestObject('Page_CURA Healthcare Service_top/a_Make Appointment') +WebUI.verifyElementPresent(a_MakeAppointment, 10) + +WebUI.click(a_MakeAppointment) +WebUI.delay(1) + +TestObject input_username = findTestObject('Page_CURA Healthcare Service_login/input_Username_username') +WebUI.setText(input_username, 'John Doe') +WebUI.delay(1) + +TestObject input_password = findTestObject('Page_CURA Healthcare Service_login/input_Password_password') +WebUI.setEncryptedText(input_password, 'g3/DOGG74jC3Flrr3yH+3D/yKbOqqUNM') +WebUI.delay(1) + +TestObject button_Login = findTestObject('Page_CURA Healthcare Service_login/button_Login') +WebUI.click(button_Login) +WebUI.delay(1) + +TestObject select_Facility = findTestObject('Page_CURA Healthcare Service_appointment/select_Facility') +WebUI.selectOptionByIndex(select_Facility, 0) +WebUI.delay(1) + +TestObject input_hospital_readm = findTestObject('Page_CURA Healthcare Service_appointment/input_Apply for hospital readm') +WebUI.click(input_hospital_readm) +WebUI.delay(1) + +TestObject input_Medicaid = findTestObject('Page_CURA Healthcare Service_appointment/input_Medicaid_programs') +WebUI.click(input_Medicaid) +WebUI.delay(1) + +TestObject input_Visit_Date = findTestObject('Page_CURA Healthcare Service_appointment/input_Visit Date (Required)_vi') +WebUI.setText(input_Visit_Date, '01/12/34') +WebUI.delay(1) + +TestObject textarea_comment = findTestObject('Page_CURA Healthcare Service_appointment/textarea_Comment_comment') +WebUI.setText(textarea_comment, 'This is a comment') +WebUI.delay(1) + +TestObject button_Book_Appointment = findTestObject('Page_CURA Healthcare Service_appointment/button_Book Appointment') +WebUI.click(button_Book_Appointment) +WebUI.delay(1) + +TestObject a_Go_to_Homepage = findTestObject('Page_CURA Healthcare Service_summary/a_Go to Homepage') +WebUI.click(a_Go_to_Homepage) +WebUI.delay(1) + +WebUI.closeBrowser() diff --git a/Scripts/TC1/Script1547070867765.groovy b/Scripts/TC1/Script1547070867765.groovy index de9e9d0..261d8f4 100644 --- a/Scripts/TC1/Script1547070867765.groovy +++ b/Scripts/TC1/Script1547070867765.groovy @@ -1,65 +1,80 @@ import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject -import com.kms.katalon.core.model.FailureHandling as FailureHandling +import com.kms.katalon.core.testobject.TestObject import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI +/** + * This script visits the page at https://katalon-demo-cura.herokuapp.com/ + * and the linked pages while highlighting elements with red border. + * This script repeats explicitly calling a custome keyword to put the highlight + * so that this script looks tedius. + */ + + + + // open browser and navigate to the AUT WebUI.openBrowser('') WebUI.setViewPortSize(1024, 768) WebUI.navigateToUrl('https://katalon-demo-cura.herokuapp.com/') WebUI.delay(1) -// highlight a specific element -CustomKeywords.'com.kazurayam.ksbackyard.HighlightElement.on'( - findTestObject('Page_CURA Healthcare Service_top/h1_CURA Healthcare Service')) -WebUI.delay(2) - -WebUI.comment("Hello, world") +TestObject a_MakeAppointment = findTestObject('Page_CURA Healthcare Service_top/a_Make Appointment') +WebUI.verifyElementPresent(a_MakeAppointment, 10) -// modify WebUI.* keywords which take TestObject as arg0 -// so that they call Highlight.on() automatically -CustomKeywords.'com.kazurayam.ksbackyard.HighlightElement.pandemic'() - -WebUI.click(findTestObject('Page_CURA Healthcare Service_top/a_Make Appointment')) +// highlight the element +CustomKeywords.'com.kazurayam.ksbackyard.HighlightElement.on'(a_MakeAppointment) +WebUI.click(a_MakeAppointment) WebUI.delay(1) -WebUI.setText(findTestObject('Page_CURA Healthcare Service_login/input_Username_username'), 'John Doe') +TestObject input_username = findTestObject('Page_CURA Healthcare Service_login/input_Username_username') +CustomKeywords.'com.kazurayam.ksbackyard.HighlightElement.on'(input_username) +WebUI.setText(input_username, 'John Doe') WebUI.delay(1) -WebUI.setEncryptedText(findTestObject('Page_CURA Healthcare Service_login/input_Password_password'), 'g3/DOGG74jC3Flrr3yH+3D/yKbOqqUNM') +TestObject input_password = findTestObject('Page_CURA Healthcare Service_login/input_Password_password') +CustomKeywords.'com.kazurayam.ksbackyard.HighlightElement.on'(input_password) +WebUI.setEncryptedText(input_password, 'g3/DOGG74jC3Flrr3yH+3D/yKbOqqUNM') WebUI.delay(1) -WebUI.click(findTestObject('Page_CURA Healthcare Service_login/button_Login')) +TestObject button_Login = findTestObject('Page_CURA Healthcare Service_login/button_Login') +CustomKeywords.'com.kazurayam.ksbackyard.HighlightElement.on'(button_Login) +WebUI.click(button_Login) WebUI.delay(1) -//WebUI.selectOptionByValue(findTestObject('Page_CURA Healthcare Service_appointment/select_Facility'), -// 'Hongkong CURA Healthcare Center', false) -//WebUI.delay(1) - -//WebUI.selectOptionByLabel(findTestObject('Page_CURA Healthcare Service_appointment/select_Facility'), -// 'Seoul CURA Healthcare Center', false) -//WebUI.delay(1) - -WebUI.selectOptionByIndex(findTestObject('Page_CURA Healthcare Service_appointment/select_Facility'), 0) +TestObject select_Facility = findTestObject('Page_CURA Healthcare Service_appointment/select_Facility') +CustomKeywords.'com.kazurayam.ksbackyard.HighlightElement.on'(select_Facility) +WebUI.selectOptionByIndex(select_Facility, 0) WebUI.delay(1) - -WebUI.click(findTestObject('Page_CURA Healthcare Service_appointment/input_Apply for hospital readm')) +TestObject input_hospital_readm = findTestObject('Page_CURA Healthcare Service_appointment/input_Apply for hospital readm') +CustomKeywords.'com.kazurayam.ksbackyard.HighlightElement.on'(input_hospital_readm) +WebUI.click(input_hospital_readm) WebUI.delay(1) -WebUI.click(findTestObject('Page_CURA Healthcare Service_appointment/input_Medicaid_programs')) +TestObject input_Medicaid = findTestObject('Page_CURA Healthcare Service_appointment/input_Medicaid_programs') +CustomKeywords.'com.kazurayam.ksbackyard.HighlightElement.on'(input_Medicaid) +WebUI.click(input_Medicaid) WebUI.delay(1) -WebUI.setText(findTestObject('Page_CURA Healthcare Service_appointment/input_Visit Date (Required)_vi'), '01/12/34') +TestObject input_Visit_Date = findTestObject('Page_CURA Healthcare Service_appointment/input_Visit Date (Required)_vi') +CustomKeywords.'com.kazurayam.ksbackyard.HighlightElement.on'(input_Visit_Date) +WebUI.setText(input_Visit_Date, '01/12/34') WebUI.delay(1) -WebUI.setText(findTestObject('Page_CURA Healthcare Service_appointment/textarea_Comment_comment'), 'This is a comment') +TestObject textarea_comment = findTestObject('Page_CURA Healthcare Service_appointment/textarea_Comment_comment') +CustomKeywords.'com.kazurayam.ksbackyard.HighlightElement.on'(textarea_comment) +WebUI.setText(textarea_comment, 'This is a comment') WebUI.delay(1) -WebUI.click(findTestObject('Page_CURA Healthcare Service_appointment/button_Book Appointment')) +TestObject button_Book_Appointment = findTestObject('Page_CURA Healthcare Service_appointment/button_Book Appointment') +CustomKeywords.'com.kazurayam.ksbackyard.HighlightElement.on'(button_Book_Appointment) +WebUI.click(button_Book_Appointment) WebUI.delay(1) -WebUI.click(findTestObject('Page_CURA Healthcare Service_summary/a_Go to Homepage')) +TestObject a_Go_to_Homepage = findTestObject('Page_CURA Healthcare Service_summary/a_Go to Homepage') +CustomKeywords.'com.kazurayam.ksbackyard.HighlightElement.on'(a_Go_to_Homepage) +WebUI.click(a_Go_to_Homepage) WebUI.delay(1) -WebUI.closeBrowser() \ No newline at end of file +WebUI.closeBrowser() diff --git a/Scripts/TC2/Script1547960621812.groovy b/Scripts/TC2/Script1547960621812.groovy index a9441e7..100b61b 100644 --- a/Scripts/TC2/Script1547960621812.groovy +++ b/Scripts/TC2/Script1547960621812.groovy @@ -1,65 +1,74 @@ import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject -import com.kms.katalon.core.model.FailureHandling as FailureHandling +import com.kms.katalon.core.testobject.TestObject import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI +/** + * This script visits the page at https://katalon-demo-cura.herokuapp.com/ + * and the linked pages while highlighting elements with red border. + * This script does the same as the TC1 but is much shorter. + * This script calls the `pandemic` method of the + * `com.kazurayam.ksbackyard.HighlightElement` class, + * which dynamically modifies the `WebUI.setText` and other built-in keywords + * using Groovy's Metaprogramming technique. + */ + // open browser and navigate to the AUT WebUI.openBrowser('') WebUI.setViewPortSize(1024, 768) WebUI.navigateToUrl('https://katalon-demo-cura.herokuapp.com/') WebUI.delay(1) -// highlight a specific element -CustomKeywords.'com.kazurayam.ksbackyard.HighlightElement.on'( - findTestObject('Page_CURA Healthcare Service_top/h1_CURA Healthcare Service')) -WebUI.delay(2) - - - -// modify WebUI.* keywords which take TestObject as arg0 -// so that they call Highlight.on() automatically +// pandemic() will modify some WebUI.* keywords so that they call +// com.kazurayam.ksbackyard.Highlight.on(testobject) +// automatically CustomKeywords.'com.kazurayam.ksbackyard.HighlightElement.pandemic'() -WebUI.click(findTestObject('Page_CURA Healthcare Service_top/a_Make Appointment'), FailureHandling.CONTINUE_ON_FAILURE) -WebUI.delay(1) +TestObject a_MakeAppointment = findTestObject('Page_CURA Healthcare Service_top/a_Make Appointment') +WebUI.verifyElementPresent(a_MakeAppointment, 10) -WebUI.setText(findTestObject('Page_CURA Healthcare Service_login/input_Username_username'), 'John Doe', FailureHandling.CONTINUE_ON_FAILURE) +// the target element for WebUI.click keyword will be highlighted +WebUI.click(a_MakeAppointment) WebUI.delay(1) -WebUI.setEncryptedText(findTestObject('Page_CURA Healthcare Service_login/input_Password_password'), 'g3/DOGG74jC3Flrr3yH+3D/yKbOqqUNM', FailureHandling.CONTINUE_ON_FAILURE) +TestObject input_username = findTestObject('Page_CURA Healthcare Service_login/input_Username_username') +WebUI.setText(input_username, 'John Doe') WebUI.delay(1) -WebUI.click(findTestObject('Page_CURA Healthcare Service_login/button_Login'), FailureHandling.CONTINUE_ON_FAILURE) +TestObject input_password = findTestObject('Page_CURA Healthcare Service_login/input_Password_password') +WebUI.setEncryptedText(input_password, 'g3/DOGG74jC3Flrr3yH+3D/yKbOqqUNM') WebUI.delay(1) -//WebUI.selectOptionByValue(findTestObject('Page_CURA Healthcare Service_appointment/select_Facility'), -// 'Hongkong CURA Healthcare Center', false) -//WebUI.delay(1) - -//WebUI.selectOptionByLabel(findTestObject('Page_CURA Healthcare Service_appointment/select_Facility'), -// 'Seoul CURA Healthcare Center', false) -//WebUI.delay(1) - -WebUI.selectOptionByIndex(findTestObject('Page_CURA Healthcare Service_appointment/select_Facility'), 0, FailureHandling.CONTINUE_ON_FAILURE) +TestObject button_Login = findTestObject('Page_CURA Healthcare Service_login/button_Login') +WebUI.click(button_Login) WebUI.delay(1) +TestObject select_Facility = findTestObject('Page_CURA Healthcare Service_appointment/select_Facility') +WebUI.selectOptionByIndex(select_Facility, 0) +WebUI.delay(1) -WebUI.click(findTestObject('Page_CURA Healthcare Service_appointment/input_Apply for hospital readm'), FailureHandling.CONTINUE_ON_FAILURE) +TestObject input_hospital_readm = findTestObject('Page_CURA Healthcare Service_appointment/input_Apply for hospital readm') +WebUI.click(input_hospital_readm) WebUI.delay(1) -WebUI.click(findTestObject('Page_CURA Healthcare Service_appointment/input_Medicaid_programs'), FailureHandling.CONTINUE_ON_FAILURE) +TestObject input_Medicaid = findTestObject('Page_CURA Healthcare Service_appointment/input_Medicaid_programs') +WebUI.click(input_Medicaid) WebUI.delay(1) -WebUI.setText(findTestObject('Page_CURA Healthcare Service_appointment/input_Visit Date (Required)_vi'), '01/12/34', FailureHandling.CONTINUE_ON_FAILURE) +TestObject input_Visit_Date = findTestObject('Page_CURA Healthcare Service_appointment/input_Visit Date (Required)_vi') +WebUI.setText(input_Visit_Date, '01/12/34') WebUI.delay(1) -WebUI.setText(findTestObject('Page_CURA Healthcare Service_appointment/textarea_Comment_comment'), 'This is a comment', FailureHandling.CONTINUE_ON_FAILURE) +TestObject textarea_comment = findTestObject('Page_CURA Healthcare Service_appointment/textarea_Comment_comment') +WebUI.setText(textarea_comment, 'This is a comment') WebUI.delay(1) -WebUI.click(findTestObject('Page_CURA Healthcare Service_appointment/button_Book Appointment'), FailureHandling.CONTINUE_ON_FAILURE) +TestObject button_Book_Appointment = findTestObject('Page_CURA Healthcare Service_appointment/button_Book Appointment') +WebUI.click(button_Book_Appointment) WebUI.delay(1) -WebUI.click(findTestObject('Page_CURA Healthcare Service_summary/a_Go to Homepage'), FailureHandling.CONTINUE_ON_FAILURE) +TestObject a_Go_to_Homepage = findTestObject('Page_CURA Healthcare Service_summary/a_Go to Homepage') +WebUI.click(a_Go_to_Homepage) WebUI.delay(1) -WebUI.closeBrowser() \ No newline at end of file +WebUI.closeBrowser() diff --git a/Test Cases/TC0.tc b/Test Cases/TC0.tc new file mode 100644 index 0000000..cef7825 --- /dev/null +++ b/Test Cases/TC0.tc @@ -0,0 +1,9 @@ + + + + TC0 + + + OTHER + 78b3ca65-5cb5-4a9e-b949-e19dbccff62a + diff --git a/Test Cases/TC1.tc b/Test Cases/TC1.tc index 56b9bf9..97be4dc 100644 --- a/Test Cases/TC1.tc +++ b/Test Cases/TC1.tc @@ -4,5 +4,6 @@ TC1 + OTHER d58ff4fd-fb65-4bf0-aa81-58c745a3616b diff --git a/Test Cases/TC2.tc b/Test Cases/TC2.tc index 7422a6b..3ab0cad 100644 --- a/Test Cases/TC2.tc +++ b/Test Cases/TC2.tc @@ -4,5 +4,6 @@ TC2 + OTHER db7cf54b-ae6d-4f6b-924e-1cb8667c0d91