Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PR for all changes from June 8 to June 18 #314

Merged
merged 9 commits into from
Jun 19, 2024
55 changes: 55 additions & 0 deletions .github/first_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import time

try:
# Set up the webdriver to connect to the remote Selenium server
options = webdriver.ChromeOptions()
options.add_argument('--no-sandbox')
options.add_argument('--disable-dev-shm-usage')

# Disable headless mode to show the Chrome UI
# options.add_argument('--headless=false')

# Remote WebDriver URL (provided by the selenium/standalone-chrome service)
driver = webdriver.Remote(
command_executor='http://localhost:4444/wd/hub',
options=options
)

# Open the browser and go to the URL
driver.get('http://IP:4000')

# time.sleep(120)


# Wait for the "File" button to be clickable and click it
basic_button = WebDriverWait(driver, 20).until(
EC.element_to_be_clickable((By.XPATH, "//button[contains(@class, 'menu-button') and .//span[text()='File']]"))
)
basic_button.click()


# Wait for the dropdown menu to be visible
dropdown_menu = WebDriverWait(driver, 10).until(
EC.visibility_of_element_located((By.XPATH, "//ul[@role='menu' and @aria-label='File']"))
)

# Wait for the "Open" menu item to be clickable and click it
code_menu_item = WebDriverWait(driver, 20).until(
EC.element_to_be_clickable((By.XPATH, "//ul[@role='menu' and @aria-label='File']//li[text()='Open']"))
)
code_menu_item.click()

time.sleep(20)


# Capture a screenshot
driver.get_screenshot_as_file('screenshot.png')

finally:
# Close the browser
if driver:
driver.quit()
93 changes: 93 additions & 0 deletions .github/workflows/CI_Workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: CI Workflow

on:
pull_request:
branches:
- 'master'

jobs:
setup:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '18'

- name: Install frontend dependencies
if: steps.cache-node-modules.outputs.cache-hit != 'true'
working-directory: frontend
run: npm ci --legacy-peer-deps

- name: Cache Node modules
if: steps.cache-node-modules.outputs.cache-hit != 'true'
uses: actions/cache@v4
with:
path: frontend/node_modules
key: ${{ runner.os }}-node-${{ hashFiles('**/frontend/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-


- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'

- name: Create virtual environment
run: python -m venv .venv

- name: Activate virtual environment
run: source .venv/bin/activate

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r backend/requirements.txt

- name: Add .env file
run: cp backend/.env.template backend/.env

- name: Generate static files
run: python backend/manage.py collectstatic

- name: Save venv
uses: actions/upload-artifact@v4
with:
name: venv
path: .venv

frontend-tests:
runs-on: ubuntu-latest
needs: setup
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Restore Node modules cache
id: restore-node-modules
uses: actions/cache@v4
with:
path: frontend/node_modules
key: ${{ runner.os }}-node-${{ hashFiles('**/frontend/package-lock.json') }}

- name: Install frontend dependencies
if: steps.restore-node-modules.outputs.cache-hit != 'true'
working-directory: frontend
run: npm ci --legacy-peer-deps

- name: Permissions for node_modules
run: chmod -R +x frontend/node_modules/.bin

- name: Verify node_modules restoration
run: |
ls -la frontend/node_modules
ls -la frontend/node_modules/.bin

- name: Run frontend test
run: npm test -- --watchAll=false
working-directory: frontend
2 changes: 1 addition & 1 deletion VC+/scripts/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ txaio==2.10.0
typing_extensions==4.3.0
u-msgpack-python==2.1
unattended-upgrades==0.1
urllib3==1.26.18
urllib3==1.26.19
vcstool==0.3.0
wadllib==1.3.3
websocket-server==0.6.4
Expand Down
Loading
Loading