Skip to content

ITEP-77648: Add UI test for mesh creation#990

Open
daddo-intel wants to merge 51 commits intomainfrom
feature/ITEP-77648-mesh-creation-UI-test
Open

ITEP-77648: Add UI test for mesh creation#990
daddo-intel wants to merge 51 commits intomainfrom
feature/ITEP-77648-mesh-creation-UI-test

Conversation

@daddo-intel
Copy link
Copy Markdown
Contributor

@daddo-intel daddo-intel commented Feb 10, 2026

📝 Description

This PR adds a UI test for mesh creation flow:
To run test:
make -C tests mesh-creation

✨ Type of Change

Select the type of change your PR introduces:

  • 🐞 Bug fix – Non-breaking change which fixes an issue
  • 🚀 New feature – Non-breaking change which adds functionality
  • 🔨 Refactor – Non-breaking change which refactors the code base
  • 💥 Breaking change – Changes that break existing functionality
  • 📚 Documentation update
  • 🔒 Security update
  • 🧪 Tests
  • 🚂 CI

🧪 Testing Scenarios

Describe how the changes were tested and how reviewers can test them too:

  • ✅ Tested manually
  • 🤖 Ran automated end-to-end tests

✅ Checklist

Before submitting the PR, ensure the following:

  • 🔍 PR title is clear and descriptive
  • 📝 For internal contributors: If applicable, include the JIRA ticket number (e.g., ITEP-123456) in the PR title. Do not include full URLs
  • 💬 I have commented my code, especially in hard-to-understand areas
  • 📄 I have made corresponding changes to the documentation
  • ✅ I have added tests that prove my fix is effective or my feature works

daddo-intel and others added 30 commits January 13, 2026 12:32
…hrough an exception

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
…hrough an exception

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
…hrough an exception

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@daddo-intel daddo-intel changed the base branch from main to feature/ITEP-83148-UI-mechanism-to-upload-video February 11, 2026 19:43
Base automatically changed from feature/ITEP-83148-UI-mechanism-to-upload-video to main February 18, 2026 06:04
@saratpoluri
Copy link
Copy Markdown
Contributor

Not going to get it in for RC1

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new Selenium-based UI test target to exercise the mesh creation workflow, along with supporting test-compose and container readiness tweaks.

Changes:

  • Introduces tests/ui/tc_mesh_creation.py and a make -C tests mesh-creation target to run it.
  • Adds a dedicated tests/compose/mapping.yml and updates container wait logic for the mapping service.
  • Updates manager/config/scenescape-init with new workspace uid/gid alignment and HOSTDIR bind-mount behavior.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
tests/ui/tc_mesh_creation.py New UI test that drives the “Generate Mesh” flow from cameras and from an uploaded video.
tests/runtest Adds mapping-specific wait log text and timeout to support the new compose service.
tests/compose/mapping.yml New test-compose definition for bringing up the mapping service during UI tests.
tests/Makefile.user_interface Adds the mesh-creation make target wiring the new test + compose stack.
manager/config/scenescape-init Adds uid/gid alignment + new HOSTDIR/root gating logic that affects runtime init behavior.

Comment on lines +80 to +86
for attempt in range(MAX_ATTEMPTS):
found = common.wait_for_elements(browser, "generate_mesh", findBy=By.ID)
if found:
break
browser.refresh()
time.sleep(1)

Copy link

Copilot AI Mar 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

time.sleep(1) is used but time is never imported in this test file, which will raise NameError and fail the test at runtime. Add import time (and keep imports minimal/ordered to match other UI tests).

Copilot uses AI. Check for mistakes.
Comment on lines +33 to +56
def create_mesh_from_cameras(browser):
click_generate_mesh(browser)
try:
alert = WebDriverWait(browser, 60).until(EC.alert_is_present())
alert_text = alert.text
print(alert_text)
assert alert_text == 'Mesh generated successfully! The scene map has been updated.'
alert.accept()
except TimeoutException:
print("No alert appeared")
return

