Skip to content
Open
Show file tree
Hide file tree
Changes from 15 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.iso filter=lfs diff=lfs merge=lfs -text
35 changes: 35 additions & 0 deletions .github/workflows/python-package-conda.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Python Package using Conda

on: [push]

jobs:
build-linux:
runs-on: ubuntu-latest

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

33

strategy:
max-parallel: 5
ziemniak: pyrka

steps:
- uses: actions/checkout@v2
- name: Set up Python 3.10

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a

Comment on lines +12 to +14

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aa

uses: actions/setup-python@v2
with:
python-version: 3.10
- name: Add conda to system path
run: |
# $CONDA is an environment variable pointing to the root of the miniconda directory
echo $CONDA/bin >> $GITHUB_PATH
- name: Install dependencies
run: |
conda env update --file environment.yml --name base
Comment on lines +19 to +24

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

b

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bb

- name: Lint with flake8
run: |
conda install flake8
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
conda install pytest
pytest
36 changes: 36 additions & 0 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: Upload Python Package

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

c

on:
release:
types: [published]

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ccc

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fit


Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

d

jobs:
deploy:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: python -m build
- name: Publish package
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
3 changes: 3 additions & 0 deletions File50MB.7z.iso
Git LFS file not shown
28 changes: 28 additions & 0 deletions FileBackUp/Main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#region Imports
import sideTasks
import fileBackupPath
import fileRestore
import pathBackup
import systemVariable
import xoperoVariable
import time
from selenium import webdriver
#endregion

PATH = "D:\chromedriver.exe"
driver = webdriver.Chrome(PATH) # or ...Chrome(executable_path=sciezka)

sideTasks.logowanie(driver)

fileBackupPath.fileBackupCLD(driver,"fileBackup")
pathBackup.pathBackup(driver,"By Path","E:\\abecadlo")

xoperoVariables = ["HOMES","USERS_DOCUMENTS","USERS_DESKTOP","USERS_DOWNLOADS"]
for variable in xoperoVariables:
planName = 'Zmienna %s' %(variable)
xoperoVariable.xoperoVar(driver,planName,variable)
time.sleep(1)

systemVariable.systemVar(driver,"System Var","smieci")

fileRestore.FileRestore_Cloud(driver,"Xopero Storage #1 (XoperoOneEmea)","fileBackup")
Binary file not shown.
Binary file added FileBackUp/__pycache__/fileRestore.cpython-39.pyc
Binary file not shown.
Binary file not shown.
Binary file added FileBackUp/__pycache__/sideTasks.cpython-39.pyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
60 changes: 60 additions & 0 deletions FileBackUp/fileBackupPath.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import supportTask

from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.relative_locator import locate_with
import time

def fileBackupCLD(driver,planName):
driver.implicitly_wait(5)
driver.find_element(By.XPATH,"//*[contains(text(),'Plans')]").click()
driver.find_element(By.XPATH,"//*[contains(text(),'Add plan')]").click()

driver.find_element(By.NAME,"backupPlanName").clear()
driver.find_element(By.NAME,"backupPlanName").send_keys("%s" %(planName))

driver.find_element(By.XPATH,"//*[contains(text(),'How to protect')]").click()
driver.find_element(By.XPATH,"//*[contains(text(),'File-level')]").click()
driver.find_element(By.XPATH,"//*[contains(text(),'Which devices?')]").click()

mainDevice = driver.find_element(By.XPATH,"//span[text()='Main']/../../..")
mainDevice.find_element(By.CLASS_NAME, "mat-checkbox").click()

driver.find_element(By.XPATH,"//*[contains(text(),'Apply')]").click()
driver.find_element(By.XPATH,"//*[contains(text(),'What to protect?')]").click()

driver.find_element(By.XPATH,'/html/body/app-root/app-main/div/app-content/div[1]/aside[2]/app-aside/ng-component/app-add-rule/div/div[3]/div[2]/div[2]/div/h3').click()


