blob: c125664f98c9e02109a5bb1dfcad6b296fd358ac [file] [log] [blame]
yadavmr58af6b12019-09-18 15:33:25 +05301# -*- coding: utf-8 -*-
2
3##
4# Copyright 2019 Tech Mahindra Limited
5#
6# All Rights Reserved.
7#
8# Licensed under the Apache License, Version 2.0 (the "License"); you may
9# not use this file except in compliance with the License. You may obtain
10# a copy of the License at
11#
12# http://www.apache.org/licenses/LICENSE-2.0
13#
14# Unless required by applicable law or agreed to in writing, software
15# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
16# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
17# License for the specific language governing permissions and limitations
18# under the License.
19##
20
21## Change log:
22# 1. Feature 7829: Jayant Madavi, Mrityunjay Yadav : MY00514913@techmahindra.com : 06-aug-2019 : Improvement to the code, robot framework initial seed code.
23##
24
25
26*** Variables ***
27${DESIRED_CAPABILITIES} desired_capabilities
28${BROWSER} Chrome
29${DELAY} 0
30${VALID USER} admin
31${VALID PASSWORD} admin
32${LOGIN URL} /auth/
33${WELCOME URL} /projects/
34${NS LIST URL} /packages/ns/list
35${VNF LIST URL} /packages/vnf/list
36
37
38*** Keywords ***
39Set Server URL
40 ${env_host}= Get Environment Variable OSM_HOSTNAME
41 ${passed}= Run Keyword And Return Status Should Contain ${env_host} :
42 Run Keyword If ${passed} Set Dockerized Host
43 ... ELSE Set Standalone Host ${env_host}
44
45
46Open Browser To Login Page
47 ${chrome_options} = Evaluate sys.modules['selenium.webdriver'].ChromeOptions() sys, selenium.webdriver
48 Call Method ${chrome_options} add_argument headless
49 Call Method ${chrome_options} add_argument disable-gpu
50 Call Method ${chrome_options} add_argument no-sandbox
51 ${options}= Call Method ${chrome_options} to_capabilities
52 Open Browser ${SERVER}${LOGIN URL} ${BROWSER} desired_capabilities=${options}
53 Maximize Browser Window
54 Set Selenium Speed ${DELAY}
55 Login Page Should Be Open
56
57
58Login Page Should Be Open
59 Element Text Should Be //*[@id="main_content"]/div/div[2]/p Sign in to start your session
60
61
62Enter Credentials
63 [Arguments] ${username} ${password}
64 Input Text name:username ${username}
65 Input Password name:password ${password}
66
67
68Submit Credentials
69 Click Button //*[@id="main_content"]/div/div[2]/form/div[3]/div[2]/button
70
71
72Home Page Should Be Open
73 Location Should Be ${SERVER}${WELCOME URL}
74# Element Should Contain id:title_header 6e3a8415-9014-4100-9727-90e0150263be ignore_case=True
75 Element Attribute Value Should Be //*[@id="main_content"]/div/div[2]/div[1]/div[1]/div/a href ${SERVER}${NS LIST URL}
76 Element Attribute Value Should Be //*[@id="main_content"]/div/div[2]/div[1]/div[2]/div/a href ${SERVER}${VNF LIST URL}
77
78
79Set Dockerized Host
80
81 Set Suite Variable ${SERVER} http://light-ui
82
83
84Set Standalone Host
85 [Arguments] ${env_host}
86
87 Set Suite Variable ${SERVER} http://${env_host}