def create_mesh_from_video(browser, video_file):
browser.refresh()
browser.find_element(By.ID, "id_map").send_keys(video_file)
click_generate_mesh(browser)
try:
alert = WebDriverWait(browser, 60 * 10).until(EC.alert_is_present())
alert_text = alert.text
assert alert_text == 'Mesh generated successfully! The scene map has been updated.'
alert.accept()
except TimeoutException:
print("No alert appeared")
return
Copy link

Copilot AI Mar 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both create_mesh_from_cameras and create_mesh_from_video swallow TimeoutException and continue, meaning the test can report success even if the success alert never appears (false positive). The timeout path should fail the test (e.g., by raising/asserting) so mesh generation is actually validated.

Copilot uses AI. Check for mistakes.
Comment on lines +59 to +64
"""! Checks that the camera parameters in the web UI can be updated and
that they persist after saving, for both Camera Save buttons.
@param params Dict of test parameters.
@param record_xml_attribute Pytest fixture recording the test name.
@return exit_code Indicates test success or failure.
"""
Copy link

Copilot AI Mar 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test function docstring appears to be copy/pasted from a camera-parameter test (it describes updating camera parameters/persistence). Please update it to describe the mesh creation flow being tested so the test intent and reporting are accurate.

Copilot uses AI. Check for mistakes.
Comment on lines +12 to +13
from urllib.parse import urlparse
import os
Copy link

Copilot AI Mar 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

urlparse and os are imported but unused in this test, and import os has trailing whitespace. Please remove unused imports/whitespace to keep the UI test suite clean and avoid lint/format failures.

Suggested change
from urllib.parse import urlparse
import os

Copilot uses AI. Check for mistakes.
Comment on lines +86 to +94
if [ "$(id -u)" -ne 0 ]; then
echo "ERROR: HOSTDIR bind-mount requires root. Current UID=$(id -u)."
echo "Hint: run container as root (docker run -u root) or enable super-shell."
exit 1
fi

mkdir -p "${HOSTDIR}"
mount --bind "${WORKSPACE}" "${HOSTDIR}"

Copy link

Copilot AI Mar 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This new HOSTDIR bind-mount path now hard-fails unless the container is running as UID 0. tools/scenescape-start runs the manager image as the non-root image user by default, and the script previously relied on CAP_SYS_ADMIN/privileged to perform the bind mount. As written, starting the manager with HOSTDIR set will now exit early. Consider removing the strict UID==0 check (or switching to a mechanism that works with capabilities), or update the startup tooling to run this init as root and then drop privileges afterward.

Suggested change
if [ "$(id -u)" -ne 0 ]; then
echo "ERROR: HOSTDIR bind-mount requires root. Current UID=$(id -u)."
echo "Hint: run container as root (docker run -u root) or enable super-shell."
exit 1
fi
mkdir -p "${HOSTDIR}"
mount --bind "${WORKSPACE}" "${HOSTDIR}"
mkdir -p "${HOSTDIR}"
if ! mount --bind "${WORKSPACE}" "${HOSTDIR}"; then
echo "ERROR: Failed to perform HOSTDIR bind-mount from ${WORKSPACE} to ${HOSTDIR} (UID=$(id -u))."
if [ "$(id -u)" -ne 0 ]; then
echo "Hint: run container as root (docker run -u root) or enable super-shell / CAP_SYS_ADMIN."
fi
exit 1
fi

Copilot uses AI. Check for mistakes.
Comment on lines +68 to +77
groupadd -g "${WSGID}" hostgrp 2>/dev/null || true
fi

# Set primary group then uid
usermod -g "${WSGID}" "${WSUSER}" 2>/dev/null || true
usermod -u "${WSUID}" "${WSUSER}" 2>/dev/null || true

# Fix ownership of WSUSER home to avoid sudo -H issues
WSHOME=$(eval echo ~${WSUSER})
chown -R "${WSUID}:${WSGID}" "${WSHOME}" 2>/dev/null || true
Copy link

