-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
188 lines (142 loc) · 7.17 KB
/
main.py
File metadata and controls
188 lines (142 loc) · 7.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
import time
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as ec
from selenium.webdriver.common.by import By
import config
def main():
driver = config.set_test_web_driver()
driver.get(config.BASE_URL)
# Request Form
# Fill out the required fields with data from config and submit
WebDriverWait(driver,
config.CLICKABLE_WAIT_TIME).until(ec.element_to_be_clickable((By.ID, "name"))).send_keys(
config.REQUEST_FORM_NAME)
WebDriverWait(driver,
config.CLICKABLE_WAIT_TIME).until(ec.element_to_be_clickable((By.ID, "type"))).send_keys(
config.REQUEST_FORM_TYPE)
WebDriverWait(driver,
config.CLICKABLE_WAIT_TIME).until(ec.element_to_be_clickable((By.ID, "business_unit"))).send_keys(
config.REQUEST_FORM_BUSINESS_UNIT)
driver.find_element(By.ID, 'submit').click()
time.sleep(config.LOAD_WAIT_TIME)
# General Information Form
WebDriverWait(driver,
config.CLICKABLE_WAIT_TIME).until(ec.element_to_be_clickable((By.ID, "username"))).send_keys(
config.GENERAL_FORM_USERNAME)
WebDriverWait(driver,
config.CLICKABLE_WAIT_TIME).until(ec.element_to_be_clickable((By.ID, "requesters_email"))).send_keys(
config.GENERAL_FORM_REQUESTERS_EMAIL)
WebDriverWait(driver,
config.CLICKABLE_WAIT_TIME).until(ec.element_to_be_clickable((By.ID, "managers_email"))).send_keys(
config.GENERAL_FORM_MANAGERS_EMAIL)
WebDriverWait(driver,
config.CLICKABLE_WAIT_TIME).until(ec.element_to_be_clickable((By.ID, "business_unit"))).send_keys(
config.GENERAL_FORM_TEAM_DL)
# WebDriverWait(driver,
# config.CLICKABLE_WAIT_TIME).until(ec.element_to_be_clickable((By.ID, "team_dl"))).send_keys(
# config.GENERAL_FORM_TEAM_DL)
# WebDriverWait(driver,
# config.CLICKABLE_WAIT_TIME).until(ec.element_to_be_clickable((By.ID, "business_unit"))).send_keys(
# config.GENERAL_FORM_BUSINESS_UNIT)
driver.find_element(By.ID, 'submit').click()
time.sleep(config.LOAD_WAIT_TIME)
# Process Information Form
description = ''
use_case = ''
WebDriverWait(driver,
config.CLICKABLE_WAIT_TIME).until(ec.element_to_be_clickable((By.ID, "description"))).send_keys(
description)
WebDriverWait(driver,
config.CLICKABLE_WAIT_TIME).until(ec.element_to_be_clickable((By.ID, "use_case"))).send_keys(
use_case)
WebDriverWait(driver,
config.CLICKABLE_WAIT_TIME).until(ec.element_to_be_clickable((By.ID, "frequency"))).click()
# Select daily from dropdown
WebDriverWait(driver,
config.CLICKABLE_WAIT_TIME).until(ec.element_to_be_clickable((By.ID, "environment"))).click()
# Select GCP from dropdown
WebDriverWait(driver,
config.CLICKABLE_WAIT_TIME).until(ec.element_to_be_clickable((By.ID, "Calendar"))).click()
# Interact with calendar and select current date
driver.find_element(By.ID, 'submit').click()
time.sleep(config.LOAD_WAIT_TIME)
# BigQuery Code Form
ddl_sql = ''
ddm_sql = ''
uc4_chain_dependency = ''
WebDriverWait(driver,
config.CLICKABLE_WAIT_TIME).until(ec.element_to_be_clickable((By.ID, "Data Definition"))).send_keys(
ddl_sql)
WebDriverWait(driver,
config.CLICKABLE_WAIT_TIME).until(ec.element_to_be_clickable((By.ID, "Data Manipulation"))).send_keys(
ddm_sql)
WebDriverWait(driver,
config.CLICKABLE_WAIT_TIME).until(ec.element_to_be_clickable((By.ID, "Chain Dependency"))).send_keys(
uc4_chain_dependency)
driver.find_element(By.ID, 'submit').click()
time.sleep(config.LOAD_WAIT_TIME)
# Table Dependency Menu
final_table = ''
WebDriverWait(driver,
config.CLICKABLE_WAIT_TIME).until(ec.element_to_be_clickable((By.ID, "Verify Databases"))).click()
WebDriverWait(driver,
config.CLICKABLE_WAIT_TIME).until(ec.element_to_be_clickable((By.ID, final_table))).click()
driver.find_element(By.ID, 'submit').click()
time.sleep(config.LOAD_WAIT_TIME)
# Toggle Admin mode
WebDriverWait(driver,
config.CLICKABLE_WAIT_TIME).until(ec.element_to_be_clickable((By.ID, "Admin Mode"))).click()
# Wait until 'Status' field reads READY TO DEPLOY
# Click 'More Options' or the three dot menu
WebDriverWait(driver,
config.CLICKABLE_WAIT_TIME).until(ec.element_to_be_clickable((By.ID, "More Options"))).click()
# Click on 'Open Deployment Dashboard' from dropdown
WebDriverWait(driver,
config.CLICKABLE_WAIT_TIME).until(
ec.element_to_be_clickable((By.ID, "Open Deployment Dashboard"))).click()
# Press Commit/Persist to GitHub button
WebDriverWait(driver,
config.CLICKABLE_WAIT_TIME).until(ec.element_to_be_clickable((By.ID, "Commit"))).send_keys(
)
# Wait for Hash to be presented to confirm git operation
# Choose the appropriate 'DALM app'
WebDriverWait(driver,
config.CLICKABLE_WAIT_TIME).until(ec.element_to_be_clickable((By.ID, "DALM app"))).click()
# Select correct option from dropdown
# Click the 'Create DALM tickets' button
WebDriverWait(driver,
config.CLICKABLE_WAIT_TIME).until(
ec.element_to_be_clickable((By.ID, "Create DALM tickets"))).send_keys()
# Click on Adhoc link
WebDriverWait(driver,
config.CLICKABLE_WAIT_TIME).until(ec.element_to_be_clickable((By.ID, "Ad Hoc Link"))).click()
# Wait for Manifest status == Available
# click Run Component button
WebDriverWait(driver,
config.CLICKABLE_WAIT_TIME).until(ec.element_to_be_clickable((By.ID, "Run Component"))).click()
# Select Production in the popup menu
WebDriverWait(driver,
config.CLICKABLE_WAIT_TIME).until(ec.element_to_be_clickable((By.ID, "Production"))).click()
# Select the correct manifest ID
WebDriverWait(driver,
config.CLICKABLE_WAIT_TIME).until(ec.element_to_be_clickable((By.ID, "Manifest ID"))).click()
# Is this a menu? Popup?
# click run
WebDriverWait(driver,
config.CLICKABLE_WAIT_TIME).until(ec.element_to_be_clickable((By.ID, "Run"))).click()
# When 'Status' field reads 'COMPLETED'
# Go to UC4 workflow Link
WebDriverWait(driver,
config.CLICKABLE_WAIT_TIME).until(ec.element_to_be_clickable((By.ID, "UC4 Workflow Link"))).click()
# Click on the Run button.
WebDriverWait(driver,
config.CLICKABLE_WAIT_TIME).until(ec.element_to_be_clickable((By.ID, "Run"))).click()
# Select Batch Date from pop up
WebDriverWait(driver,
config.CLICKABLE_WAIT_TIME).until(ec.element_to_be_clickable((By.ID, "Batch Date"))).click()
# Select Correct option the resulting popup
# Click Run Workflow
WebDriverWait(driver,
config.CLICKABLE_WAIT_TIME).until(ec.element_to_be_clickable((By.ID, "Run Workflow"))).click()
if __name__ == "__main__":
main()