-
Notifications
You must be signed in to change notification settings - Fork 1
/
test_main_customer.py
62 lines (52 loc) · 2.37 KB
/
test_main_customer.py
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
# Generated by Selenium IDE
import pytest
import time
import json
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.support import expected_conditions
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.common.keys import Keys
class TestMaintest():
def setup_method(self):
self.driver = webdriver.Chrome()
#self.driver.setSpeed(2000);
self.vars = {}
def teardown_method(self):
self.driver.quit()
def loginpositivecustomer(self):
self.driver.get("http://localhost:5000/")
self.driver.find_element(By.LINK_TEXT, "Sign In").click()
self.driver.find_element(By.ID, "name").send_keys("abiali")
self.driver.find_element(By.ID, "passw").send_keys("root")
self.driver.find_element(By.NAME, "proceed").click()
def test_payment(self):
self.driver.find_element(By.ID, "third").click()
self.driver.find_element(By.NAME, "debit").click()
self.driver.find_element(By.ID, "card_no").click()
self.driver.find_element(By.XPATH, "//*[@id=\"horizontalTab\"]/div[2]/div[3]/div/form/div[2]/div/label/i").click()
self.driver.find_element(By.ID, "submit").click()
def test_booking(self):
self.driver.find_element(By.NAME, "userId").send_keys("abiali")
dropdown = self.driver.find_element(By.ID, "cab")
dropdown.find_element(By.XPATH, "//option[. = 'Sedan Cab(5 Seater)']").click()
self.driver.find_element(By.NAME, "startDate").send_keys("28/9/2019")
self.driver.find_element(By.NAME, "endDate").send_keys("29/9/2019")
self.driver.find_element(By.NAME, "time").send_keys("8:00")
dropdown = self.driver.find_element(By.NAME, "route")
dropdown.find_element(By.XPATH, "//option[. = 'Nashik-Pune(211 KM)']").click()
self.driver.find_element(By.NAME, "pickupLocation").send_keys("mumbai naka")
self.driver.find_element(By.NAME, "dropoffLocation").send_keys("kondwa")
self.driver.find_element(By.ID, "submit").click()
def test_invoice(self):
self.driver.find_element(By.XPATH, "/html/body/div[1]/form/div[3]/center/h2/nav/a").click()
def test_maintest(self):
self.loginpositivecustomer()
self.test_booking()
self.test_payment()
self.test_invoice()
main=TestMaintest()
main.setup_method()
main.test_maintest()
main.teardown_method()