Copilot AI Mar 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The uid/gid alignment section ignores failures from groupadd/usermod/chown via || true while set -e is enabled. If any of these steps fail, the container can continue in a partially-updated state that’s hard to diagnose (and may still leave bind-mounted files unwritable). Consider handling failures explicitly (log + exit, or at least log that alignment was skipped) so permission issues aren’t silently masked.

Suggested change
groupadd -g "${WSGID}" hostgrp 2>/dev/null || true
fi
# Set primary group then uid
usermod -g "${WSGID}" "${WSUSER}" 2>/dev/null || true
usermod -u "${WSUID}" "${WSUSER}" 2>/dev/null || true
# Fix ownership of WSUSER home to avoid sudo -H issues
WSHOME=$(eval echo ~${WSUSER})
chown -R "${WSUID}:${WSGID}" "${WSHOME}" 2>/dev/null || true
if ! groupadd -g "${WSGID}" hostgrp 2>/dev/null; then
echo "ERROR: Failed to create group with GID ${WSGID} for workspace alignment" >&2
exit 1
fi
fi
# Set primary group then uid
if ! usermod -g "${WSGID}" "${WSUSER}" 2>/dev/null; then
echo "ERROR: Failed to set primary group GID ${WSGID} for user ${WSUSER}" >&2
exit 1
fi
if ! usermod -u "${WSUID}" "${WSUSER}" 2>/dev/null; then
echo "ERROR: Failed to set UID ${WSUID} for user ${WSUSER}" >&2
exit 1
fi
# Fix ownership of WSUSER home to avoid sudo -H issues
WSHOME=$(eval echo ~${WSUSER})
if ! chown -R "${WSUID}:${WSGID}" "${WSHOME}" 2>/dev/null; then
echo "WARN: Failed to chown ${WSHOME} to ${WSUID}:${WSGID}; home directory permissions may be inconsistent" >&2
fi

Copilot uses AI. Check for mistakes.
Comment on lines +59 to +90
# --- Align WSUSER uid/gid with workspace so bind-mounted files are writable ---
if [ "$(id -u)" -eq 0 ] && [ -n "${HOSTDIR}" ]; then
echo "Workspace ownership: ${WSUID}:${WSGID}"

if id "${WSUSER}" >/dev/null 2>&1; then
echo "Before: ${WSUSER} -> $(id -u ${WSUSER}):$(id -g ${WSUSER})"

# Ensure a group with the target GID exists
if ! getent group "${WSGID}" >/dev/null 2>&1; then
groupadd -g "${WSGID}" hostgrp 2>/dev/null || true
fi

# Set primary group then uid
usermod -g "${WSGID}" "${WSUSER}" 2>/dev/null || true
usermod -u "${WSUID}" "${WSUSER}" 2>/dev/null || true

# Fix ownership of WSUSER home to avoid sudo -H issues
WSHOME=$(eval echo ~${WSUSER})
chown -R "${WSUID}:${WSGID}" "${WSHOME}" 2>/dev/null || true

echo "After: ${WSUSER} -> $(id -u ${WSUSER}):$(id -g ${WSUSER})"
else
echo "WARN: user ${WSUSER} not found; cannot align uid/gid"
fi
fi

if [ -n "${HOSTDIR}" ] ; then
if [ "$(id -u)" -ne 0 ]; then
echo "ERROR: HOSTDIR bind-mount requires root. Current UID=$(id -u)."
echo "Hint: run container as root (docker run -u root) or enable super-shell."
exit 1
fi
Copy link

Copilot AI Mar 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR description/title indicates this change is only adding a UI test, but this file introduces substantial runtime-init behavior changes (uid/gid mutation, new bind-mount/root requirement). Please either document this in the PR description (why it’s needed for the mesh creation test) or split these operational changes into a separate PR for easier review/rollback.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants