# Automation Knowledge passing notes
[toc]
## Links:
* [Daily scrum ](https://docs.google.com/document/d/15zPwGAeuZyD-y-ZLZaZQkjA7Rv8bc_PydO6pND0-aSc/edit)
* [Bi weekly Sync Tune automation issue/plan](https://docs.google.com/document/d/1YX9nx2VMsPeXZv_wzZ6RBlu8RG41lBdcSbPspoNLz5E/edit)
## 22/10/25
### About LogiTune
* Versions:
1. Released version
2. RD bug fixed version
* Turn on Develope Mode:
Properties -> shortcut:"C:\Program Files (x86)\Logitech\LogiTune\LogiTune.exe" --arg --godMode
* Tests: Daily run/anity test/ Regression test
**Goal:** Run tests when new firmware released
### Jenkins
* A CI/CD tool (程式整合)
* Pipeline: manage the testing process (Groovy)
* Build in Node: Where Jenkins is
### Questions Juo asked
**Q1**: Since OS updates once a year, how would QA team decide when to stop testing on old versions
**A1**: Chips matters more than OS system
## 22/10/26
### Knowledge
* BT == Bluetooth
### Things done today:
* Setting up environment
* If encounter error installing "pywin32==228" --> try python3.7
* Error installing "winrt" --> try update pip and wheel
- [x] install requirement.txt
- [x] AWS ammand line tool (requires user info)
- [x] JDK 8
## 22/10/27
### Jira Zephyr
## 22/11/02
### From Scrum meeting
* need to discuss with Pawell about wheather to pull the part he fixed
* Found a bug on Sidetone YAYYYYYY
### Knowledge:
* DUT == Device Under Test
### Question:
* **Whats the differentce between fail and broken in Allure report ?**
* Assertion: pytest/unittest assert
* broken: something went wrong during the testing process, not necessarily DUT problem
* Equally important, "Red" is not more urgentˊˇˋ
### Acroname intro:
1. Add test case at detection
2. Switch hub mechanism -> MacOS:
* Only for Win10 & Win11 so far (1 hub linked to 2 slaves)
* Need to impliment on mac after it arrives
3. Relay part intro
* Controls the buttons on headsets
5. properties.LOCAL
* Detailed information about serial number/port/...
* (Can be improved)
7. Win10 and Win11 -> relay currently is on port 0
8. Merge from master to daily_run_ver3
* Make sure getting the newest updates
* Clonflicts might occure
10. BAT test case list:
* [Test case list](https://docs.google.com/spreadsheets/d/1P_rGsJbmtCZ6yUcFI83-F-XGt558o6PjDBffEHM0Aco/edit#gid=419671822)
12. headset distribution in lab
* [Headset distrbution in lab](https://docs.google.com/spreadsheets/d/1bd70UZBhjPxczRGXAwfLz39y13f1wB4XD4xUZgsWSSM/edit#gid=0)
14. branch脈絡
```mermaid
graph LR
Test_connect_Github --> Reboot_win_10 --> win10_daily --> win11_daily
Test_connect_Github --> mac_daily --> mac_m1_daily
```
## 22/11/03
### Jenkins Intro
1. Jenkins overview:
* There are different type of projects, we use pipline
* Blue Ocean -> this Jenkins verison not support yet
* Menu -> Manage Jenkins -> Node
* If slave got off line:
1. Reboot
2. Go to desktop and run 'agent.jar' in power shell
* (agent.jar generated by Jenkins)
3. Pipeline:
* Use Groovy script:
```groovy
pipline{
agent any
options{
timestamps()
}
stages{
stage(){
agent{
node{
}
}
steps{
script{...}
}
}
}
}
```
5. Trigger options:
* Build after certain project
* Build periodically
* Git hub
* ...
6. Plugins
* Mail-watcher: send email when slave offline
8. mail-watcher-plugin
9. Using Pytest to run test cases
#### Questions
* whats the difference between bash and powershell?
* basically powershell is a newer and more powerfull cmd :D
* pytest vs unittest
## 22/11/14
### Road map [PPT by Edward](https://docs.google.com/presentation/d/1I5iLLeN_pf2p7c6xuy38Kmo0QZsZNPC-QfRZv-o7aGw/edit#slide=id.g1889e3379be_0_2)
## 22/11/15
* Finished vc56904
* Studing on BT connection methods for Mac
* Apple Automator and apple script
* [apple script documentation](https://developer.apple.com/library/archive/documentation/AppleScript/Conceptual/AppleScriptLangGuide/reference/ASLR_control_statements.html#//apple_ref/doc/uid/TP40000983-CH6g-158637)
## 22/11/17~22/11/21
### Research on Applescript:
* [Documentation](https://developer.apple.com/library/archive/documentation/AppleScript/Conceptual/AppleScriptLangGuide/introduction/ASLR_intro.html)
* Usage: automating Mac
## DECEMBER 2022
* Added one M1 machine
* Added one more acroname to each system
* Added BT test cases for ZV 130, ZV wireless, ZV 125 to both Windows and Mac
* Time out isseues on Jenkins
#### 12/5
* Mic level issue on Enduro: DUT always on mute
* FIXED by Paul on DUT
#### 12/22
* Add detection Zone 900
* Dongle for both, BT for MAC (relay)
*
#### 12/27
* Figure out new method for BT connection on M1 machine
* Only works for our machine for now (.py script stored local)
* Needs to optimise it to project
* Issue: Canlender take too longer
* tmp fix : extend timeout
* TODO:
* Zone 900 BT test cases
* Zone Wireless BT test cases
## 2023/01/04
* Finished BT test cases for Zone 900 and Zone wireless
* PR opened
* Finished power cycle for zone900 and zone wireless for dongle
* Not yet tested on machines
* TODO:
* Short video for automation
* BT test cases for Zone wireless 2
### Applescripts:
* For Mac12:
```applescript
on run argv
return connectDevice(item 1 of argv)
end run
on connectDevice(deviceName)
tell application "System Preferences"
reveal pane "com.apple.preferences.Bluetooth"
activate
end tell
tell application "System Events" to tell process "System Preferences"
with timeout of 30 seconds
if (exists window "Bluetooth") exists then
delay 10
click window "Bluetooth"
set elements to entire contents of table 1 of scroll area 1 of window "Bluetooth" of application process "System Preferences" of application "System Events"
repeat with e in elements
if class of e is UI element and name of e is deviceName then
click button of e
end if
end repeat
end if
end timeout
end tell
delay 10
tell application "System Preferences"
close window "Bluetooth"
end tell
end connectDevice
```
* For M1(Ventura):
```applescript
on run argv
return connectDevice(item 1 of argv, item 2 of argv)
end run
on connectDevice(deviceName, Dir)
tell application "System Settings"
activate
delay 1
end tell
tell application "System Events"
tell application process "System Settings"
tell outline 1 of scroll area 1 of group 1 of splitter group 1 of group 1 of window 1
select row 7
end tell
if name of window of application process "System Settings" of application "System Events" is not "Bluetooth" then
tell outline 1 of scroll area 1 of group 1 of splitter group 1 of group 1 of window 1
select row 5
end tell
end if
delay 3
set devices to group 3 of scroll area 1 of group 1 of group 2 of splitter group 1 of group 1 of window "Bluetooth" of application process "System Settings" of application "System Events"
click devices
set eles to entire contents of devices
repeat with e in eles
if name of e is deviceName then
set p to position of e
set p_x to item 1 of p
set p_y to item 2 of p
delay 2
do shell script "python3 " & Dir & "/move_cursor.py " & p_x & " " & p_y
delay 3
click button 1 of group 3 of scroll area 1 of group 1 of group 2 of splitter group 1 of group 1 of window "Bluetooth" of application process "System Settings" of application "System Events"
end if
end repeat
delay 3
-- click on button x to close window
click button 1 of window "Bluetooth" of application process "System Settings" of application "System Events"
end tell
end tell
end connectDevice
```
* move_cursor.py:
``` pyhton
import pyautogui
import sys
x = sys.argv[1]
y = sys.argv[2]
pyautogui.moveTo(int(x), int(y))
```
### Test related names
* CAT-
* Sanity test
*
## 2023/06/14
#### Pyinstaller tricks
* Import all the packages from the entry script
* set root path with Path(sys.executable).parent
* include all the scripts/files into "./..." path