-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnewQuery.py
More file actions
100 lines (78 loc) · 3 KB
/
newQuery.py
File metadata and controls
100 lines (78 loc) · 3 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
@import time
from selenium.webdriver.common.by import By
from behave import *
from selenium import webdriver
from selenium.common.exceptions import WebDriverException
@given(u'Chrome Browser is opened')
def openBrowser(context):
context.driver = webdriver.Chrome(executable_path='C:\chromedriver_win32\chromedriver.exe')
@when(u'I open url http://localhost:3000/')
def openMetaBase(context):
context.driver.maximize_window()
try:
context.driver.get("http://localhost:3000/")
except WebDriverException:
context.driver.close()
print("Cannot Open Metabase")
time.sleep(1)
@when(u'I Enter email {Email}')
def enterEmail(context, Email):
try:
context.driver.find_element(By.XPATH, '//*[@id="formField-username"]/div[2]/div/input').send_keys(Email)
except:
print("Cannot write email")
time.sleep(1)
@when(u'I Enter password {Password}')
def enterPass(context, Password):
try:
context.driver.find_element(By.XPATH, '//*[@id="formField-password"]/div[2]/div/input').send_keys(Password)
except:
print("Cannot write pass")
time.sleep(1)
@when(u'I click Login Button')
def button(context):
try:
context.driver.find_element(By.XPATH, '//*[@id="root"]/div/div/main/div/div[2]/div/div[2]/div/form/div[4]/button').click()
except:
print("Cannot click button")
time.sleep(4)
@then(u'I am logged in')
def loggedIn(context):
try:
check = context.driver.find_element(By.XPATH, '//*[@id="root"]/div/div/aside/nav/div/div/ul/div/div').text
except:
context.driver.close()
assert False, "Test Failed, Invalid"
if check == "DATA":
assert True, "Test Passed"
@given(u'Data section is visible')
def dataVisible(context):
try:
check = context.driver.find_element_by_xpath( "//h4[contains(text(),'Data')]").is_displayed();
except:
context.driver.close()
print ("Collections not visible")
if check == "COLLECTIONS":
print("Collections visible")
time.sleep(1)
@when(u'I click on browse data')
def step_impl(context):
raise NotImplementedError(u'STEP: When I click on browse data')
@when(u'I select the database "Sample Database"')
def step_impl(context):
raise NotImplementedError(u'STEP: When I select the database "Sample Database"')
@when(u'click on new button')
def step_impl(context):
raise NotImplementedError(u'STEP: When click on new button')
@when(u'I select new query')
def step_impl(context):
raise NotImplementedError(u'STEP: When I select new query')
@when(u'I enter the new query "<query>"')
def step_impl(context):
raise NotImplementedError(u'STEP: When I enter the new query "<query>"')
@when(u'i click on run icon')
def step_impl(context):
raise NotImplementedError(u'STEP: When i click on run icon')
@then(u'the query is executed')
def step_impl(context):
raise NotImplementedError(u'STEP: Then the query is executed')