@@ -104,86 +104,26 @@ jobs:
104104 mkdir -p artifacts
105105 IMG=$(find image/ -name '*.img' | head -1)
106106 docker run -d --name octopi-test \
107- -p 9980:9980 \
108107 -v "$PWD/artifacts:/output" \
109108 -v "$(realpath $IMG):/input/image.img:ro" \
110109 -e ARTIFACTS_DIR=/output \
111110 -e DISTRO_NAME="OctoPi" \
112- -e KEEP_ALIVE=true \
113111 octopi-e2e-test
114112
115113 - name : Wait for tests to complete
116114 run : |
117- for i in $(seq 1 180 ); do
115+ for i in $(seq 1 300 ); do
118116 [ -f artifacts/exit-code ] && break
119117 sleep 5
120118 done
121119 if [ ! -f artifacts/exit-code ]; then
122- echo "ERROR: Tests did not complete within 15 minutes"
120+ echo "ERROR: Tests did not complete within 25 minutes"
123121 docker logs octopi-test 2>&1 | tail -80
124122 exit 1
125123 fi
126124 echo "Tests finished with exit code: $(cat artifacts/exit-code)"
127125 cat artifacts/test-results.txt 2>/dev/null || true
128126
129- - name : Wait for OctoPrint to fully start
130- run : |
131- echo "Waiting for OctoPrint to finish startup..."
132- for i in $(seq 1 90); do
133- BODY=$(curl -4 -s --connect-timeout 5 http://127.0.0.1:9980 2>/dev/null || true)
134- if echo "$BODY" | grep -q "CONFIG_WIZARD"; then
135- echo "OctoPrint fully started (Setup Wizard ready)"
136- exit 0
137- elif echo "$BODY" | grep -q "starting up"; then
138- printf "S"
139- else
140- printf "."
141- fi
142- sleep 5
143- done
144- echo ""
145- echo "WARNING: OctoPrint may not be fully started yet, proceeding anyway"
146-
147- - name : Take OctoPrint screenshot
148- run : |
149- npm install puppeteer
150- node -e "
151- const puppeteer = require('puppeteer');
152- (async () => {
153- const browser = await puppeteer.launch({
154- headless: 'new', args: ['--no-sandbox']
155- });
156- const page = await browser.newPage();
157- await page.setViewport({width: 1280, height: 900});
158-
159- // Retry loading until OctoPrint finishes its startup phase
160- for (let attempt = 0; attempt < 30; attempt++) {
161- await page.goto('http://127.0.0.1:9980', {
162- waitUntil: 'networkidle2', timeout: 60000
163- });
164- const html = await page.content();
165- if (html.includes('CONFIG_WIZARD') || html.includes('id=\"login\"')) break;
166- console.log('OctoPrint still starting up, retrying in 10s... (attempt ' + (attempt+1) + ')');
167- await new Promise(r => setTimeout(r, 10000));
168- }
169-
170- // Wait for the Setup Wizard dialog to appear
171- try {
172- await page.waitForSelector('#wizard_dialog', { visible: true, timeout: 120000 });
173- } catch (e) {
174- console.log('Wizard did not appear, taking screenshot of current state');
175- }
176-
177- // Dismiss notification popovers by clicking the wizard body
178- try { await page.click('#wizard_dialog .modal-body'); } catch(e) {}
179- await new Promise(r => setTimeout(r, 2000));
180-
181- await page.screenshot({path: 'artifacts/octoprint-screenshot.png'});
182- console.log('Screenshot captured');
183- await browser.close();
184- })();
185- "
186-
187127 - name : Collect logs and stop container
188128 if : always()
189129 run : |
0 commit comments