folderTree = driver.find_element(By.XPATH,"/html/body/app-root/app-main/div/app-content/div[1]/aside[3]/app-aside/ng-component/app-add-device-rule/div/div[2]/app-files-browser/app-files/ul")
y = R"D:\pliki\jsony jira" ##<--- wstaw ścieżkę backupu
y=y.replace(":","")
backupPath = y.split("\\")
fileName = backupPath.pop(-1)

for folder in backupPath:
folderName = folderTree.find_element(By.XPATH,"//span[text()='%s']/../.." %(folder))
folderName.find_element(By.CSS_SELECTOR,"svg[data-icon='plus']").click()

fileNameElem = folderTree.find_element(By.XPATH,"//*[contains(text(),'%s')]" %(fileName))
driver.find_element(locate_with(By.CLASS_NAME, "mat-checkbox-layout").to_left_of(fileNameElem)).click()

driver.find_element(By.XPATH,"/html/body/app-root/app-main/div/app-content/div[1]/aside[3]/app-aside/ng-component/app-add-device-rule/div/div[3]/button/span[1]").click()
driver.find_element(By.XPATH,"//*[contains(text(),'Apply')]").click()

driver.find_element(By.XPATH,"//*[contains(text(),'Where to store?')]").click()
time.sleep(1)
driver.find_element(By.XPATH,"//*[contains(text(),'Xopero Storage')]").click()

driver.find_element(By.XPATH,"//*[contains(text(),'When?')]").click()
startAt = driver.find_element(By.XPATH,'/html/body/app-root/app-main/div/app-content/div[1]/aside[2]/app-aside/ng-component/app-add-schedule/form/div[3]/div/mat-accordion/mat-expansion-panel[1]/div/div/app-monthly/div/mat-radio-group/div/div[2]/app-time/mat-form-field/div/div[1]/div/input')
startAt.send_keys('1111')
driver.find_element(By.XPATH,"//*[contains(text(),'Next')]").click()
driver.find_element(By.XPATH,"//button[@type='submit']").click()

driver.find_element(By.XPATH,"//*[contains(text(),'Save&Run')]").click()

return



67 changes: 67 additions & 0 deletions FileBackUp/fileRestore.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.support.relative_locator import locate_with
from selenium.webdriver.common.action_chains import ActionChains
import time

def FileRestore_Cloud(driver,storage,backupName):
driver.implicitly_wait(5)

driver.find_element(By.XPATH,'/html/body/app-root/app-main/app-menu/section/nav[1]/a[6]/span[2]').click()

time.sleep(3)
location = driver.find_element(By.XPATH,"//*[contains(text(),'%s')]" %(storage)) ##<--- wstaw nazwę magazynu, z którego chcesz przywracać
parentLocation1 = location.find_element(By.XPATH,'./../..')
parentLocation1.find_element(By.CLASS_NAME, "mat-button-wrapper").click()

driver.find_element(By.XPATH,"//*[contains(text(),'Select resource')]").click()
driver.find_element(By.XPATH,'/html/body/app-root/app-main/div/app-content/div[1]/aside[2]/app-aside/ng-component/app-select-worker/div/div[2]/app-filters-table/button').click()
x = driver.find_element(By.XPATH,'/html/body/app-root/app-main/div/app-content/div[1]/aside[2]/app-aside/ng-component/app-select-worker/div/div[2]/app-filters-table/form/div/app-filters/app-filter-input/input')
x.send_keys('STASIAK-M')

time.sleep(2)
driver.find_element(By.XPATH,"//*[contains(text(),'Apply')]").click()
time.sleep(2)
driver.find_element(By.XPATH,"/html/body/app-root/app-main/div/app-content/div[1]/aside[2]/app-aside/ng-component/app-select-worker/div/div[3]/div/div/div/div").click()
time.sleep(1)

try:
driver.find_element(By.XPATH,"//*[contains(text(),'View available plans')]").is_displayed()
driver.find_element(By.XPATH,"/html/body/app-root/app-main/div/app-content/div[1]/aside/app-aside/ng-component/app-resource-backups/div/div[3]/ng-select").click()
driver.find_element(By.XPATH,"//*[contains(text(),'%s')]" %(backupName)).click()
except:
pass

driver.implicitly_wait(5)
driver.find_element(By.XPATH,"/html/body/app-root/app-main/div/app-content/div[1]/aside/app-aside/ng-component/app-resource-backups/div/div[3]/div[2]/app-browser-container/app-browser/div/div/app-browser-backups/div/div/div[2]/div/button/span[1]").click()
time.sleep(1)
driver.find_element(By.XPATH,"//*[contains(text(),'Restore all')]").click()
time.sleep(1)

driver.find_element(By.XPATH,"//*[contains(text(),'Select directory')]").click()
driver.find_element(By.XPATH,"//*[contains(text(),'New directory')]").click()

driver.find_element(By.XPATH,"/html/body/app-root/app-main/div/app-content/div[1]/aside[4]/app-aside/ng-component/app-browse-device-files/div/div[3]/app-files-browser/app-files/ul/li[2]/div/app-icon").click()

folderTree = driver.find_element(By.XPATH,"/html/body/app-root/app-main/div/app-content/div[1]/aside[4]")
restorePath = R"backup\Cloud" ##<--- wstaw ścieżkę backupu
restorePath=restorePath.replace(":","")
backupPath = restorePath.split("\\")
fileName = backupPath.pop(-1)

for folder in backupPath:
time.sleep(1)
folderTree.find_element(By.XPATH,"//span[text()='%s']/../../app-icon/fa-icon" %(folder)).click()
#folderName.find_element(By.XPATH,"//*/app-icon").click()

fileNameElem = folderTree.find_element(By.XPATH,"//span[text()='%s']" %(fileName))
time.sleep(1)
driver.find_element(locate_with(By.CSS_SELECTOR, "label[class='mat-checkbox-layout']").to_left_of(fileNameElem)).click()


driver.find_element(By.XPATH,"//*[contains(text(),'Apply')]").click()
driver.find_element(By.XPATH,"//*[contains(text(),'Start now')]").click()
print("Test 1 - Uruchomienie FB restore z CLD: Pass")

return()
48 changes: 48 additions & 0 deletions FileBackUp/pathBackup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.relative_locator import locate_with
import time

def pathBackup(driver,planName,backupPath):
driver.implicitly_wait(5)
try:
driver.find_element(By.XPATH,"//*[contains(text(),'Plans')]").click()
except:
pass
driver.find_element(By.XPATH,"//*[contains(text(),'Add plan')]").click()

driver.find_element(By.NAME,"backupPlanName").clear()
driver.find_element(By.NAME,"backupPlanName").send_keys("%s" %(planName))

driver.find_element(By.XPATH,"//*[contains(text(),'How to protect')]").click()
driver.find_element(By.XPATH,"//*[contains(text(),'File-level')]").click()
driver.find_element(By.XPATH,"//*[contains(text(),'Which devices?')]").click()

mainDevice = driver.find_element(By.XPATH,"//span[text()='Main']/../../..")
mainDevice.find_element(By.CLASS_NAME, "mat-checkbox").click()

driver.find_element(By.XPATH,"//*[contains(text(),'Apply')]").click()
driver.find_element(By.XPATH,"//*[contains(text(),'What to protect?')]").click()


selectItems = driver.find_element(By.XPATH,"//div[text()='Select items to back up using']/..")
selectItems.find_element(By.CSS_SELECTOR,"div[role='combobox']").click()
selectItems.find_element(By.XPATH,"//*[contains(text(),'Set global rules')]").click()
driver.find_element(By.CSS_SELECTOR,"input[formcontrolname='path']").send_keys(backupPath)
#driver.find_element(By.CSS_SELECTOR,"svg[data-icon='check']").click()
driver.find_element(By.XPATH,"//*[contains(text(),'Apply')]").click()

driver.find_element(By.XPATH,"//*[contains(text(),'Where to store?')]").click()
time.sleep(1)
driver.find_element(By.XPATH,"//*[contains(text(),'Xopero Storage')]").click()

driver.find_element(By.XPATH,"//*[contains(text(),'When?')]").click()
startAt = driver.find_element(By.XPATH,'/html/body/app-root/app-main/div/app-content/div[1]/aside[2]/app-aside/ng-component/app-add-schedule/form/div[3]/div/mat-accordion/mat-expansion-panel[1]/div/div/app-monthly/div/mat-radio-group/div/div[2]/app-time/mat-form-field/div/div[1]/div/input')
startAt.send_keys('1111')
driver.find_element(By.XPATH,"//*[contains(text(),'Next')]").click()
driver.find_element(By.XPATH,"//button[@type='submit']").click()

driver.find_element(By.XPATH,"//*[contains(text(),'Save&Run')]").click()



36 changes: 36 additions & 0 deletions FileBackUp/sideTasks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.relative_locator import locate_with
import time

def logowanie(driver):
try:
driver.get("http://localhost:28555") # <-- url usługi
driver.maximize_window()
time.sleep(2)


log = driver.find_element(By.NAME,'login')
log.send_keys('admin@xopero.com') # <-- login
time.sleep(1)

pas = driver.find_element(By.ID,'mat-input-1')
pas.send_keys("Admin_123") #<-- hasło

driver.find_element(By.XPATH,"//button[@type='submit']").click()
time.sleep(1)
title = driver.current_url

if title == 'http://localhost:28555/devices':
print ("Test 1 - Logowanie: Pass")
return

else:
print("Test 1 - Logowanie: Failed")
return

except:
print("Test 1 - Logowanie: Failed")
exit()


57 changes: 57 additions & 0 deletions FileBackUp/supportTask.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.relative_locator import locate_with
import time


def kontrolaZadania(driver):
try:
time.sleep(1)
print(" Zadanie w trakcie wykonywania")
x = True

while x:
if driver.find_element(By.XPATH,'//*[@id="mat-badge-content-7"]').is_displayed():
time.sleep(5)
else:
x = False

try:
driver.find_element(By.XPATH,'/html/body/app-root/app-main/div/app-content/div[2]/aside/app-aside/ng-component/app-dashboard-plan/div/div[1]/app-close-aside-button/button').click()
except:
pass

print(" Zakończono zadanie")
return
except:
return

def podsumowanie(driver):
try:
driver.find_element(By.XPATH,"//*[contains(text(),'Tasks')]").click() #wybór zadań
driver.find_element(By.XPATH,"//*[contains(text(),'Last 24 hours')]").click() #wybór wykonanych zadań

##########################################
statuses = ["OK","warnings","errors"]
for status in statuses:
attribute = driver.find_element(By.XPATH,"//span[text()='%s']" %(status))
result = driver.find_element(locate_with(By.CLASS_NAME, "count").above(attribute)).text
print(status,":",result)

# OK = driver.find_element(By.XPATH,"//span[text()='OK']")
# Success = driver.find_element(locate_with(By.CLASS_NAME, "count").above(OK)).text

# warning = driver.find_element(By.XPATH,"//span[text()='warnings']")
# warnResult = driver.find_element(locate_with(By.CLASS_NAME, "count").above(warning)).text

# NOK = driver.find_element(By.XPATH,"//span[text()='errors']")
# errors = driver.find_element(locate_with(By.CLASS_NAME, "count").above(NOK)).text

# print(" Podsumowanie wykonania zadania: Pass")
# print(" Pomyślnie zakończono %s zadań" %(Success))
# print(" Ostrzeżeniami zakończono %s zadań " %(warnResult))
# print(" Błędami zakończono %s zadań" %(errors))

except:
print("Podsumowanie wykonania zadania: Failed")
return()
Loading