|
15 | 15 | Email = MailVar.join(PartEmail)
|
16 | 16 |
|
17 | 17 | start = time.time()
|
18 |
| -driver.find_element_by_xpath('/html/body/section[1]/div/div/div[1]/div/a[1]').click() |
19 | 18 |
|
| 19 | +##############Tworzenie konta gitprotect |
| 20 | +driver.find_element_by_xpath('/html/body/section[1]/div/div/div[1]/div/a[1]').click() |
20 | 21 | firma = driver.find_element_by_name("login")
|
21 | 22 | firma.send_keys(Email)
|
22 | 23 | mail = driver.find_element_by_name("password")
|
23 | 24 | mail.send_keys("1Q2w3e4r.")
|
24 | 25 | phone = driver.find_element_by_name("companyName")
|
25 | 26 | phone.send_keys("Xopero")
|
26 |
| - |
27 | 27 | driver.find_element_by_xpath("//*[contains(text(),'Start now')]").click()
|
28 |
| -time.sleep(120) |
| 28 | + |
| 29 | +tworzenieKonta = 0 |
| 30 | +while driver.current_url == "https://gitprotect.io/sign-up.html": |
| 31 | + time.sleep(5) |
| 32 | + tworzenieKonta+=5 |
| 33 | + print("Konto tworzy się", tworzenieKonta,"sekund") |
29 | 34 | title = driver.current_url
|
30 | 35 | print(title)
|
31 | 36 |
|
| 37 | + |
| 38 | +############logowanie GIT |
32 | 39 | time.sleep(1)
|
33 | 40 | driver.get("https://github.com/")
|
34 | 41 | time.sleep(2)
|
35 | 42 | driver.find_element_by_xpath("//*[contains(text(),'Sign in')]").click()
|
36 | 43 | time.sleep(2)
|
37 | 44 | GH = driver.find_element_by_name("login")
|
38 |
| -GH.send_keys("czarnyzbrazers") |
| 45 | + |
39 | 46 | PASY = driver.find_element_by_name("password")
|
40 |
| -PASY.send_keys("Test_123.") |
| 47 | +PASY.send_keys("Plokijuh1.") |
41 | 48 | driver.find_element_by_name("commit").click()
|
42 | 49 | time.sleep(1)
|
43 | 50 | driver.get(title)
|
44 | 51 |
|
45 | 52 | ######Dodawanie organizacji GIT
|
46 | 53 | try:
|
47 |
| - time.sleep(1) |
| 54 | + time.sleep(3) |
48 | 55 | driver.find_element_by_xpath('/html/body/app-root/app-main/app-first-run-container/app-first-run/section/div[2]/article[2]/button').click() #wybór git do utworzenia
|
49 |
| - time.sleep(1) |
| 56 | + time.sleep(10) |
50 | 57 | driver.find_element_by_xpath("/html/body/app-root/app-main/div/app-content/div[1]/aside/app-aside/ng-component/app-git-organization/div/div[5]/app-save-button/button").click() #zatwierdzenie tworzenia git
|
51 |
| - time.sleep(20) |
52 | 58 | print("Dodano organizację GitHub")
|
| 59 | + #try: |
| 60 | + time.sleep(3) |
| 61 | + driver.find_element_by_xpath("/html/body/app-root/app-main/div/app-content/main/div/ng-component/app-organizations/ng-containter/app-organization-container/app-organization/section/article/app-simplified-backup-plans/div/div/div/button/span[1]").click() |
| 62 | + time.sleep(3) |
| 63 | + driver.find_element_by_xpath("//*[contains(text(),'Git Protection')]").click() |
| 64 | + # time.sleep(2) |
| 65 | + print("Dodano plan do organizacji GIT") |
53 | 66 | try:
|
54 |
| - time.sleep(2) |
55 |
| - driver.find_element_by_xpath("//*[contains(text(),'Protect now')]").click() |
56 |
| - time.sleep(2) |
57 |
| - driver.find_element_by_xpath("//*[contains(text(),'Git Protection')]").click() |
58 |
| - # time.sleep(2) |
59 |
| - print("Dodano plan do organizacji GIT") |
60 |
| - try: |
61 |
| - driver.find_element_by_xpath("//*[contains(text(),'Start now')]").click() |
62 |
| - print("Uruchomiono plan backapu GIT") |
63 |
| - except: |
64 |
| - print ("Błąd uruchamiania planu GIT") |
65 |
| - time.sleep(2) |
| 67 | + time.sleep(1) |
| 68 | + driver.find_element_by_xpath("//*[contains(text(),'Start now')]").click() |
| 69 | + print("Uruchomiono plan backapu GIT") |
66 | 70 | except:
|
| 71 | + print ("Błąd uruchamiania planu GIT") |
| 72 | + time.sleep(2) |
| 73 | + #except: |
67 | 74 | print("Nie Udało się dodać planu do organizacji GIT")
|
68 | 75 | except:
|
69 | 76 | print("Nie udało się dodać organizacji GIT")
|
|
92 | 99 |
|
93 | 100 | driver.find_element_by_xpath("//*[contains(text(),'Tasks')]").click() #wybór zadań
|
94 | 101 |
|
| 102 | +#kontrola zakończenia zadania backup |
| 103 | +try: |
| 104 | + x = True |
| 105 | + while x: |
| 106 | + if driver.find_element_by_id('mat-badge-content-15').is_displayed(): |
| 107 | + time.sleep(5) |
| 108 | + print("Buckup w trakcie wykonywania") |
| 109 | + else: |
| 110 | + x = False |
| 111 | + driver.find_element_by_xpath("//*[contains(text(),'Last 24 hours')]").click() #wybór wykonanych zadań |
| 112 | + time.sleep(10) |
| 113 | + #Kontrola przywróconych backupów |
| 114 | + driver.find_element_by_xpath('/html/body/app-root/app-main/app-menu/section/nav[1]/a[2]').click() |
| 115 | + #time.sleep(30) |
| 116 | + for i in range(1,11): |
| 117 | + driver.find_element_by_xpath("/html/body/app-root/app-main/div/app-content/main/div/ng-component/app-repositories/article/app-table/cdk-virtual-scroll-viewport/div[1]/table/tbody/tr[%d]/td[7]/button[2]/span[1]" %(i)).click() |
| 118 | + time.sleep(5) |
| 119 | + try: |
| 120 | + driver.find_element_by_xpath("//*[contains(text(),'View available plans, then select the backup copy to restore')]").is_displayed() |
| 121 | + print("Brak planu backup") |
| 122 | + except: |
| 123 | + print("Plan backup dostępny") |
| 124 | +except: |
| 125 | + print("coś nie pykło") |
| 126 | + |
95 | 127 |
|
96 | 128 | stop = time.time()
|
97 | 129 | Worktime = stop-start
|
|
0 commit comments