mirror of
https://github.com/nextcloud/docker.git
synced 2025-03-15 19:05:09 +01:00
Cleanup
This commit is contained in:
parent
089a3f196f
commit
bedeec0605
5 changed files with 10 additions and 111 deletions
|
@ -1,64 +0,0 @@
|
||||||
import asyncio
|
|
||||||
import time
|
|
||||||
from playwright.async_api import async_playwright
|
|
||||||
|
|
||||||
async def main():
|
|
||||||
async with async_playwright() as playwright:
|
|
||||||
browser_type = playwright.chromium
|
|
||||||
browser = await browser_type.launch(headless=True, args=["--no-sandbox", "--disable-setuid-sandbox", "--disable-dev-shm-usage"])
|
|
||||||
page = await browser.new_page()
|
|
||||||
# await page.set_default_timeout(60_000) # milliseconds
|
|
||||||
await page.goto('http://app/login')
|
|
||||||
|
|
||||||
# 1. Login
|
|
||||||
user_element = await page.wait_for_selector('//*[@data-login-form-input-user]')
|
|
||||||
await user_element.type('Crash')
|
|
||||||
pass_element = await page.wait_for_selector('//*[@data-login-form-input-password]')
|
|
||||||
await pass_element.type('Override')
|
|
||||||
await page.click('.button-vue--vue-primary')
|
|
||||||
print(time.time(), "Login clicked")
|
|
||||||
|
|
||||||
# Handle unsupported browsers warning
|
|
||||||
unsupported_element = await page.wait_for_selector('.content-unsupported-browser__continue')
|
|
||||||
if unsupported_element:
|
|
||||||
await unsupported_element.click()
|
|
||||||
print(time.time(), "Unsupported browsers warning clicked")
|
|
||||||
|
|
||||||
await page.wait_for_navigation(wait_until='domcontentloaded', url='http://app/apps/dashboard/')
|
|
||||||
|
|
||||||
# Wait for the modal to load and close
|
|
||||||
await asyncio.sleep(3)
|
|
||||||
|
|
||||||
# 2. Close Modal
|
|
||||||
modal_close = await page.wait_for_selector('.modal-container__close')
|
|
||||||
await modal_close.click()
|
|
||||||
print(time.time(), "Intro video modal clicked")
|
|
||||||
|
|
||||||
# Wait for the modal animation to complete
|
|
||||||
await asyncio.sleep(3)
|
|
||||||
|
|
||||||
# 3. Go to Cal
|
|
||||||
await page.click('a[href="/apps/calendar/"]')
|
|
||||||
print(time.time(), "Calendar clicked")
|
|
||||||
|
|
||||||
# 4. Open New Event Box
|
|
||||||
new_event_selector = await page.wait_for_selector('.new-event')
|
|
||||||
await new_event_selector.click()
|
|
||||||
print(time.time(), "New event clicked")
|
|
||||||
|
|
||||||
# 4. Create Event
|
|
||||||
title_selector = await page.wait_for_selector('input[placeholder="Event title"]')
|
|
||||||
await title_selector.type('NYC2600 Meeting')
|
|
||||||
save_selector = await page.wait_for_selector('text=Save')
|
|
||||||
await save_selector.click()
|
|
||||||
print(time.time(), "Save event clicked")
|
|
||||||
|
|
||||||
# 5. Wait for the event
|
|
||||||
await page.wait_for_selector('text=NYC2600 Meeting')
|
|
||||||
print(time.time(), "Event found! Fin")
|
|
||||||
|
|
||||||
await browser.close()
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
asyncio.run(main())
|
|
|
@ -1,31 +0,0 @@
|
||||||
from playwright.sync_api import Playwright, sync_playwright
|
|
||||||
|
|
||||||
|
|
||||||
def run(playwright: Playwright) -> None:
|
|
||||||
browser = playwright.chromium.launch(headless=False)
|
|
||||||
context = browser.new_context()
|
|
||||||
page = context.new_page()
|
|
||||||
page.goto("http://localhost:8080/login")
|
|
||||||
page.get_by_label("Account name or email").click()
|
|
||||||
page.get_by_label("Account name or email").fill("Crash")
|
|
||||||
page.get_by_label("Password", exact=True).click()
|
|
||||||
page.get_by_label("Password", exact=True).fill("Override")
|
|
||||||
page.get_by_role("button", name="Log in").click()
|
|
||||||
page.get_by_role("link", name="Open settings menu").click()
|
|
||||||
page.get_by_role("link", name="Users").click()
|
|
||||||
page.get_by_role("button", name="New user").click()
|
|
||||||
page.get_by_placeholder("Username").click()
|
|
||||||
page.get_by_placeholder("Username").fill("Splash")
|
|
||||||
page.get_by_placeholder("Display name").click()
|
|
||||||
page.get_by_placeholder("Display name").fill("Splash")
|
|
||||||
page.get_by_placeholder("Password", exact=True).click()
|
|
||||||
page.get_by_placeholder("Password", exact=True).fill("cymbals3533")
|
|
||||||
page.get_by_role("button", name="Add a new user").click()
|
|
||||||
|
|
||||||
# ---------------------
|
|
||||||
context.close()
|
|
||||||
browser.close()
|
|
||||||
|
|
||||||
|
|
||||||
with sync_playwright() as playwright:
|
|
||||||
run(playwright)
|
|
|
@ -9,7 +9,7 @@ def main():
|
||||||
args=["--no-sandbox", "--disable-setuid-sandbox", "--disable-dev-shm-usage"]
|
args=["--no-sandbox", "--disable-setuid-sandbox", "--disable-dev-shm-usage"]
|
||||||
)
|
)
|
||||||
page = browser.new_page()
|
page = browser.new_page()
|
||||||
page.goto('http://localhost:8080/')
|
page.goto('http://nc/')
|
||||||
page.set_default_timeout(120_000)
|
page.set_default_timeout(120_000)
|
||||||
|
|
||||||
# 1. Create User
|
# 1. Create User
|
||||||
|
@ -27,7 +27,6 @@ def main():
|
||||||
# 3. Dashboard
|
# 3. Dashboard
|
||||||
page.wait_for_selector('.app-dashboard')
|
page.wait_for_selector('.app-dashboard')
|
||||||
print(time(), "Dashboard found")
|
print(time(), "Dashboard found")
|
||||||
page.get_by_role("button", name="Close modal").click()
|
|
||||||
|
|
||||||
browser.close()
|
browser.close()
|
||||||
|
|
||||||
|
|
|
@ -2,10 +2,10 @@ from playwright.sync_api import Playwright, sync_playwright
|
||||||
|
|
||||||
|
|
||||||
def create_conversation(playwright: Playwright) -> str:
|
def create_conversation(playwright: Playwright) -> str:
|
||||||
browser = playwright.chromium.launch(headless=False)
|
browser = playwright.chromium.launch(headless=True)
|
||||||
context = browser.new_context()
|
context = browser.new_context()
|
||||||
page = context.new_page()
|
page = context.new_page()
|
||||||
page.goto("http://localhost:8080/login")
|
page.goto("http://nc/login")
|
||||||
page.get_by_label("Account name or email").click()
|
page.get_by_label("Account name or email").click()
|
||||||
page.get_by_label("Account name or email").fill("Crash")
|
page.get_by_label("Account name or email").fill("Crash")
|
||||||
page.get_by_label("Account name or email").press("Tab")
|
page.get_by_label("Account name or email").press("Tab")
|
||||||
|
@ -30,8 +30,8 @@ def create_conversation(playwright: Playwright) -> str:
|
||||||
return page.url
|
return page.url
|
||||||
|
|
||||||
def talk(playwright: Playwright, url: str) -> None:
|
def talk(playwright: Playwright, url: str) -> None:
|
||||||
browser_one = playwright.chromium.launch(headless=False, slow_mo=1500)
|
browser_one = playwright.chromium.launch(headless=True, slow_mo=1500)
|
||||||
browser_two = playwright.chromium.launch(headless=False, slow_mo=1500)
|
browser_two = playwright.chromium.launch(headless=True, slow_mo=1500)
|
||||||
context_one = browser_one.new_context()
|
context_one = browser_one.new_context()
|
||||||
context_two = browser_two.new_context()
|
context_two = browser_two.new_context()
|
||||||
user_one = context_one.new_page()
|
user_one = context_one.new_page()
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
---
|
---
|
||||||
name: NextCloud MariaDB
|
name: NextCloud MariaDB - Chrome Talk
|
||||||
author: Didi Hoffmann <didi@green-coding.berlin>
|
author: Danilo Jesic <danilo@green-coding.berlin>
|
||||||
version: 1
|
version: 1
|
||||||
description: Installs the official NextCloud image and creates an user and event
|
description: Installs the official NextCloud image and creates a user and starts a Talk conversation
|
||||||
compose-file: !include compose.yml
|
compose-file: !include compose.yml
|
||||||
|
|
||||||
services:
|
services:
|
||||||
|
@ -13,12 +13,7 @@ services:
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
setup-commands:
|
setup-commands:
|
||||||
- cp /tmp/repo/nextcloud/chrome/apache_mariadb/nextcloud_install_playwright.py /tmp/nextcloud_install_playwright.py
|
- cp /tmp/repo/nextcloud/chrome/apache_mariadb/nextcloud_install_playwright.py /tmp/nextcloud_install_playwright.py
|
||||||
- cp /tmp/repo/nextcloud/chrome/apache_mariadb/nextcloud_create_event_playwright.py /tmp/nextcloud_create_event_playwright.py
|
- cp /tmp/repo/nextcloud/chrome/apache_mariadb/nextcloud_talk_playwright.py /tmp/nextcloud_talk_playwright.py
|
||||||
# gcb-puppeteer:
|
|
||||||
# image: greencoding/puppeteer-chrome
|
|
||||||
# setup-commands:
|
|
||||||
# - cp /tmp/repo/nextcloud/chrome/apache_mariadb/nextcloud_install_puppeteer.js /var/www/nextcloud_install_puppeteer.js
|
|
||||||
# - cp /tmp/repo/nextcloud/chrome/apache_mariadb/nextcloud_create_event_puppeteer.js /var/www/nextcloud_create_event_puppeteer.js
|
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
- nextcloud-setup-network
|
- nextcloud-setup-network
|
||||||
|
@ -50,6 +45,6 @@ flow:
|
||||||
note: Installing Nextcloud
|
note: Installing Nextcloud
|
||||||
read-notes-stdout: true
|
read-notes-stdout: true
|
||||||
- type: console
|
- type: console
|
||||||
command: python3 /tmp/nextcloud_create_event_playwright.py
|
command: python3 /tmp/nextcloud_talk_playwright.py
|
||||||
note: Creating Event
|
note: Creating Event
|
||||||
read-notes-stdout: true
|
read-notes-stdout: true
|
||||||
|
|
Loading…
Add table
Reference in a new issue