mirror of
https://github.com/nextcloud/docker.git
synced 2025-04-19 18:36:09 +02:00
Adds a full blue angel run
This commit is contained in:
parent
1bea442d56
commit
c1af42c9db
43 changed files with 9129 additions and 157 deletions
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
energy-tests/.python-version
|
||||||
|
venv/
|
8192
energy-tests/1mb.txt
Normal file
8192
energy-tests/1mb.txt
Normal file
File diff suppressed because it is too large
Load diff
|
@ -1,5 +1,3 @@
|
||||||
version: '2'
|
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
nextcloud-data-mariadb:
|
nextcloud-data-mariadb:
|
||||||
nextcloud-db-mariadb:
|
nextcloud-db-mariadb:
|
||||||
|
@ -34,8 +32,23 @@ services:
|
||||||
- MYSQL_DATABASE=nextcloud
|
- MYSQL_DATABASE=nextcloud
|
||||||
- MYSQL_USER=nextcloud
|
- MYSQL_USER=nextcloud
|
||||||
- MYSQL_HOST=db
|
- MYSQL_HOST=db
|
||||||
|
- NEXTCLOUD_TRUSTED_DOMAINS=ncs
|
||||||
|
- TRUSTED_PROXIES=ncs
|
||||||
|
- APACHE_DISABLE_REWRITE_IP=1
|
||||||
|
- OVERWRITEPROTOCOL=https
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: curl --fail --silent http://nc
|
test: curl --fail --silent -k https://ncs
|
||||||
interval: "1h" # effectively turns repeated healthchecks during runtime off
|
interval: "1h" # effectively turns repeated healthchecks during runtime off
|
||||||
start_period: "60s"
|
start_period: "60s"
|
||||||
start_interval: "1s"
|
start_interval: "1s"
|
||||||
|
|
||||||
|
# We use the official way of doing things
|
||||||
|
# https://github.com/docker-library/docs/blob/master/nextcloud/README.md#https---ssl-encryption
|
||||||
|
ncs:
|
||||||
|
image: nginx
|
||||||
|
ports:
|
||||||
|
- "443:443"
|
||||||
|
volumes:
|
||||||
|
- ./nginx-proxy/default.conf:/etc/nginx/conf.d/default.conf:ro
|
||||||
|
- ./nginx-proxy/cert.crt:/etc/ssl/certs/cert.crt:ro
|
||||||
|
- ./nginx-proxy/cert.key:/etc/ssl/private/cert.key:ro
|
Binary file not shown.
|
@ -5,15 +5,15 @@ from time import time_ns, sleep
|
||||||
from playwright.sync_api import TimeoutError
|
from playwright.sync_api import TimeoutError
|
||||||
|
|
||||||
|
|
||||||
def login_nextcloud(page, username='Crash', password='Override'):
|
def login_nextcloud(page, username='Crash', password='Override', domain='https://ncs'):
|
||||||
page.goto("http://nc/login")
|
page.goto(f"{domain}/login")
|
||||||
page.locator('#user').fill(username)
|
page.locator('#user').fill(username)
|
||||||
page.locator('#password').fill(password)
|
page.locator('#password').fill(password)
|
||||||
page.locator('#password').press("Enter")
|
page.locator('#password').press("Enter")
|
||||||
|
|
||||||
|
|
||||||
def get_random_text() -> str:
|
def get_random_text() -> str:
|
||||||
size_in_bytes = 1024
|
size_in_bytes = 10
|
||||||
characters = string.ascii_letters + string.digits
|
characters = string.ascii_letters + string.digits
|
||||||
return ''.join(random.choice(characters) for _ in range(size_in_bytes))
|
return ''.join(random.choice(characters) for _ in range(size_in_bytes))
|
||||||
|
|
||||||
|
|
115
energy-tests/nextcloud_contacts.py
Normal file
115
energy-tests/nextcloud_contacts.py
Normal file
|
@ -0,0 +1,115 @@
|
||||||
|
import contextlib
|
||||||
|
import sys
|
||||||
|
from time import time_ns, sleep
|
||||||
|
import signal
|
||||||
|
import random
|
||||||
|
import string
|
||||||
|
|
||||||
|
from playwright.sync_api import Playwright, sync_playwright, expect
|
||||||
|
|
||||||
|
from helpers.helper_functions import log_note, get_random_text, login_nextcloud, close_modal, timeout_handler
|
||||||
|
|
||||||
|
DOMAIN = 'https://ncs'
|
||||||
|
#DOMAIN = 'http://localhost:8080'
|
||||||
|
|
||||||
|
SLEEP_TIME = 1
|
||||||
|
|
||||||
|
def run(playwright: Playwright, browser_name: str, headless=False) -> None:
|
||||||
|
log_note(f"Launch browser {browser_name}")
|
||||||
|
if browser_name == "firefox":
|
||||||
|
browser = playwright.firefox.launch(headless=headless)
|
||||||
|
else:
|
||||||
|
# this leverages new headless mode by Chromium: https://developer.chrome.com/articles/new-headless/
|
||||||
|
# The mode is however ~40% slower: https://github.com/microsoft/playwright/issues/21216
|
||||||
|
browser = playwright.chromium.launch(headless=headless,args=["--headless=new"])
|
||||||
|
context = browser.new_context(ignore_https_errors=True)
|
||||||
|
page = context.new_page()
|
||||||
|
|
||||||
|
try:
|
||||||
|
page.goto(f"{DOMAIN}/login")
|
||||||
|
log_note("Login")
|
||||||
|
login_nextcloud(page, domain=DOMAIN)
|
||||||
|
|
||||||
|
log_note("Wait for welcome popup")
|
||||||
|
close_modal(page)
|
||||||
|
|
||||||
|
log_note("Go to contacs")
|
||||||
|
page.get_by_role("link", name="Contacts").click()
|
||||||
|
|
||||||
|
sleep(SLEEP_TIME)
|
||||||
|
|
||||||
|
#CREATE
|
||||||
|
log_note("Create new Contact")
|
||||||
|
contact_name = "Gary McKinnon" + ''.join(random.choices(string.ascii_letters, k=5))
|
||||||
|
page.get_by_role("button", name="New contact").click()
|
||||||
|
page.get_by_placeholder("Name").fill(contact_name)
|
||||||
|
page.get_by_role("button", name="Save").click()
|
||||||
|
|
||||||
|
expect(page.get_by_role('heading', name=contact_name)).to_be_visible()
|
||||||
|
expect(page.locator('div.list-item-content__name', has_text=contact_name)).to_have_count(1)
|
||||||
|
|
||||||
|
sleep(SLEEP_TIME)
|
||||||
|
|
||||||
|
# EDIT
|
||||||
|
log_note("Modify contact")
|
||||||
|
page.get_by_role("button", name="Edit").click()
|
||||||
|
edit_contact_name = contact_name + ''.join(random.choices(string.ascii_letters, k=5))
|
||||||
|
page.get_by_placeholder("Name").fill(edit_contact_name)
|
||||||
|
page.get_by_role("button", name="Save").click()
|
||||||
|
|
||||||
|
expect(page.get_by_role('heading', name=edit_contact_name)).to_be_visible()
|
||||||
|
expect(page.locator('div.list-item-content__name', has_text=edit_contact_name)).to_have_count(1)
|
||||||
|
|
||||||
|
sleep(SLEEP_TIME)
|
||||||
|
|
||||||
|
# DELETE
|
||||||
|
log_note("Delete the contact")
|
||||||
|
|
||||||
|
actions_button = page.locator('button[aria-haspopup="menu"]')
|
||||||
|
actions_button.click()
|
||||||
|
|
||||||
|
actions_button_id = actions_button.get_attribute('id')
|
||||||
|
menu_id = actions_button_id.replace('trigger-', '')
|
||||||
|
menu_selector = f'ul#{menu_id}[role="menu"]'
|
||||||
|
menu_locator = page.locator(menu_selector)
|
||||||
|
expect(menu_locator).to_be_visible()
|
||||||
|
|
||||||
|
delete_button = menu_locator.locator('button.action-button:has-text("Delete")')
|
||||||
|
expect(delete_button).to_be_visible()
|
||||||
|
delete_button.click()
|
||||||
|
|
||||||
|
expect(page.locator('div.list-item-content__name', has_text=edit_contact_name)).to_have_count(0)
|
||||||
|
|
||||||
|
sleep(SLEEP_TIME)
|
||||||
|
|
||||||
|
page.close()
|
||||||
|
log_note("Close browser")
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
if hasattr(e, 'message'): # only Playwright error class has this member
|
||||||
|
log_note(f"Exception occurred: {e.message}")
|
||||||
|
|
||||||
|
# set a timeout. Since the call to page.content() is blocking we need to defer it to the OS
|
||||||
|
signal.signal(signal.SIGALRM, timeout_handler)
|
||||||
|
signal.alarm(20)
|
||||||
|
#log_note(f"Page content was: {page.content()}")
|
||||||
|
signal.alarm(0) # remove timeout signal
|
||||||
|
|
||||||
|
raise e
|
||||||
|
|
||||||
|
# ---------------------
|
||||||
|
context.close()
|
||||||
|
browser.close()
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
if len(sys.argv) > 1:
|
||||||
|
browser_name = sys.argv[1].lower()
|
||||||
|
if browser_name not in ["chromium", "firefox"]:
|
||||||
|
print("Invalid browser name. Please choose either 'chromium' or 'firefox'.")
|
||||||
|
sys.exit(1)
|
||||||
|
else:
|
||||||
|
browser_name = "firefox"
|
||||||
|
|
||||||
|
with sync_playwright() as playwright:
|
||||||
|
run(playwright, browser_name)
|
|
@ -1,4 +1,7 @@
|
||||||
import contextlib
|
import contextlib
|
||||||
|
import random
|
||||||
|
import re
|
||||||
|
import string
|
||||||
import sys
|
import sys
|
||||||
from time import sleep, time_ns
|
from time import sleep, time_ns
|
||||||
import signal
|
import signal
|
||||||
|
@ -7,39 +10,50 @@ from playwright.sync_api import Playwright, sync_playwright
|
||||||
|
|
||||||
from helpers.helper_functions import log_note, get_random_text, login_nextcloud, close_modal, timeout_handler
|
from helpers.helper_functions import log_note, get_random_text, login_nextcloud, close_modal, timeout_handler
|
||||||
|
|
||||||
|
DOMAIN = 'https://ncs'
|
||||||
|
#DOMAIN = 'http://localhost:8080'
|
||||||
|
|
||||||
def run(playwright: Playwright, browser_name: str) -> None:
|
|
||||||
|
def run(playwright: Playwright, browser_name: str, headless=False) -> None:
|
||||||
log_note(f"Launch browser {browser_name}")
|
log_note(f"Launch browser {browser_name}")
|
||||||
if browser_name == "firefox":
|
if browser_name == "firefox":
|
||||||
browser = playwright.firefox.launch(headless=True)
|
browser = playwright.firefox.launch(headless=headless)
|
||||||
else:
|
else:
|
||||||
# this leverages new headless mode by Chromium: https://developer.chrome.com/articles/new-headless/
|
# this leverages new headless mode by Chromium: https://developer.chrome.com/articles/new-headless/
|
||||||
# The mode is however ~40% slower: https://github.com/microsoft/playwright/issues/21216
|
# The mode is however ~40% slower: https://github.com/microsoft/playwright/issues/21216
|
||||||
browser = playwright.chromium.launch(headless=False,args=["--headless=new"])
|
browser = playwright.chromium.launch(headless=headless,args=["--headless=new"])
|
||||||
context = browser.new_context()
|
context = browser.new_context(ignore_https_errors=True)
|
||||||
page = context.new_page()
|
page = context.new_page()
|
||||||
try:
|
try:
|
||||||
log_note("Login")
|
log_note("Login")
|
||||||
page.goto("http://nc/")
|
page.goto(DOMAIN)
|
||||||
login_nextcloud(page)
|
login_nextcloud(page, domain=DOMAIN)
|
||||||
|
#close_modal(page)
|
||||||
|
|
||||||
log_note("Create new text file")
|
log_note("Create new text file")
|
||||||
page.get_by_role("link", name="Files").click()
|
page.get_by_role("link", name="Files").click()
|
||||||
page.get_by_role("link", name="New file/folder menu").click()
|
page.get_by_role("button", name="New", exact=True).click()
|
||||||
page.get_by_role("link", name="New text file").click()
|
page.click("button[role='menuitem']:has-text('New text file')")
|
||||||
page.locator("#view7-input-file").fill("colab_meeting.md")
|
|
||||||
page.locator("#view7-input-file").press("Enter")
|
|
||||||
page.get_by_role("button", name="Create a new file with the selected template").click()
|
|
||||||
|
|
||||||
close_modal(page)
|
file_name = "File " + ''.join(random.choices(string.ascii_letters, k=5)) + '.md'
|
||||||
|
page.get_by_placeholder('Filename', exact=True).fill(file_name)
|
||||||
|
page.locator('.dialog__actions').get_by_role("button", name="Create").click()
|
||||||
|
page.locator('.templates-picker__buttons').get_by_role("button", name="Create").click()
|
||||||
|
|
||||||
page.keyboard.press("Escape")
|
|
||||||
log_note("Share file with other user")
|
log_note("Share file with other user")
|
||||||
page.get_by_role("link", name="colab_meeting .md").get_by_role("link", name="Share").click()
|
|
||||||
page.get_by_placeholder("Name, email, or Federated Cloud ID …").click()
|
modal_header = page.get_by_role("heading", name=re.compile(rf"\b{re.escape(file_name)}\b"))
|
||||||
page.get_by_placeholder("Name, email, or Federated Cloud ID …").fill("docs")
|
modal = modal_header.locator("..")
|
||||||
|
actions_button = modal.locator("button.action-item__menutoggle[aria-label='Actions']")
|
||||||
|
actions_button.click()
|
||||||
|
|
||||||
|
page.get_by_role("menuitem", name="Open sidebar").click()
|
||||||
|
page.get_by_role("tab", name="Sharing").click()
|
||||||
|
|
||||||
|
page.get_by_placeholder("Name, email, or Federated Cloud ID").fill("docs")
|
||||||
page.get_by_text("docs_dude").first.click()
|
page.get_by_text("docs_dude").first.click()
|
||||||
page.get_by_text("Save Share").first.click()
|
page.get_by_text("Save Share").first.click()
|
||||||
|
|
||||||
log_note("Close browser")
|
log_note("Close browser")
|
||||||
page.close()
|
page.close()
|
||||||
|
|
||||||
|
@ -53,7 +67,7 @@ def run(playwright: Playwright, browser_name: str) -> None:
|
||||||
# set a timeout. Since the call to page.content() is blocking we need to defer it to the OS
|
# set a timeout. Since the call to page.content() is blocking we need to defer it to the OS
|
||||||
signal.signal(signal.SIGALRM, timeout_handler)
|
signal.signal(signal.SIGALRM, timeout_handler)
|
||||||
signal.alarm(5)
|
signal.alarm(5)
|
||||||
log_note(f"Page content was: {page.content()}")
|
#log_note(f"Page content was: {page.content()}")
|
||||||
signal.alarm(0) # remove timeout signal
|
signal.alarm(0) # remove timeout signal
|
||||||
|
|
||||||
raise e
|
raise e
|
||||||
|
|
|
@ -1,70 +0,0 @@
|
||||||
import contextlib
|
|
||||||
import sys
|
|
||||||
from time import time_ns, sleep
|
|
||||||
import signal
|
|
||||||
|
|
||||||
from playwright.sync_api import Playwright, sync_playwright, expect
|
|
||||||
|
|
||||||
from helpers.helper_functions import log_note, get_random_text, login_nextcloud, close_modal, timeout_handler
|
|
||||||
|
|
||||||
|
|
||||||
def run(playwright: Playwright, browser_name: str) -> None:
|
|
||||||
log_note(f"Launch browser {browser_name}")
|
|
||||||
if browser_name == "firefox":
|
|
||||||
browser = playwright.firefox.launch(headless=True)
|
|
||||||
else:
|
|
||||||
# this leverages new headless mode by Chromium: https://developer.chrome.com/articles/new-headless/
|
|
||||||
# The mode is however ~40% slower: https://github.com/microsoft/playwright/issues/21216
|
|
||||||
browser = playwright.chromium.launch(headless=False,args=["--headless=new"])
|
|
||||||
context = browser.new_context()
|
|
||||||
page = context.new_page()
|
|
||||||
|
|
||||||
try:
|
|
||||||
page.goto("http://nc/login")
|
|
||||||
log_note("Login")
|
|
||||||
login_nextcloud(page)
|
|
||||||
|
|
||||||
log_note("Wait for welcome popup")
|
|
||||||
close_modal(page)
|
|
||||||
|
|
||||||
log_note("Go to calendar")
|
|
||||||
page.get_by_role("link", name="Calendar").click()
|
|
||||||
|
|
||||||
log_note("Create event")
|
|
||||||
event_name = "Weekly sync"
|
|
||||||
page.get_by_role("button", name="New event").click()
|
|
||||||
page.get_by_placeholder("Event title").fill(event_name)
|
|
||||||
page.get_by_role("button", name="Save").click()
|
|
||||||
log_note("Event created")
|
|
||||||
expect(page.get_by_text(event_name, exact=True)).to_be_visible()
|
|
||||||
page.close()
|
|
||||||
log_note("Close browser")
|
|
||||||
|
|
||||||
except Exception as e:
|
|
||||||
if hasattr(e, 'message'): # only Playwright error class has this member
|
|
||||||
log_note(f"Exception occurred: {e.message}")
|
|
||||||
|
|
||||||
# set a timeout. Since the call to page.content() is blocking we need to defer it to the OS
|
|
||||||
signal.signal(signal.SIGALRM, timeout_handler)
|
|
||||||
signal.alarm(20)
|
|
||||||
log_note(f"Page content was: {page.content()}")
|
|
||||||
signal.alarm(0) # remove timeout signal
|
|
||||||
|
|
||||||
raise e
|
|
||||||
|
|
||||||
# ---------------------
|
|
||||||
context.close()
|
|
||||||
browser.close()
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
if len(sys.argv) > 1:
|
|
||||||
browser_name = sys.argv[1].lower()
|
|
||||||
if browser_name not in ["chromium", "firefox"]:
|
|
||||||
print("Invalid browser name. Please choose either 'chromium' or 'firefox'.")
|
|
||||||
sys.exit(1)
|
|
||||||
else:
|
|
||||||
browser_name = "chromium"
|
|
||||||
|
|
||||||
with sync_playwright() as playwright:
|
|
||||||
run(playwright, browser_name)
|
|
|
@ -7,33 +7,31 @@ from playwright.sync_api import Playwright, sync_playwright
|
||||||
|
|
||||||
from helpers.helper_functions import log_note, get_random_text, login_nextcloud, close_modal, timeout_handler
|
from helpers.helper_functions import log_note, get_random_text, login_nextcloud, close_modal, timeout_handler
|
||||||
|
|
||||||
def create_user(playwright: Playwright, browser_name: str, username: str, password: str) -> None:
|
def create_user(playwright: Playwright, browser_name: str, username: str, password: str, email: str, headless=False) -> None:
|
||||||
log_note(f"Launch browser {browser_name}")
|
log_note(f"Launch browser {browser_name}")
|
||||||
if browser_name == "firefox":
|
if browser_name == "firefox":
|
||||||
browser = playwright.firefox.launch(headless=True)
|
browser = playwright.firefox.launch(headless=headless)
|
||||||
else:
|
else:
|
||||||
# this leverages new headless mode by Chromium: https://developer.chrome.com/articles/new-headless/
|
# this leverages new headless mode by Chromium: https://developer.chrome.com/articles/new-headless/
|
||||||
# The mode is however ~40% slower: https://github.com/microsoft/playwright/issues/21216
|
# The mode is however ~40% slower: https://github.com/microsoft/playwright/issues/21216
|
||||||
browser = playwright.chromium.launch(headless=False,args=["--headless=new"])
|
browser = playwright.chromium.launch(headless=headless,args=["--headless=new"])
|
||||||
context = browser.new_context()
|
context = browser.new_context(ignore_https_errors=True)
|
||||||
try:
|
try:
|
||||||
page = context.new_page()
|
page = context.new_page()
|
||||||
log_note("Login")
|
log_note("Login")
|
||||||
login_nextcloud(page)
|
login_nextcloud(page)
|
||||||
|
|
||||||
log_note("Wait for welcome popup")
|
log_note("Wait for welcome popup")
|
||||||
close_modal(page)
|
#close_modal(page)
|
||||||
|
|
||||||
log_note("Create user")
|
log_note("Create user")
|
||||||
page.get_by_role("link", name="Open settings menu").click()
|
page.click("button[aria-label='Settings menu']")
|
||||||
page.get_by_role("link", name="Users").first.click()
|
page.click("#core_users")
|
||||||
page.get_by_role("button", name="New user").click()
|
page.get_by_role("button", name="New Account").click()
|
||||||
page.get_by_placeholder("Username").click()
|
page.get_by_placeholder("Account name (required)", exact=True).fill(username)
|
||||||
page.get_by_placeholder("Username").fill(username)
|
page.get_by_placeholder("Password (required)", exact=True).fill(password)
|
||||||
page.get_by_placeholder("Username").press("Tab")
|
#page.get_by_placeholder("Email", exact=True).fill(email)
|
||||||
page.get_by_placeholder("Display name").press("Tab")
|
page.get_by_role("button", name="Add new account").click()
|
||||||
page.get_by_placeholder("Password", exact=True).fill(password)
|
|
||||||
page.get_by_role("button", name="Add a new user").click()
|
|
||||||
log_note("Close browser")
|
log_note("Close browser")
|
||||||
|
|
||||||
# ---------------------
|
# ---------------------
|
||||||
|
@ -47,7 +45,7 @@ def create_user(playwright: Playwright, browser_name: str, username: str, passwo
|
||||||
# set a timeout. Since the call to page.content() is blocking we need to defer it to the OS
|
# set a timeout. Since the call to page.content() is blocking we need to defer it to the OS
|
||||||
signal.signal(signal.SIGALRM, timeout_handler)
|
signal.signal(signal.SIGALRM, timeout_handler)
|
||||||
signal.alarm(20)
|
signal.alarm(20)
|
||||||
log_note(f"Page content was: {page.content()}")
|
#log_note(f"Page content was: {page.content()}")
|
||||||
signal.alarm(0) # remove timeout signal
|
signal.alarm(0) # remove timeout signal
|
||||||
|
|
||||||
raise e
|
raise e
|
||||||
|
@ -62,4 +60,4 @@ with sync_playwright() as playwright:
|
||||||
else:
|
else:
|
||||||
browser_name = "chromium"
|
browser_name = "chromium"
|
||||||
|
|
||||||
create_user(playwright, browser_name, username="docs_dude", password="docsrule!12")
|
create_user(playwright, browser_name, username="docs_dude", password="docsrule!12", email="docs_dude@local.host")
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import contextlib
|
import contextlib
|
||||||
|
import re
|
||||||
import string
|
import string
|
||||||
import sys
|
import sys
|
||||||
from time import sleep
|
from time import sleep
|
||||||
|
@ -7,65 +8,95 @@ from playwright.sync_api import Playwright, sync_playwright, expect
|
||||||
|
|
||||||
from helpers.helper_functions import log_note, get_random_text, login_nextcloud, close_modal, timeout_handler
|
from helpers.helper_functions import log_note, get_random_text, login_nextcloud, close_modal, timeout_handler
|
||||||
|
|
||||||
|
DOMAIN = 'https://ncs'
|
||||||
|
#DOMAIN = 'http://localhost:8080'
|
||||||
|
|
||||||
def collaborate(playwright: Playwright, browser_name: str) -> None:
|
SLEEP_TIME = 1
|
||||||
|
|
||||||
|
|
||||||
|
def collaborate(playwright: Playwright, browser_name: str, headless=False) -> None:
|
||||||
log_note(f"Launch two {browser_name} browsers")
|
log_note(f"Launch two {browser_name} browsers")
|
||||||
if browser_name == "firefox":
|
if browser_name == "firefox":
|
||||||
browser = playwright.firefox.launch(headless=True)
|
browser = playwright.firefox.launch(headless=headless, args=['-width', '1280', '-height', '720'])
|
||||||
else:
|
else:
|
||||||
# this leverages new headless mode by Chromium: https://developer.chrome.com/articles/new-headless/
|
# this leverages new headless mode by Chromium: https://developer.chrome.com/articles/new-headless/
|
||||||
# The mode is however ~40% slower: https://github.com/microsoft/playwright/issues/21216
|
# The mode is however ~40% slower: https://github.com/microsoft/playwright/issues/21216
|
||||||
browser = playwright.chromium.launch(headless=False,args=["--headless=new"])
|
browser = playwright.chromium.launch(headless=headless,args=["--headless=new"])
|
||||||
context = browser.new_context()
|
|
||||||
|
context = browser.new_context(ignore_https_errors=True, viewport={'width': 1280, 'height': 720})
|
||||||
admin_user_page = context.new_page()
|
admin_user_page = context.new_page()
|
||||||
|
|
||||||
|
|
||||||
if browser_name == "firefox":
|
if browser_name == "firefox":
|
||||||
browser_two = playwright.firefox.launch(headless=True)
|
browser_two = playwright.firefox.launch(headless=headless, args=['-width', '1280', '-height', '720'])
|
||||||
else:
|
else:
|
||||||
# this leverages new headless mode by Chromium: https://developer.chrome.com/articles/new-headless/
|
# this leverages new headless mode by Chromium: https://developer.chrome.com/articles/new-headless/
|
||||||
# The mode is however ~40% slower: https://github.com/microsoft/playwright/issues/21216
|
# The mode is however ~40% slower: https://github.com/microsoft/playwright/issues/21216
|
||||||
browser_two = playwright.chromium.launch(headless=False,args=["--headless=new"])
|
browser_two = playwright.chromium.launch(headless=headless,args=["--headless=new"])
|
||||||
context_two = browser_two.new_context()
|
context_two = browser_two.new_context(ignore_https_errors=True, viewport={'width': 1280, 'height': 720})
|
||||||
docs_user_page = context_two.new_page()
|
docs_user_page = context_two.new_page()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Login and open the file for both users
|
# Login and open the file for both users
|
||||||
log_note("Logging in with users")
|
log_note("Logging in with users")
|
||||||
login_nextcloud(admin_user_page, "Crash", "Override")
|
login_nextcloud(admin_user_page, "Crash", "Override", DOMAIN)
|
||||||
login_nextcloud(docs_user_page, "docs_dude", "docsrule!12")
|
login_nextcloud(docs_user_page, "docs_dude", "docsrule!12", DOMAIN)
|
||||||
log_note("Opening document with both users")
|
log_note("Opening document with both users")
|
||||||
close_modal(docs_user_page)
|
close_modal(docs_user_page)
|
||||||
|
|
||||||
admin_user_page.get_by_role("link", name="Files", exact=True).click()
|
admin_user_page.get_by_role("link", name="Files").click()
|
||||||
docs_user_page.get_by_role("link", name="Files", exact=True).click()
|
docs_user_page.get_by_role("link", name="Files").click()
|
||||||
|
|
||||||
admin_user_page.get_by_role("link", name="Shares", exact=True).click()
|
admin_user_page.get_by_role("link", name="Shares", exact=True).click()
|
||||||
docs_user_page.get_by_role("link", name="Shares", exact=True).click()
|
docs_user_page.get_by_role("link", name="Shares", exact=True).click()
|
||||||
admin_user_page.get_by_role("link", name="colab_meeting .md").click()
|
|
||||||
docs_user_page.get_by_role("link", name="colab_meeting .md").click()
|
sort_button = admin_user_page.locator('button.files-list__column-sort-button:has-text("Modified")')
|
||||||
|
arrow_icon = sort_button.locator('.menu-up-icon')
|
||||||
|
if arrow_icon.count() > 0:
|
||||||
|
log_note("The arrow is already pointing up. No need to click the button.")
|
||||||
|
else:
|
||||||
|
sort_button.click()
|
||||||
|
|
||||||
|
admin_user_page.locator('tr[data-cy-files-list-row][index="0"]').click()
|
||||||
|
|
||||||
|
filename_element = admin_user_page.locator('h2.modal-header__name')
|
||||||
|
filename = filename_element.text_content().strip()
|
||||||
|
|
||||||
|
docs_user_page.locator(f'tr[data-cy-files-list-row-name="{filename}"]').click()
|
||||||
|
|
||||||
|
sleep(SLEEP_TIME)
|
||||||
|
log_note("Starting to collaborate")
|
||||||
|
|
||||||
# Write the first message and assert it's visible for the other user
|
# Write the first message and assert it's visible for the other user
|
||||||
log_note("Sending first validation message")
|
log_note("Sending first validation message")
|
||||||
first_message = "FIRST_VALIDATION_MESSAGE"
|
first_message = "FIRST_VALIDATION_MESSAGE"
|
||||||
admin_user_page.get_by_role("dialog", name="colab_meeting.md").get_by_role("document").locator("div").first.type(first_message)
|
|
||||||
|
admin_text_box = admin_user_page.locator('div[contenteditable="true"]').first
|
||||||
|
user_text_box = docs_user_page.locator('div[contenteditable="true"]').first
|
||||||
|
|
||||||
|
admin_text_box.wait_for(state="visible")
|
||||||
|
user_text_box.wait_for(state="visible")
|
||||||
|
|
||||||
|
sleep(SLEEP_TIME)
|
||||||
|
|
||||||
|
admin_user_page.keyboard.type(first_message)
|
||||||
|
|
||||||
expect(docs_user_page.get_by_text(first_message)).to_be_visible()
|
expect(docs_user_page.get_by_text(first_message)).to_be_visible()
|
||||||
log_note("GMT_SCI_R=1")
|
|
||||||
|
|
||||||
for x in range(1, 7):
|
for x in range(1, 7):
|
||||||
random_message = get_random_text()
|
random_message = get_random_text()
|
||||||
# Admin sends on even, docs_dude on odd
|
# Admin sends on even, docs_dude on odd
|
||||||
if x % 2 == 0:
|
if x % 2 == 0:
|
||||||
log_note("Admin adding text")
|
log_note("Admin adding text")
|
||||||
admin_user_page.get_by_role("dialog", name="colab_meeting.md").get_by_role("document").locator("div").first.type(random_message)
|
admin_user_page.keyboard.type(random_message) # We could add delay here, but then we need to increase the timeout
|
||||||
expect(docs_user_page.get_by_text(random_message)).to_be_visible(timeout=15_000)
|
expect(docs_user_page.get_by_text(random_message)).to_be_visible(timeout=15_000)
|
||||||
else:
|
else:
|
||||||
log_note("User adding text")
|
log_note("User adding text")
|
||||||
docs_user_page.get_by_role("dialog", name="colab_meeting.md").get_by_role("document").locator("div").first.type(random_message)
|
docs_user_page.keyboard.type(random_message)
|
||||||
expect(admin_user_page.get_by_text(random_message)).to_be_visible(timeout=15_000)
|
expect(admin_user_page.get_by_text(random_message)).to_be_visible(timeout=15_000)
|
||||||
|
|
||||||
log_note("GMT_SCI_R=1")
|
log_note(f"Sleeping for {SLEEP_TIME} seconds")
|
||||||
log_note("Sleeping for 5 seconds")
|
sleep(SLEEP_TIME)
|
||||||
sleep(5)
|
|
||||||
|
|
||||||
log_note("Closing browsers")
|
log_note("Closing browsers")
|
||||||
# ---------------------
|
# ---------------------
|
||||||
|
@ -79,8 +110,8 @@ def collaborate(playwright: Playwright, browser_name: str) -> None:
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
if hasattr(e, 'message'): # only Playwright error class has this member
|
if hasattr(e, 'message'): # only Playwright error class has this member
|
||||||
log_note(f"Exception occurred: {e.message}")
|
log_note(f"Exception occurred: {e.message}")
|
||||||
log_note(f"Page content was: {docs_user_page.content()}")
|
#log_note(f"Page content was: {docs_user_page.content()}")
|
||||||
log_note(f"Page content was: {admin_user_page.content()}")
|
#log_note(f"Page content was: {admin_user_page.content()}")
|
||||||
raise e
|
raise e
|
||||||
|
|
||||||
|
|
||||||
|
@ -92,6 +123,6 @@ with sync_playwright() as playwright:
|
||||||
print("Invalid browser name. Please choose either 'chromium' or 'firefox'.")
|
print("Invalid browser name. Please choose either 'chromium' or 'firefox'.")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
else:
|
else:
|
||||||
browser_name = "chromium"
|
browser_name = "firefox"
|
||||||
|
|
||||||
collaborate(playwright, browser_name)
|
collaborate(playwright, browser_name)
|
||||||
|
|
129
energy-tests/nextcloud_events.py
Normal file
129
energy-tests/nextcloud_events.py
Normal file
|
@ -0,0 +1,129 @@
|
||||||
|
import contextlib
|
||||||
|
import random
|
||||||
|
import string
|
||||||
|
import sys
|
||||||
|
from time import time_ns, sleep
|
||||||
|
import signal
|
||||||
|
|
||||||
|
from playwright.sync_api import Playwright, sync_playwright, expect
|
||||||
|
|
||||||
|
from helpers.helper_functions import log_note, get_random_text, login_nextcloud, close_modal, timeout_handler
|
||||||
|
|
||||||
|
DOMAIN = 'https://ncs'
|
||||||
|
#DOMAIN = 'http://localhost:8080'
|
||||||
|
SLEEP_TIME = 1
|
||||||
|
|
||||||
|
def run(playwright: Playwright, browser_name: str, headless=False) -> None:
|
||||||
|
log_note(f"Launch browser {browser_name}")
|
||||||
|
if browser_name == "firefox":
|
||||||
|
browser = playwright.firefox.launch(headless=headless)
|
||||||
|
else:
|
||||||
|
# this leverages new headless mode by Chromium: https://developer.chrome.com/articles/new-headless/
|
||||||
|
# The mode is however ~40% slower: https://github.com/microsoft/playwright/issues/21216
|
||||||
|
browser = playwright.chromium.launch(headless=headless,args=["--headless=new"])
|
||||||
|
context = browser.new_context(ignore_https_errors=True)
|
||||||
|
page = context.new_page()
|
||||||
|
|
||||||
|
try:
|
||||||
|
page.goto(f"{DOMAIN}/login")
|
||||||
|
log_note("Login")
|
||||||
|
login_nextcloud(page, domain=DOMAIN)
|
||||||
|
|
||||||
|
log_note("Wait for welcome popup")
|
||||||
|
close_modal(page)
|
||||||
|
|
||||||
|
log_note("Go to calendar")
|
||||||
|
page.get_by_role("link", name="Calendar").click()
|
||||||
|
|
||||||
|
#CREATE
|
||||||
|
log_note("Create event")
|
||||||
|
event_name = "Event " + ''.join(random.choices(string.ascii_letters, k=5))
|
||||||
|
page.get_by_role("button", name="New event").click()
|
||||||
|
page.get_by_placeholder("Event title").fill(event_name)
|
||||||
|
page.get_by_role("button", name="Save").click()
|
||||||
|
log_note("Event created")
|
||||||
|
|
||||||
|
expect(page.get_by_text(event_name, exact=True)).to_be_visible()
|
||||||
|
event_title_locator = page.locator(f'a.fc-event div.fc-event-title', has_text=event_name)
|
||||||
|
expect(event_title_locator).to_have_count(1)
|
||||||
|
|
||||||
|
sleep(SLEEP_TIME)
|
||||||
|
|
||||||
|
# EDIT
|
||||||
|
log_note("Modify event")
|
||||||
|
page.get_by_text(event_name, exact=True).click()
|
||||||
|
|
||||||
|
|
||||||
|
popover_locator = page.locator('div.event-popover[aria-hidden="false"]')
|
||||||
|
expect(popover_locator).to_be_visible()
|
||||||
|
|
||||||
|
edit_button = popover_locator.locator('button:has-text("Edit")')
|
||||||
|
edit_button.click()
|
||||||
|
|
||||||
|
title_input = popover_locator.locator('input[placeholder="Event title"]')
|
||||||
|
expect(title_input).to_be_visible()
|
||||||
|
expect(title_input).to_be_enabled()
|
||||||
|
new_event_name = event_name + ''.join(random.choices(string.ascii_letters, k=5))
|
||||||
|
title_input.fill(new_event_name)
|
||||||
|
|
||||||
|
update_button = popover_locator.locator('button:has-text("Update")')
|
||||||
|
update_button.click()
|
||||||
|
|
||||||
|
updated_event_title_locator = page.locator(f'a.fc-event div.fc-event-title', has_text=new_event_name)
|
||||||
|
expect(updated_event_title_locator).to_have_text(new_event_name)
|
||||||
|
expect(updated_event_title_locator).to_have_count(1)
|
||||||
|
|
||||||
|
sleep(SLEEP_TIME)
|
||||||
|
|
||||||
|
# DELETE
|
||||||
|
log_note("Delete the event")
|
||||||
|
|
||||||
|
actions_button = popover_locator.locator('button[aria-label="Actions"]')
|
||||||
|
expect(actions_button).to_be_visible()
|
||||||
|
actions_button.click()
|
||||||
|
|
||||||
|
actions_button_id = actions_button.get_attribute('id')
|
||||||
|
menu_id = actions_button_id.replace('trigger-', '')
|
||||||
|
menu_selector = f'ul#{menu_id}[role="menu"]'
|
||||||
|
menu_locator = page.locator(menu_selector)
|
||||||
|
expect(menu_locator).to_be_visible()
|
||||||
|
|
||||||
|
|
||||||
|
delete_button = menu_locator.locator('button.action-button:has-text("Delete")')
|
||||||
|
expect(delete_button).to_be_visible()
|
||||||
|
delete_button.click()
|
||||||
|
|
||||||
|
expect(updated_event_title_locator).to_have_count(0)
|
||||||
|
sleep(SLEEP_TIME)
|
||||||
|
|
||||||
|
page.close()
|
||||||
|
log_note("Close browser")
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
if hasattr(e, 'message'): # only Playwright error class has this member
|
||||||
|
log_note(f"Exception occurred: {e.message}")
|
||||||
|
|
||||||
|
# set a timeout. Since the call to page.content() is blocking we need to defer it to the OS
|
||||||
|
signal.signal(signal.SIGALRM, timeout_handler)
|
||||||
|
signal.alarm(20)
|
||||||
|
#log_note(f"Page content was: {page.content()}")
|
||||||
|
signal.alarm(0) # remove timeout signal
|
||||||
|
|
||||||
|
raise e
|
||||||
|
|
||||||
|
# ---------------------
|
||||||
|
context.close()
|
||||||
|
browser.close()
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
if len(sys.argv) > 1:
|
||||||
|
browser_name = sys.argv[1].lower()
|
||||||
|
if browser_name not in ["chromium", "firefox"]:
|
||||||
|
print("Invalid browser name. Please choose either 'chromium' or 'firefox'.")
|
||||||
|
sys.exit(1)
|
||||||
|
else:
|
||||||
|
browser_name = "firefox"
|
||||||
|
|
||||||
|
with sync_playwright() as playwright:
|
||||||
|
run(playwright, browser_name)
|
180
energy-tests/nextcloud_files.py
Normal file
180
energy-tests/nextcloud_files.py
Normal file
|
@ -0,0 +1,180 @@
|
||||||
|
import contextlib
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
from time import time_ns, sleep
|
||||||
|
import signal
|
||||||
|
import random
|
||||||
|
import string
|
||||||
|
|
||||||
|
from playwright.sync_api import Playwright, sync_playwright, expect
|
||||||
|
|
||||||
|
from helpers.helper_functions import log_note, get_random_text, login_nextcloud, close_modal, timeout_handler
|
||||||
|
|
||||||
|
DOMAIN = 'https://ncs'
|
||||||
|
#DOMAIN = 'http://localhost:8080'
|
||||||
|
|
||||||
|
SLEEP_TIME = 1
|
||||||
|
|
||||||
|
FILE_PATH = '/tmp/repo/energy-tests/1mb.txt'
|
||||||
|
#FILE_PATH = '1mb.txt'
|
||||||
|
|
||||||
|
def download(playwright: Playwright, browser_name: str, download_url:str ,headless=False ) -> None:
|
||||||
|
log_note(f"Launch download browser {browser_name}")
|
||||||
|
|
||||||
|
download_path = os.path.join(os.getcwd(), 'downloads')
|
||||||
|
os.makedirs(download_path, exist_ok=True)
|
||||||
|
|
||||||
|
if browser_name == "firefox":
|
||||||
|
browser = playwright.firefox.launch(headless=headless, downloads_path=download_path)
|
||||||
|
else:
|
||||||
|
# this leverages new headless mode by Chromium: https://developer.chrome.com/articles/new-headless/
|
||||||
|
# The mode is however ~40% slower: https://github.com/microsoft/playwright/issues/21216
|
||||||
|
browser = playwright.chromium.launch(headless=headless,args=["--headless=new"])
|
||||||
|
|
||||||
|
|
||||||
|
context = browser.new_context(accept_downloads=True, ignore_https_errors=True)
|
||||||
|
page = context.new_page()
|
||||||
|
|
||||||
|
try:
|
||||||
|
|
||||||
|
page.goto(download_url)
|
||||||
|
|
||||||
|
download_url = page.locator("#downloadFile").get_attribute("href")
|
||||||
|
|
||||||
|
with page.expect_download() as download_info:
|
||||||
|
page.evaluate(f"window.location.href = '{download_url}'")
|
||||||
|
|
||||||
|
download = download_info.value
|
||||||
|
|
||||||
|
download_file_name = download_path + '/' + download.suggested_filename
|
||||||
|
download.save_as(download_file_name)
|
||||||
|
|
||||||
|
if os.path.exists(download_file_name):
|
||||||
|
if download_file_name_size := os.path.getsize(download_file_name) >= (1 * 1024 * 1024 - 16): # We substract 16 to avoid one off errors
|
||||||
|
log_note(f"File {download_file_name} downloaded")
|
||||||
|
else:
|
||||||
|
log_note(f"File {download_file_name} downloaded and right size: {download_file_name_size}")
|
||||||
|
raise ValueError(f"File not the right size")
|
||||||
|
else:
|
||||||
|
raise FileNotFoundError(f"File download failed")
|
||||||
|
|
||||||
|
log_note('Download worked ok')
|
||||||
|
|
||||||
|
page.close()
|
||||||
|
log_note("Close download browser")
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
if hasattr(e, 'message'): # only Playwright error class has this member
|
||||||
|
log_note(f"Exception occurred: {e.message}")
|
||||||
|
|
||||||
|
# set a timeout. Since the call to page.content() is blocking we need to defer it to the OS
|
||||||
|
signal.signal(signal.SIGALRM, timeout_handler)
|
||||||
|
signal.alarm(20)
|
||||||
|
#log_note(f"Page content was: {page.content()}")
|
||||||
|
signal.alarm(0) # remove timeout signal
|
||||||
|
|
||||||
|
raise e
|
||||||
|
|
||||||
|
# ---------------------
|
||||||
|
context.close()
|
||||||
|
browser.close()
|
||||||
|
|
||||||
|
def run(playwright: Playwright, browser_name: str, headless=False) -> None:
|
||||||
|
log_note(f"Launch browser {browser_name}")
|
||||||
|
if browser_name == "firefox":
|
||||||
|
browser = playwright.firefox.launch(headless=headless)
|
||||||
|
else:
|
||||||
|
# this leverages new headless mode by Chromium: https://developer.chrome.com/articles/new-headless/
|
||||||
|
# The mode is however ~40% slower: https://github.com/microsoft/playwright/issues/21216
|
||||||
|
browser = playwright.chromium.launch(headless=headless,args=["--headless=new"])
|
||||||
|
context = browser.new_context(ignore_https_errors=True)
|
||||||
|
page = context.new_page()
|
||||||
|
|
||||||
|
try:
|
||||||
|
page.goto(f"{DOMAIN}/login")
|
||||||
|
log_note("Login")
|
||||||
|
login_nextcloud(page, domain=DOMAIN)
|
||||||
|
|
||||||
|
log_note("Wait for welcome popup")
|
||||||
|
close_modal(page)
|
||||||
|
|
||||||
|
log_note("Go to Files")
|
||||||
|
page.get_by_role("link", name="Files").click()
|
||||||
|
|
||||||
|
sleep(SLEEP_TIME)
|
||||||
|
|
||||||
|
log_note("Upload File")
|
||||||
|
|
||||||
|
page.get_by_role("button", name="New").click()
|
||||||
|
|
||||||
|
div_selector = 'div.v-popper__wrapper:has(ul[role="menu"])'
|
||||||
|
page.wait_for_selector(div_selector, state='visible')
|
||||||
|
|
||||||
|
file_name = ''.join(random.choices(string.ascii_letters, k=5)) + '.txt'
|
||||||
|
|
||||||
|
with open(FILE_PATH, 'rb') as f:
|
||||||
|
file_content = f.read()
|
||||||
|
|
||||||
|
file_payload = {
|
||||||
|
'name': file_name,
|
||||||
|
'mimeType': 'text/plain',
|
||||||
|
'buffer': file_content,
|
||||||
|
}
|
||||||
|
|
||||||
|
with page.expect_file_chooser() as fc_info:
|
||||||
|
page.locator(f'{div_selector} button:has-text("Upload files")').click()
|
||||||
|
|
||||||
|
file_chooser = fc_info.value
|
||||||
|
file_chooser.set_files(file_payload)
|
||||||
|
|
||||||
|
updated_file_locator = page.locator(f'tr[data-cy-files-list-row-name="{file_name}"]')
|
||||||
|
expect(updated_file_locator).to_have_count(1)
|
||||||
|
|
||||||
|
# SHARE
|
||||||
|
log_note("Share File")
|
||||||
|
|
||||||
|
updated_file_locator.locator('button[data-cy-files-list-row-action="sharing-status"]').click()
|
||||||
|
|
||||||
|
page.locator('button.new-share-link').click()
|
||||||
|
|
||||||
|
toast_selector = 'div.toastify.toast-success:has-text("Link copied")'
|
||||||
|
page.wait_for_selector(toast_selector)
|
||||||
|
|
||||||
|
link_url = page.evaluate('navigator.clipboard.readText()')
|
||||||
|
log_note(f"Download url is: {link_url}")
|
||||||
|
|
||||||
|
sleep(SLEEP_TIME)
|
||||||
|
|
||||||
|
download(playwright, browser_name, link_url, headless)
|
||||||
|
|
||||||
|
page.close()
|
||||||
|
log_note("Close browser")
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
if hasattr(e, 'message'): # only Playwright error class has this member
|
||||||
|
log_note(f"Exception occurred: {e.message}")
|
||||||
|
|
||||||
|
# set a timeout. Since the call to page.content() is blocking we need to defer it to the OS
|
||||||
|
signal.signal(signal.SIGALRM, timeout_handler)
|
||||||
|
signal.alarm(20)
|
||||||
|
#log_note(f"Page content was: {page.content()}")
|
||||||
|
signal.alarm(0) # remove timeout signal
|
||||||
|
|
||||||
|
raise e
|
||||||
|
|
||||||
|
# ---------------------
|
||||||
|
context.close()
|
||||||
|
browser.close()
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
if len(sys.argv) > 1:
|
||||||
|
browser_name = sys.argv[1].lower()
|
||||||
|
if browser_name not in ["chromium", "firefox"]:
|
||||||
|
print("Invalid browser name. Please choose either 'chromium' or 'firefox'.")
|
||||||
|
sys.exit(1)
|
||||||
|
else:
|
||||||
|
browser_name = "firefox"
|
||||||
|
|
||||||
|
with sync_playwright() as playwright:
|
||||||
|
run(playwright, browser_name)
|
|
@ -5,22 +5,22 @@ from playwright.sync_api import sync_playwright
|
||||||
|
|
||||||
from helpers.helper_functions import log_note, get_random_text, login_nextcloud, close_modal, timeout_handler
|
from helpers.helper_functions import log_note, get_random_text, login_nextcloud, close_modal, timeout_handler
|
||||||
|
|
||||||
def main(browser_name: str = "chromium"):
|
def main(browser_name: str = "firefox", headless=False):
|
||||||
with sync_playwright() as playwright:
|
with sync_playwright() as playwright:
|
||||||
log_note(f"Launch browser {browser_name}")
|
log_note(f"Launch browser {browser_name}")
|
||||||
signal.signal(signal.SIGALRM, timeout_handler)
|
signal.signal(signal.SIGALRM, timeout_handler)
|
||||||
signal.alarm(10)
|
signal.alarm(10)
|
||||||
if browser_name == "firefox":
|
if browser_name == "firefox":
|
||||||
browser = playwright.firefox.launch(headless=True)
|
browser = playwright.firefox.launch(headless=headless)
|
||||||
else:
|
else:
|
||||||
# this leverages new headless mode by Chromium: https://developer.chrome.com/articles/new-headless/
|
# this leverages new headless mode by Chromium: https://developer.chrome.com/articles/new-headless/
|
||||||
# The mode is however ~40% slower: https://github.com/microsoft/playwright/issues/21216
|
# The mode is however ~40% slower: https://github.com/microsoft/playwright/issues/21216
|
||||||
browser = playwright.chromium.launch(headless=False,args=["--headless=new"])
|
browser = playwright.chromium.launch(headless=headless,args=["--headless=new"])
|
||||||
context = browser.new_context()
|
context = browser.new_context(ignore_https_errors=True)
|
||||||
page = context.new_page()
|
page = context.new_page()
|
||||||
signal.alarm(0) # remove timeout signal
|
signal.alarm(0) # remove timeout signal
|
||||||
try:
|
try:
|
||||||
page.goto('http://nc/')
|
page.goto('https://ncs')
|
||||||
|
|
||||||
# 1. Create User
|
# 1. Create User
|
||||||
log_note("Create admin user")
|
log_note("Create admin user")
|
||||||
|
@ -57,6 +57,6 @@ if __name__ == '__main__':
|
||||||
print("Invalid browser name. Please choose either 'chromium' or 'firefox'.")
|
print("Invalid browser name. Please choose either 'chromium' or 'firefox'.")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
else:
|
else:
|
||||||
browser_name = "chromium"
|
browser_name = "firefox"
|
||||||
|
|
||||||
main(browser_name)
|
main(browser_name)
|
||||||
|
|
|
@ -16,15 +16,15 @@ def send_message(sender, message):
|
||||||
sender.get_by_role("textbox").press("Enter")
|
sender.get_by_role("textbox").press("Enter")
|
||||||
log_note("GMT_SCI_R=1")
|
log_note("GMT_SCI_R=1")
|
||||||
|
|
||||||
def create_conversation(playwright: Playwright, browser_name: str) -> str:
|
def create_conversation(playwright: Playwright, browser_name: str, headless=False) -> str:
|
||||||
log_note(f"Launch browser {browser_name}")
|
log_note(f"Launch browser {browser_name}")
|
||||||
if browser_name == "firefox":
|
if browser_name == "firefox":
|
||||||
browser = playwright.firefox.launch(headless=True)
|
browser = playwright.firefox.launch(headless=headless)
|
||||||
else:
|
else:
|
||||||
# this leverages new headless mode by Chromium: https://developer.chrome.com/articles/new-headless/
|
# this leverages new headless mode by Chromium: https://developer.chrome.com/articles/new-headless/
|
||||||
# The mode is however ~40% slower: https://github.com/microsoft/playwright/issues/21216
|
# The mode is however ~40% slower: https://github.com/microsoft/playwright/issues/21216
|
||||||
browser = playwright.chromium.launch(headless=False,args=["--headless=new"])
|
browser = playwright.chromium.launch(headless=headless,args=["--headless=new"])
|
||||||
context = browser.new_context()
|
context = browser.new_context(ignore_https_errors=True)
|
||||||
page = context.new_page()
|
page = context.new_page()
|
||||||
try:
|
try:
|
||||||
log_note("Login as admin")
|
log_note("Login as admin")
|
||||||
|
@ -71,19 +71,21 @@ def create_conversation(playwright: Playwright, browser_name: str) -> str:
|
||||||
signal.alarm(0) # remove timeout signal
|
signal.alarm(0) # remove timeout signal
|
||||||
raise e
|
raise e
|
||||||
|
|
||||||
def talk(playwright: Playwright, url: str, browser_name: str) -> None:
|
def talk(playwright: Playwright, url: str, browser_name: str, headless=False) -> None:
|
||||||
action_delay_ms = 300
|
####
|
||||||
|
### DON"T FORGET TO SET THIS BACK TO 300 TODO
|
||||||
|
action_delay_ms = 0
|
||||||
browser_count = 5
|
browser_count = 5
|
||||||
|
|
||||||
# Launch browsers
|
# Launch browsers
|
||||||
log_note(f"Launching {browser_count} {browser_name} browsers")
|
log_note(f"Launching {browser_count} {browser_name} browsers")
|
||||||
if browser_name == "firefox":
|
if browser_name == "firefox":
|
||||||
browsers = [playwright.firefox.launch(headless=True, slow_mo=action_delay_ms) for _ in range(browser_count)]
|
browsers = [playwright.firefox.launch(headless=headless, slow_mo=action_delay_ms) for _ in range(browser_count)]
|
||||||
else:
|
else:
|
||||||
# this leverages new headless mode by Chromium: https://developer.chrome.com/articles/new-headless/
|
# this leverages new headless mode by Chromium: https://developer.chrome.com/articles/new-headless/
|
||||||
# The mode is however ~40% slower: https://github.com/microsoft/playwright/issues/21216
|
# The mode is however ~40% slower: https://github.com/microsoft/playwright/issues/21216
|
||||||
browsers = [playwright.chromium.launch(headless=False,args=["--headless=new"], slow_mo=action_delay_ms) for _ in range(browser_count)]
|
browsers = [playwright.chromium.launch(headless=headless,args=["--headless=new"], slow_mo=action_delay_ms) for _ in range(browser_count)]
|
||||||
contexts = [browser.new_context() for browser in browsers]
|
contexts = [browser.new_context(ignore_https_errors=True) for browser in browsers]
|
||||||
pages = [context.new_page() for context in contexts]
|
pages = [context.new_page() for context in contexts]
|
||||||
|
|
||||||
# Go to URL for all users
|
# Go to URL for all users
|
||||||
|
@ -143,7 +145,7 @@ with sync_playwright() as playwright:
|
||||||
print("Invalid browser name. Please choose either 'chromium' or 'firefox'.")
|
print("Invalid browser name. Please choose either 'chromium' or 'firefox'.")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
else:
|
else:
|
||||||
browser_name = "chromium"
|
browser_name = "firefox"
|
||||||
|
|
||||||
conversation_link = create_conversation(playwright, browser_name)
|
conversation_link = create_conversation(playwright, browser_name)
|
||||||
talk(playwright, conversation_link, browser_name)
|
talk(playwright, conversation_link, browser_name)
|
||||||
|
|
196
energy-tests/nextcloud_video.py
Normal file
196
energy-tests/nextcloud_video.py
Normal file
|
@ -0,0 +1,196 @@
|
||||||
|
import contextlib
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
from time import time_ns, sleep
|
||||||
|
import signal
|
||||||
|
import random
|
||||||
|
import string
|
||||||
|
from multiprocessing import Pool
|
||||||
|
|
||||||
|
from playwright.sync_api import Playwright, sync_playwright, expect
|
||||||
|
|
||||||
|
from helpers.helper_functions import log_note, get_random_text, login_nextcloud, close_modal, timeout_handler
|
||||||
|
|
||||||
|
DOMAIN = 'https://ncs'
|
||||||
|
#DOMAIN = 'http://localhost:8080'
|
||||||
|
|
||||||
|
SLEEP_TIME = 1
|
||||||
|
CHAT_SESSIONS = 2
|
||||||
|
CHAT_TIME_SEC = 10
|
||||||
|
|
||||||
|
def join(browser_name: str, download_url:str ,headless=False ) -> None:
|
||||||
|
with sync_playwright() as playwright:
|
||||||
|
log_note(f"Launching join browser {browser_name}")
|
||||||
|
if browser_name == "firefox":
|
||||||
|
browser = playwright.firefox.launch(headless=headless,
|
||||||
|
firefox_user_prefs = {
|
||||||
|
"media.navigator.streams.fake": True,
|
||||||
|
"media.navigator.permission.disabled": True
|
||||||
|
},
|
||||||
|
args=['-width', '1280', '-height', '720']
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
# this leverages new headless mode by Chromium: https://developer.chrome.com/articles/new-headless/
|
||||||
|
# The mode is however ~40% slower: https://github.com/microsoft/playwright/issues/21216
|
||||||
|
browser = playwright.chromium.launch(headless=headless,args=["--headless=new"])
|
||||||
|
|
||||||
|
context = browser.new_context(
|
||||||
|
ignore_https_errors=True,
|
||||||
|
viewport={'width': 1280, 'height': 720}
|
||||||
|
)
|
||||||
|
page = context.new_page()
|
||||||
|
|
||||||
|
try:
|
||||||
|
|
||||||
|
page.goto(download_url)
|
||||||
|
|
||||||
|
sleep(SLEEP_TIME)
|
||||||
|
|
||||||
|
guest_name = "Guest " + ''.join(random.choices(string.ascii_letters, k=5))
|
||||||
|
page.get_by_placeholder('Guest').fill(guest_name)
|
||||||
|
|
||||||
|
page.get_by_role('button', name="Submit name and join").click()
|
||||||
|
|
||||||
|
page.locator('.message-main').get_by_role("button", name="Join call").click()
|
||||||
|
|
||||||
|
|
||||||
|
page.locator('.media-settings__call-buttons').get_by_role("button", name="Join call").click()
|
||||||
|
|
||||||
|
log_note(f"{guest_name} joined the chat")
|
||||||
|
|
||||||
|
sleep(CHAT_TIME_SEC)
|
||||||
|
|
||||||
|
page.get_by_role("button", name="Leave call").click()
|
||||||
|
|
||||||
|
sleep(SLEEP_TIME)
|
||||||
|
|
||||||
|
page.close()
|
||||||
|
log_note("Close download browser")
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
if hasattr(e, 'message'): # only Playwright error class has this member
|
||||||
|
log_note(f"Exception occurred: {e.message}")
|
||||||
|
|
||||||
|
# set a timeout. Since the call to page.content() is blocking we need to defer it to the OS
|
||||||
|
signal.signal(signal.SIGALRM, timeout_handler)
|
||||||
|
signal.alarm(20)
|
||||||
|
#log_note(f"Page content was: {page.content()}")
|
||||||
|
signal.alarm(0) # remove timeout signal
|
||||||
|
|
||||||
|
raise e
|
||||||
|
|
||||||
|
# ---------------------
|
||||||
|
context.close()
|
||||||
|
browser.close()
|
||||||
|
|
||||||
|
def run(playwright: Playwright, browser_name: str, headless=False) -> None:
|
||||||
|
log_note(f"Launch browser {browser_name}")
|
||||||
|
if browser_name == "firefox":
|
||||||
|
browser = playwright.firefox.launch(headless=headless,
|
||||||
|
firefox_user_prefs = {
|
||||||
|
"media.navigator.streams.fake": True,
|
||||||
|
"media.navigator.permission.disabled": True
|
||||||
|
},
|
||||||
|
args=['-width', '1280', '-height', '720']
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
# this leverages new headless mode by Chromium: https://developer.chrome.com/articles/new-headless/
|
||||||
|
# The mode is however ~40% slower: https://github.com/microsoft/playwright/issues/21216
|
||||||
|
browser = playwright.chromium.launch(headless=headless,args=["--headless=new"])
|
||||||
|
|
||||||
|
context = browser.new_context(
|
||||||
|
ignore_https_errors=True,
|
||||||
|
viewport={'width': 1280, 'height': 720}
|
||||||
|
)
|
||||||
|
page = context.new_page()
|
||||||
|
|
||||||
|
try:
|
||||||
|
page.goto(f"{DOMAIN}/login")
|
||||||
|
log_note("Login")
|
||||||
|
login_nextcloud(page, domain=DOMAIN)
|
||||||
|
|
||||||
|
log_note("Wait for welcome popup")
|
||||||
|
#close_modal(page)
|
||||||
|
|
||||||
|
log_note("Go to Talk")
|
||||||
|
page.locator('#header a[title=Talk]').click()
|
||||||
|
page.wait_for_url("**/apps/spreed/")
|
||||||
|
|
||||||
|
sleep(SLEEP_TIME)
|
||||||
|
|
||||||
|
log_note("Start new chat session")
|
||||||
|
|
||||||
|
page.locator('button.action-item__menutoggle:has(.chat-plus-icon)').click()
|
||||||
|
|
||||||
|
page.locator('button.action-button.button-vue.focusable:has-text("Create a new conversation")').click()
|
||||||
|
|
||||||
|
chat_name = "Chat " + ''.join(random.choices(string.ascii_letters, k=5))
|
||||||
|
page.get_by_placeholder('Enter a name for this conversation').fill(chat_name)
|
||||||
|
|
||||||
|
page.locator(f'text="Allow guests to join via link"').click()
|
||||||
|
|
||||||
|
sleep(SLEEP_TIME)
|
||||||
|
|
||||||
|
page.get_by_role("button", name="Create conversation").click()
|
||||||
|
|
||||||
|
page.get_by_role("button", name="Copy conversation link").click()
|
||||||
|
|
||||||
|
sleep(SLEEP_TIME)
|
||||||
|
|
||||||
|
page.locator('.modal-container').locator('.empty-content__action').get_by_role('button', name="Close").click()
|
||||||
|
|
||||||
|
link_url = page.evaluate('navigator.clipboard.readText()')
|
||||||
|
|
||||||
|
log_note(f"Chat url is: {link_url}")
|
||||||
|
|
||||||
|
sleep(SLEEP_TIME)
|
||||||
|
|
||||||
|
page.get_by_role("button", name="Start call").click()
|
||||||
|
|
||||||
|
page.locator('.media-settings__call-buttons').get_by_role("button", name="Start call").click()
|
||||||
|
|
||||||
|
sleep(SLEEP_TIME)
|
||||||
|
|
||||||
|
log_note(f"Starting {CHAT_SESSIONS} Chat clients")
|
||||||
|
|
||||||
|
args = [(browser_name, link_url, headless) for _ in range(CHAT_SESSIONS)]
|
||||||
|
with Pool(processes=CHAT_SESSIONS) as pool:
|
||||||
|
pool.starmap(join, args)
|
||||||
|
|
||||||
|
page.get_by_role("button", name="Leave call").click()
|
||||||
|
page.get_by_role('menuitem', name='Leave call').click()
|
||||||
|
|
||||||
|
sleep(SLEEP_TIME)
|
||||||
|
|
||||||
|
|
||||||
|
page.close()
|
||||||
|
log_note("Close browser")
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
if hasattr(e, 'message'): # only Playwright error class has this member
|
||||||
|
log_note(f"Exception occurred: {e.message}")
|
||||||
|
|
||||||
|
# set a timeout. Since the call to page.content() is blocking we need to defer it to the OS
|
||||||
|
signal.signal(signal.SIGALRM, timeout_handler)
|
||||||
|
signal.alarm(20)
|
||||||
|
#log_note(f"Page content was: {page.content()}")
|
||||||
|
signal.alarm(0) # remove timeout signal
|
||||||
|
|
||||||
|
raise e
|
||||||
|
|
||||||
|
# ---------------------
|
||||||
|
context.close()
|
||||||
|
browser.close()
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
if len(sys.argv) > 1:
|
||||||
|
browser_name = sys.argv[1].lower()
|
||||||
|
if browser_name not in ["chromium", "firefox"]:
|
||||||
|
print("Invalid browser name. Please choose either 'chromium' or 'firefox'.")
|
||||||
|
sys.exit(1)
|
||||||
|
else:
|
||||||
|
browser_name = "firefox"
|
||||||
|
|
||||||
|
with sync_playwright() as playwright:
|
||||||
|
run(playwright, browser_name)
|
22
energy-tests/nginx-proxy/cert.crt
Normal file
22
energy-tests/nginx-proxy/cert.crt
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
-----BEGIN CERTIFICATE-----
|
||||||
|
MIIDkzCCAnugAwIBAgIUbgGmRU4uO4w65XAq47zIpfQSwggwDQYJKoZIhvcNAQEL
|
||||||
|
BQAwWTELMAkGA1UEBhMCVVMxDjAMBgNVBAgMBVN0YXRlMQ0wCwYDVQQHDARDaXR5
|
||||||
|
MRUwEwYDVQQKDAxPcmdhbml6YXRpb24xFDASBgNVBAMMC2V4YW1wbGUuY29tMB4X
|
||||||
|
DTI0MTExODE0MTYyN1oXDTI1MTExODE0MTYyN1owWTELMAkGA1UEBhMCVVMxDjAM
|
||||||
|
BgNVBAgMBVN0YXRlMQ0wCwYDVQQHDARDaXR5MRUwEwYDVQQKDAxPcmdhbml6YXRp
|
||||||
|
b24xFDASBgNVBAMMC2V4YW1wbGUuY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A
|
||||||
|
MIIBCgKCAQEAxJZRN2ZN1RBSJq1+5Que+x3BR7x/0G6wbQGpMM4z0S0axCdTEyKl
|
||||||
|
+Aa5K5L0fF5spTM4TQib0yKWtQmVQW1Cm9YKUBLoz+5rDKI2IweyLODjhtHlB9TS
|
||||||
|
YBqay0pj9jzzxDjdBmk77Jnobj9JlFFaXYhK3sU27u1RmLDsppsu9AajYV+gZHBP
|
||||||
|
Pb08lsATxAJ+CSF8ctTQPnBKqhB+L1y4hOuG/yVRt6BtcuMx0YpxPmBHGIOgCPNB
|
||||||
|
KHcHFNEoZqJeX50LPJA15mQ8P39DQb/Xg43SS3x1EW8/WkaJnBtuyshKFhA72IT6
|
||||||
|
n8cq21lTdoCmVnPedR3M+wM0eh6qOfIiDQIDAQABo1MwUTAdBgNVHQ4EFgQUBsjB
|
||||||
|
FARBMZtvs/sWw3iTZMOXgmowHwYDVR0jBBgwFoAUBsjBFARBMZtvs/sWw3iTZMOX
|
||||||
|
gmowDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAQEADPzCVABrC1Kb
|
||||||
|
8CckBpNr+SqV+7Nmx/fI3K+EP1RhI8lpQyVoURIRJbsCRRhuUrlwzG7cf/DATOPz
|
||||||
|
t2Zw2fS6RTbEv/eToZv+iQkDDhQ+SI31xkIS9/iSD4WnaKIp2HjQu0KGlKNsTMZo
|
||||||
|
eiU/IPSk4qAHATTHQrebpZG2LEDTpLXD8Ig5egbdkyNO0fPPwACU0lmbMwh+A6+z
|
||||||
|
Y1nh+JUHU+ceUOIAjEyjU56Wgw3rZZAMeN1u3hGdH5lZGHNhfx37ZtVytmhWWTo4
|
||||||
|
S80emxIBCL4ovTYv6ZBTiHoYmOEKFj5ywjgDtCJSbUuyzlJ+W2pRAKbesbkzD6wQ
|
||||||
|
Tq30ajMMUg==
|
||||||
|
-----END CERTIFICATE-----
|
28
energy-tests/nginx-proxy/cert.key
Normal file
28
energy-tests/nginx-proxy/cert.key
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
-----BEGIN PRIVATE KEY-----
|
||||||
|
MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDEllE3Zk3VEFIm
|
||||||
|
rX7lC577HcFHvH/QbrBtAakwzjPRLRrEJ1MTIqX4BrkrkvR8XmylMzhNCJvTIpa1
|
||||||
|
CZVBbUKb1gpQEujP7msMojYjB7Is4OOG0eUH1NJgGprLSmP2PPPEON0GaTvsmehu
|
||||||
|
P0mUUVpdiErexTbu7VGYsOymmy70BqNhX6BkcE89vTyWwBPEAn4JIXxy1NA+cEqq
|
||||||
|
EH4vXLiE64b/JVG3oG1y4zHRinE+YEcYg6AI80EodwcU0Shmol5fnQs8kDXmZDw/
|
||||||
|
f0NBv9eDjdJLfHURbz9aRomcG27KyEoWEDvYhPqfxyrbWVN2gKZWc951Hcz7AzR6
|
||||||
|
Hqo58iINAgMBAAECggEAA6Cz3oGPZ1hw8SFpLoMjJqFvYqH1bYuJlT+zd0y0vHTm
|
||||||
|
pwxHdzVu+g6rY6M58vvN8CRKEXNT4GX2WQIemx/7syMUbSqK5wud5QAUKTNhcjkl
|
||||||
|
xl1uOA4sLDV5DkdhwwQECjeOu45RU9rsZPDbQIKdZXknRIxaqKllRL14I3agVogx
|
||||||
|
fqWfzKfd6i044o4ZxvtfWPDOawb/o5d524WUqeU581ZFh217QKR6anc+m0mGtQj0
|
||||||
|
Gbwr9/giTNDuTbKeZTxdGcDUBVrZqXzd06TfdK5s6A6j3xTxih2hHvngR1KGVQGU
|
||||||
|
z+c/USgEVEvL0/UBt7+17UwYvaRvjxk98z/EnmNRgwKBgQDcrHgxPUdbg0aKxIa7
|
||||||
|
F/I/tmH0BKzFe7ZEti1nzHxOdAAGL5F08+ShBI8b/5djIxXq6VtBElHzF7VkCobH
|
||||||
|
mJXeBX123ggWxxBcH/qG5SgxUkTcZa0WYcoLSTHE7yILBT3EeYiFKpBYxsldc2uq
|
||||||
|
pxgPEMp9qljESat3AZUhS2t4jwKBgQDkDr8cLvqkL0TMZQqI2wNBhAIhIOmKQnt2
|
||||||
|
H/ILNLRRailHmXKTCTtD7xrg3GY4IMmy/LoJ/Az5cGEqS9qr4WPkMw5rmuofwLDz
|
||||||
|
tN0oAoKllV1Rn5stWmBi6fjHV0Uv7qtPFIshuuRQXTISPeatFCg80WEtZh0cIb7z
|
||||||
|
I2FqtP8xowKBgEx0bMgShRCNsPkPEebsav/r/o/+tqVNMV8pBx45WLANvJxoCqtM
|
||||||
|
fN/Upoh6y0aLt2JGK1mmMUJZ6nyYsQ2iLfpYSJnQX1kU6vQgGDp4Vq6P5E+/4nIo
|
||||||
|
u0mhuF6Uw2SyEi5qNQR+NLitVsLL5HehoNJHbQCQ7mRDaea3Y6W/baK9AoGBAL2R
|
||||||
|
NHJs6pLHZ9yusI8J3i77V/nJrdbrZEzQSRXffXOfVyjY+FAYgFb7zc/T5HQLbR2G
|
||||||
|
ze22weIl896ApwfwlmP9vKLdZnd2aKBrWtoDHC4fdi5/CTItyaju64hnlm89aNCX
|
||||||
|
Nv+WpmnWzeQz6Cc+diP3t1tRYikcM+lPI47bXLUZAoGAVAr5W6G3iyaM9wzLcO6H
|
||||||
|
SwFylG0YdZVs0tkiOQy47wFt6Tc7m5wjNT690JwgxjJTlye1ylklpNy3n0woUlb7
|
||||||
|
GY2ATci5xHD4mE13M32LlrUVUI0IcCsXawPIwrKmdGgjTAm6P8vBiLBTBBtQx2ut
|
||||||
|
XvU0WbG76PVCf7Sz2ND9Id4=
|
||||||
|
-----END PRIVATE KEY-----
|
17
energy-tests/nginx-proxy/default.conf
Normal file
17
energy-tests/nginx-proxy/default.conf
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
server {
|
||||||
|
listen 443 ssl;
|
||||||
|
server_name _;
|
||||||
|
|
||||||
|
ssl_certificate /etc/ssl/certs/cert.crt;
|
||||||
|
ssl_certificate_key /etc/ssl/private/cert.key;
|
||||||
|
|
||||||
|
ssl_protocols TLSv1.2 TLSv1.3;
|
||||||
|
ssl_ciphers HIGH:!aNULL:!MD5;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
proxy_pass http://nc;
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -10,8 +10,8 @@ services:
|
||||||
depends_on:
|
depends_on:
|
||||||
nc:
|
nc:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
# volumes:
|
volumes:
|
||||||
# - /tmp/.X11-unix:/tmp/.X11-unix # for debugging in non-headless mode
|
- /tmp/.X11-unix:/tmp/.X11-unix # for debugging in non-headless mode
|
||||||
environment:
|
environment:
|
||||||
DISPLAY: ":0" # for debugging in non-headless mode
|
DISPLAY: ":0" # for debugging in non-headless mode
|
||||||
|
|
103
energy-tests/usage_scenario-mariadb-all.yml
Normal file
103
energy-tests/usage_scenario-mariadb-all.yml
Normal file
|
@ -0,0 +1,103 @@
|
||||||
|
---
|
||||||
|
name: Nextcloud - MariaDB - Docs - Firefox
|
||||||
|
author: Danilo Jesic <danilo@green-coding.berlin>
|
||||||
|
description: Installs the official Nextcloud image with a MariaDB and collaborates on a document. Uses a playwright script running Firefox to create an admin account, install the recommended apps. Then creates a new user, creates a document and shares it. Finally, works on the document adding text from two browsers.
|
||||||
|
compose-file: !include compose-mariadb.yml
|
||||||
|
|
||||||
|
sci:
|
||||||
|
R_d: collaborative edit
|
||||||
|
|
||||||
|
services:
|
||||||
|
gcb-playwright:
|
||||||
|
image: greencoding/gcb_playwright:v12
|
||||||
|
depends_on:
|
||||||
|
nc:
|
||||||
|
condition: service_healthy
|
||||||
|
volumes:
|
||||||
|
- /tmp/.X11-unix:/tmp/.X11-unix # for debugging in non-headless mode
|
||||||
|
environment:
|
||||||
|
DISPLAY: ":1" # for debugging in non-headless mode
|
||||||
|
|
||||||
|
flow:
|
||||||
|
- name: Install
|
||||||
|
container: gcb-playwright
|
||||||
|
commands:
|
||||||
|
- type: console
|
||||||
|
command: python3 /tmp/repo/energy-tests/nextcloud_install.py firefox
|
||||||
|
note: Installs Nextcloud - You will only need this once
|
||||||
|
read-notes-stdout: true
|
||||||
|
log-stdout: true
|
||||||
|
log-stderr: true
|
||||||
|
- name: Create Calendar
|
||||||
|
container: gcb-playwright
|
||||||
|
commands:
|
||||||
|
- type: console
|
||||||
|
command: python3 /tmp/repo/energy-tests/nextcloud_events.py firefox
|
||||||
|
note: Creates, Edits and Deletes a calender entry
|
||||||
|
read-notes-stdout: true
|
||||||
|
log-stdout: true
|
||||||
|
log-stderr: true
|
||||||
|
- name: Create Contat
|
||||||
|
container: gcb-playwright
|
||||||
|
commands:
|
||||||
|
- type: console
|
||||||
|
command: python3 /tmp/repo/energy-tests/nextcloud_contacts.py firefox
|
||||||
|
note: Creates, Edits and Deletes a contact entry
|
||||||
|
read-notes-stdout: true
|
||||||
|
log-stdout: true
|
||||||
|
log-stderr: true
|
||||||
|
- name: File Sync
|
||||||
|
container: gcb-playwright
|
||||||
|
commands:
|
||||||
|
- type: console
|
||||||
|
command: python3 /tmp/repo/energy-tests/nextcloud_files.py firefox
|
||||||
|
note: Uploads and shares a file, then downloads it in a new browser window
|
||||||
|
read-notes-stdout: true
|
||||||
|
log-stdout: true
|
||||||
|
log-stderr: true
|
||||||
|
- name: Chatting
|
||||||
|
container: gcb-playwright
|
||||||
|
commands:
|
||||||
|
- type: console
|
||||||
|
command: python3 /tmp/repo/energy-tests/nextcloud_talk.py firefox
|
||||||
|
note: A litte chat between 5 browser windows
|
||||||
|
read-notes-stdout: true
|
||||||
|
log-stdout: true
|
||||||
|
log-stderr: true
|
||||||
|
- name: Video Chat
|
||||||
|
container: gcb-playwright
|
||||||
|
commands:
|
||||||
|
- type: console
|
||||||
|
command: python3 /tmp/repo/energy-tests/nextcloud_video.py firefox
|
||||||
|
note: A video conference between 3 people with camera and sound
|
||||||
|
read-notes-stdout: true
|
||||||
|
log-stdout: true
|
||||||
|
log-stderr: true
|
||||||
|
- name: Create User
|
||||||
|
container: gcb-playwright
|
||||||
|
commands:
|
||||||
|
- type: console
|
||||||
|
command: python3 /tmp/repo/energy-tests/nextcloud_create_user.py firefox
|
||||||
|
note: Create user
|
||||||
|
read-notes-stdout: true
|
||||||
|
log-stdout: true
|
||||||
|
log-stderr: true
|
||||||
|
- name: Create doc and share
|
||||||
|
container: gcb-playwright
|
||||||
|
commands:
|
||||||
|
- type: console
|
||||||
|
command: python3 /tmp/repo/energy-tests/nextcloud_create_doc_and_share.py firefox
|
||||||
|
note: Create document and share
|
||||||
|
read-notes-stdout: true
|
||||||
|
log-stdout: true
|
||||||
|
log-stderr: true
|
||||||
|
- name: Collaborate
|
||||||
|
container: gcb-playwright
|
||||||
|
commands:
|
||||||
|
- type: console
|
||||||
|
command: python3 /tmp/repo/energy-tests/nextcloud_docs_collaboration.py firefox
|
||||||
|
note: dev
|
||||||
|
read-notes-stdout: true
|
||||||
|
read-sci-stdout: true
|
||||||
|
log-stdout: true
|
||||||
|
log-stderr: true
|
|
@ -10,10 +10,10 @@ services:
|
||||||
depends_on:
|
depends_on:
|
||||||
nc:
|
nc:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
# volumes:
|
volumes:
|
||||||
# - /tmp/.X11-unix:/tmp/.X11-unix # for debugging in non-headless mode
|
- /tmp/.X11-unix:/tmp/.X11-unix # for debugging in non-headless mode
|
||||||
environment:
|
environment:
|
||||||
DISPLAY: ":0" # for debugging in non-headless mode
|
DISPLAY: ":1" # for debugging in non-headless mode
|
||||||
|
|
||||||
flow:
|
flow:
|
||||||
- name: Login and create event
|
- name: Login and create event
|
||||||
|
|
|
@ -10,17 +10,17 @@ services:
|
||||||
depends_on:
|
depends_on:
|
||||||
nc:
|
nc:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
# volumes:
|
volumes:
|
||||||
# - /tmp/.X11-unix:/tmp/.X11-unix # for debugging in non-headless mode
|
- /tmp/.X11-unix:/tmp/.X11-unix # for debugging in non-headless mode
|
||||||
environment:
|
environment:
|
||||||
DISPLAY: ":0" # for debugging in non-headless mode
|
DISPLAY: ":1" # for debugging in non-headless mode
|
||||||
|
|
||||||
flow:
|
flow:
|
||||||
- name: Install Nextcloud
|
- name: Install Nextcloud
|
||||||
container: gcb-playwright
|
container: gcb-playwright
|
||||||
commands:
|
commands:
|
||||||
- type: console
|
- type: console
|
||||||
command: python3 /tmp/repo/energy-tests/nextcloud_install.py
|
command: python3 /tmp/repo/energy-tests/nextcloud_install.py firefox
|
||||||
note: Installing Nextcloud
|
note: Installing Nextcloud
|
||||||
read-notes-stdout: true
|
read-notes-stdout: true
|
||||||
log-stdout: true
|
log-stdout: true
|
||||||
|
|
Loading…
Add table
Reference in a new issue