File tree Expand file tree Collapse file tree 3 files changed +42
-48
lines changed
wordpress-official-starter Expand file tree Collapse file tree 3 files changed +42
-48
lines changed Original file line number Diff line number Diff line change 1+ from time import time_ns
2+ from playwright .sync_api import sync_playwright
3+
4+ def log_note (message : str ) -> None :
5+ timestamp = str (time_ns ())[:16 ]
6+ print (f"{ timestamp } { message } " )
7+
8+ with sync_playwright () as playwright :
9+ log_note ('Launching browser' )
10+
11+ browser = playwright .chromium .launch (headless = True )
12+ context = browser .new_context (ignore_https_errors = True , viewport = {"width" : 1920 , "height" : 1080 })
13+ page = context .new_page ()
14+
15+ dimensions = page .evaluate ("""
16+ () => {
17+ return {
18+ width: document.documentElement.clientWidth,
19+ height: document.documentElement.clientHeight,
20+ deviceScaleFactor: window.devicePixelRatio,
21+ }
22+ }
23+ """ )
24+ # print("Dimensions:", dimensions) # Optional check
25+
26+ log_note ('Home Page' )
27+ page .goto ("http://gcb-wordpress:9875" , wait_until = "networkidle" )
28+
29+ # Wait until logo is visible
30+ page .locator ('p#logo' ).wait_for (timeout = 30 )
31+
32+
33+ # Example of navigating to another page:
34+ # page.goto("http://gcb-wordpress:9875/my-sample-page", wait_until="networkidle")
35+
36+ log_note ('Closing browser' )
37+ browser .close ()
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 11---
2- name : Wordpress Basic Puppeteer Scenario
3- author : Arne Tarara <arne@green-coding.berlin >
2+ name : Wordpress Basic Playwright Scenario
3+ author : Arne Tarara <arne@green-coding.io >
44description : Simple Wordpress where just the Homepage with the install instructions is accessed. Mostly used for testing wordpress build and startup times.
55compose-file : !include compose.yml
66
77services :
88 gcb-puppeteer :
9- image : greencoding/puppeteer-chrome
10- setup-commands :
11- - cp /tmp/repo/wordpress-official-starter/puppeteer-flow.js /var/www/puppeteer-flow.js
9+ image : greencoding/gcb_playwright:v16
1210 networks :
1311 - gcb-mariadb-wordpress-network
1412
1715 container : gcb-puppeteer
1816 commands :
1917 - type : console
20- command : node /var/www/puppeteer- flow.js
21- note : Starting Puppeteer Flow
18+ command : python3 /tmp/repo/wordpress-official-starter/playwright- flow.py
19+ note : Starting User Journey
2220 read-notes-stdout : true
2321 log-stdout : true
2422 log-stderr : true
25-
26-
You can’t perform that action at this time.
0 commit comments