Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions docs/TROUBLESHOOTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ Solutions to common issues when using PWA Forge.
- [Firefox Not Supported for PWAs](#firefox-not-supported-for-pwas)
- [Invalid URL Error](#invalid-url-error)
- [Launch Issues](#launch-issues)
- [PWA Fails to Launch - SingletonLock Error](#pwa-fails-to-launch---singletonlock-error)
- [PWA Fails to Launch - Invalid Ozone Platform Error](#pwa-fails-to-launch---invalid-ozone-platform-error)
- [PWA Doesn't Appear in Application Menu](#pwa-doesnt-appear-in-application-menu)
- [External Link Handling](#external-link-handling)
- [Desktop Integration](#desktop-integration)
- [Browser Issues](#browser-issues)
Expand Down Expand Up @@ -275,6 +278,37 @@ Lock file is already locked by another process

**Solution:** See [Snap-Confined Browsers Not Supported](#️-snap-confined-browsers-not-supported) section above.

### PWA Fails to Launch - Invalid Ozone Platform Error

**Problem:** PWA fails to launch with ozone platform error.

```
[FATAL:ui/ozone/platform_selection.cc:46] Invalid ozone platform: auto
```

**Cause:** The `--ozone-platform=auto` flag is incompatible with your system configuration.

**Solution:**

PWA Forge now defaults to `--ozone-platform=x11` which is more compatible. If you have an existing PWA with this issue:

```bash
# Recreate the PWA (this will update the wrapper script)
pwa-forge remove <app-id>
pwa-forge add <url> --name "<name>" --id <app-id>

# Or manually edit the wrapper script
nano ~/.local/bin/pwa-forge-wrappers/<app-id>
# Change: --ozone-platform=auto
# To: --ozone-platform=x11
```

If you need Wayland support, you can specify it when creating the PWA:

```bash
pwa-forge add <url> --chrome-flags "ozone-platform=wayland"
```

### PWA Doesn't Appear in Application Menu

**Problem:** PWA was created but doesn't show in launcher.
Expand Down
11 changes: 9 additions & 2 deletions src/pwa_forge/commands/add.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,14 +143,17 @@ def add_app(
logger.info(f"[DRY-RUN] Would create profile directory: {profile_path}")

# Generate wrapper script
# Use custom ozone_platform if provided in flags, otherwise default to x11
ozone_platform = parsed_flags.get("ozone_platform") or "x11"

wrapper_content = render_template(
"wrapper.j2",
{
"name": name,
"id": app_id,
"browser_exec": str(browser_exec),
"wm_class": wm_class,
"ozone_platform": parsed_flags.get("ozone_platform", "auto"),
"ozone_platform": ozone_platform,
"url": url,
"profile": str(profile_path),
"enable_features": parsed_flags.get("enable_features", []),
Expand Down Expand Up @@ -404,14 +407,16 @@ def _parse_chrome_flags(flags_str: str) -> dict[str, Any]:
"""Parse Chrome flags string.

Args:
flags_str: Semicolon-separated flags string (e.g., "enable-features=A,B;disable-features=C").
flags_str: Semicolon-separated flags string
(e.g., "enable-features=A,B;disable-features=C;ozone-platform=wayland").

Returns:
Dictionary with parsed flags.
"""
result: dict[str, Any] = {
"enable_features": [],
"disable_features": [],
"ozone_platform": None,
"additional": "",
}

Expand All @@ -427,6 +432,8 @@ def _parse_chrome_flags(flags_str: str) -> dict[str, Any]:
elif flag.startswith("disable-features="):
features = flag.replace("disable-features=", "").split(",")
result["disable_features"] = [f.strip() for f in features if f.strip()]
elif flag.startswith("ozone-platform="):
result["ozone_platform"] = flag.replace("ozone-platform=", "").strip()
else:
# Unknown flags go to additional
if result["additional"]:
Expand Down
36 changes: 36 additions & 0 deletions tests/integration/test_pwa_lifecycle.py
Original file line number Diff line number Diff line change
Expand Up @@ -925,3 +925,39 @@ def mock_write_text(self: Path, *args: Any, **kwargs: Any) -> None:
browser="chrome",
dry_run=False,
)

def test_add_uses_x11_ozone_platform_by_default(self, test_config: IsolatedConfig) -> None:
"""Test that add command uses x11 ozone platform by default."""
add_app(
url="https://example.com",
config=test_config,
name="Ozone Platform Test",
app_id="ozone-test",
browser="chrome",
dry_run=False,
)

# Check wrapper script contains x11 ozone platform
wrapper_path = test_config.wrappers_dir / "ozone-test"
wrapper_content = wrapper_path.read_text()

assert "--ozone-platform=x11" in wrapper_content
assert "--ozone-platform=auto" not in wrapper_content

def test_add_allows_custom_ozone_platform(self, test_config: IsolatedConfig) -> None:
"""Test that add command allows custom ozone platform via chrome flags."""
add_app(
url="https://example.com",
config=test_config,
name="Custom Ozone Test",
app_id="custom-ozone-test",
browser="chrome",
chrome_flags="ozone-platform=wayland",
dry_run=False,
)

# Check wrapper script contains wayland ozone platform
wrapper_path = test_config.wrappers_dir / "custom-ozone-test"
wrapper_content = wrapper_path.read_text()

assert "--ozone-platform=wayland" in wrapper_content
19 changes: 19 additions & 0 deletions tests/unit/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,25 @@ def test_add_command_invalid_url(self) -> None:
assert result.exit_code == 1
assert "Error" in result.output or "invalid" in result.output.lower()

def test_add_command_firefox_not_supported(self) -> None:
"""Test add command rejects Firefox with helpful error message."""
runner = CliRunner()
result = runner.invoke(cli.cli, ["add", "https://example.com", "--browser", "firefox"])
assert result.exit_code == 2
assert "Firefox is not supported" in result.output
assert "app/SSB" in result.output or "Site-Specific Browser" in result.output
assert "Google Chrome" in result.output or "Chromium" in result.output

def test_add_command_invalid_browser(self) -> None:
"""Test add command rejects invalid browser with helpful error message."""
runner = CliRunner()
result = runner.invoke(cli.cli, ["add", "https://example.com", "--browser", "safari"])
assert result.exit_code == 2
assert "not a supported browser" in result.output
assert "chrome" in result.output
assert "chromium" in result.output
assert "edge" in result.output


class TestAuditCommandOptions:
"""Test audit command with various options."""
Expand Down
Loading