1

I am in my starting phase of Karate for UI automation(0.9.6). I have already implemented API automation using Karate framework and it works smoothly.

My use case: I want to use one feature file just for the authentication of my web page and same can be called in another feature file which is for the new UI page that opens up.

Feature file 1:
Background:
    * def config = read('classpath:First/config.json')
    * def link = 'https://' + config.CONFIG_EVENT_DEST + ':' + config.CONFIG_WEBSERVER_PORTS
    * print link
    * url link
    
Scenario: Opening CG webpage

#By-passing SSL Validation  
    * configure driver = { type: 'chrome' , addOptions: ['--ignore-certificate-errors', '--incognito'] }
    And print 'Starting the UI automation'
    Given driver 'https://' + config.Cgserver_IP + ':' + config.CONFIG_WEBSERVER_PORTS
    And delay(2000).waitUntil('#username')
    And input('#username','admin')
    And delay(2000).waitFor('#password')
    And input('#password',config.CONFIG_ADMIN_PASSWORD)
#Clicking the Login button  
    And click("body > app-root > app-login-page > ux-login > div > div.panel-container > div.form-panel > form > div.form-group.text-right > button")

#Clicking Agents tab and then Manage tab    
    And retry(3,500).waitFor('body > app-root > app-home > div.page-header-padding > app-masthead > ux-page-header > div.ux-page-header > div > div.page-header-navigation.center > ux-page-header-horizontal-navigation > ux-page-header-horizontal-navigation-item:nth-child(3) > button').click()
    #And click('body > app-root > app-home > div.page-header-padding > app-masthead > ux-page-header > div.ux-page-header > div > div.page-header-navigation.center > ux-page-header-horizontal-navigation > ux-page-header-horizontal-navigation-item:nth-child(3) > button')  
    When retry(4,500).waitFor('#ux-tab-4').click()

Here is my second feature file where i need the session to be alive

Feature file 2:
Scenario: New page
    * driver link + '/cg-api/ams/index.htm#/assets'

Appreciate your help in advance. !!

0 Answers0