Skip to content

armgit / plexo

Public Imported from GitHub
0

Speed up downloads by combining multiple network connections in parallel

Fix nightly E2E lifecycle, progress visibility and cross-platform checks (#90)

Anmol Kapil3272d6b1745c
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 1edf8af..f77b727 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -58,7 +58,7 @@ jobs:
# Electron needs a display even with its window hidden.
- name: Run smoke tests
- run: xvfb-run --auto-servernum npm run test:e2e:smoke
+ run: xvfb-run --auto-servernum --server-args="-screen 0 1280x1024x24 -noreset" npm run test:e2e:smoke
- name: Upload report
if: failure()
diff --git a/.github/workflows/e2e-nightly.yml b/.github/workflows/e2e-nightly.yml
index aeb8275..2ade5c2 100644
--- a/.github/workflows/e2e-nightly.yml
+++ b/.github/workflows/e2e-nightly.yml
@@ -39,9 +39,11 @@ jobs:
# The @disk tests mount small tmpfs volumes, which needs passwordless sudo (GitHub's
# Linux runners have it); elsewhere they skip themselves.
+ # Keep Xvfb alive between Electron launches: resetting when its last client exits can
+ # race the next parallel launch and fail before the application starts.
- name: Full suite (Linux)
if: runner.os == 'Linux'
- run: xvfb-run --auto-servernum npx playwright test
+ run: xvfb-run --auto-servernum --server-args="-screen 0 1280x1024x24 -noreset" npx playwright test
env:
PLEXO_E2E_SKIP_BUILD: '1'
@@ -52,7 +54,7 @@ jobs:
PLEXO_E2E_SKIP_BUILD: '1'
- name: Race-prone tests, repeated
- run: ${{ runner.os == 'Linux' && 'xvfb-run --auto-servernum ' || '' }}npx playwright test e2e/lifecycle.spec.ts e2e/recovery.spec.ts --repeat-each=10
+ run: ${{ runner.os == 'Linux' && 'xvfb-run --auto-servernum --server-args="-screen 0 1280x1024x24 -noreset" ' || '' }}npx playwright test e2e/lifecycle.spec.ts e2e/recovery.spec.ts --repeat-each=10
env:
PLEXO_E2E_SKIP_BUILD: '1'
diff --git a/e2e/downloads.spec.ts b/e2e/downloads.spec.ts
index dd1b9fc..af5da4a 100644
--- a/e2e/downloads.spec.ts
+++ b/e2e/downloads.spec.ts
@@ -2,6 +2,8 @@ import { createRequire } from 'node:module'
import { resolve } from 'node:path'
import { _electron as electron, expect, test, type Locator, type Page } from '@playwright/test'
+import { electronArgs } from './fixtures'
+
// M. The download page: what each file is called, which one a visitor is offered, and that the
// page says so. The logic lives in docs/downloads.js; the page is checked by loading the real
// docs/index.html in a hidden window as a visitor with a given browser would see it.
@@ -275,10 +277,7 @@ async function openPage(
options: { architecture?: 'arm' | 'x86'; releases?: unknown; apiStatus?: number } = {}
): Promise<{ page: Page; close: () => Promise<void> }> {
const app = await electron.launch({
- args: [
- resolve(__dirname, 'page-host/main.cjs'),
- ...(process.platform === 'linux' ? ['--no-sandbox'] : [])
- ],
+ args: electronArgs(resolve(__dirname, 'page-host/main.cjs')),
env: {
...(process.env as Record<string, string>),
PAGE_SCENARIO: JSON.stringify({
@@ -568,21 +567,37 @@ test.describe('the download page', () => {
const chartBounds = await page.locator('.demo-chart').boundingBox()
expect(flowBounds?.x).toBeLessThan(totalBounds?.x ?? 0)
expect(totalBounds?.x).toBeLessThan(chartBounds?.x ?? 0)
+ // Classic scrollbars consume viewport width on Linux and Windows. The demo must fill
+ // the space actually available inside the hero, rather than a macOS-specific width.
+ await expect
+ .poll(async () => {
+ const frame = await page.locator('.demo-frame').boundingBox()
+ const stage = await page.locator('.demo-stage').boundingBox()
+ return frame && stage ? Math.abs(frame.width - stage.width) : Infinity
+ })
+ .toBeLessThanOrEqual(1)
const demoBounds = await page.locator('.demo-frame').boundingBox()
- expect(demoBounds?.width).toBeLessThanOrEqual(342)
- expect(demoBounds?.width).toBeGreaterThan(330)
+ const availableWidth = await page.evaluate(() => document.documentElement.clientWidth)
+ expect(demoBounds!.width).toBeGreaterThan(availableWidth * 0.8)
+ expect(demoBounds!.x).toBeGreaterThanOrEqual(0)
+ expect(demoBounds!.x + demoBounds!.width).toBeLessThanOrEqual(availableWidth)
for (const tab of await page.locator('.os-tabs button').all()) {
- const padding = await tab.evaluate((button) => {
+ const content = await tab.evaluate((button) => {
const buttonRect = button.getBoundingClientRect()
const iconRect = button.querySelector('svg')?.getBoundingClientRect()
const labelRect = button.querySelector('span')?.getBoundingClientRect()
return {
left: (iconRect?.left ?? buttonRect.left) - buttonRect.left,
- right: buttonRect.right - (labelRect?.right ?? buttonRect.right)
+ right: buttonRect.right - (labelRect?.right ?? buttonRect.right),
+ height: buttonRect.height
}
})
- expect(padding.left).toBeGreaterThanOrEqual(12)
- expect(padding.right).toBeGreaterThanOrEqual(12)
+ // Font metrics vary by host. Protect usable targets and unclipped content, not a
+ // cosmetic gap measured between the icon/text and the button's edge.
+ expect(content.left).toBeGreaterThanOrEqual(0)
+ expect(content.right).toBeGreaterThanOrEqual(0)
+ expect(content.height).toBeGreaterThanOrEqual(44)
+ await expect(tab).toBeEnabled()
}
await expect(page.locator('#panel-mac .asset-link')).toHaveCount(2)
for (const card of await page.locator('#panel-mac .architecture-card').all()) {
diff --git a/e2e/fixtures.ts b/e2e/fixtures.ts
index 2081ea4..896d0ab 100644
--- a/e2e/fixtures.ts
+++ b/e2e/fixtures.ts
@@ -1,4 +1,5 @@
import type {} from '../src/preload/globals'
+import assert from 'node:assert/strict'
import { execFile } from 'node:child_process'
import { existsSync } from 'node:fs'
import { mkdir, mkdtemp, readdir, readFile, realpath, rm, stat } from 'node:fs/promises'
@@ -40,6 +41,11 @@ export function expectTorrent(state: DownloadState): TorrentDownloadState {
export const PROJECT_ROOT = resolve(__dirname, '..')
+/** Every raw Electron launch needs the same CI sandbox policy. */
+export function electronArgs(entry: string, args: string[] = []): string[] {
+ return [entry, ...args, ...(process.platform === 'linux' ? ['--no-sandbox'] : [])]
+}
+
/** Small blocks so a ~1 MB test file still splits into many of them. */
export const BLOCK = 64 * 1024
@@ -112,7 +118,7 @@ export class PlexoApp {
while (true) {
try {
this.electronApp = await electron.launch({
- args: [PROJECT_ROOT, ...args, ...(process.platform === 'linux' ? ['--no-sandbox'] : [])],
+ args: electronArgs(PROJECT_ROOT, args),
env: {
...(process.env as Record<string, string>),
PLEXO_USER_DATA: this.dirs.userData,
@@ -174,9 +180,19 @@ export class PlexoApp {
/** Kills the main process outright — no before-quit, no suspend: a crash or power cut. */
async kill(): Promise<void> {
const child = this.electronApp.process()
- const exited = new Promise((resolve) => child.once('exit', resolve))
- child.kill('SIGKILL')
- await exited
+ if (child.exitCode !== null || child.signalCode !== null) {
+ this.alive = false
+ return
+ }
+ // Windows does not propagate killing the main process to Chromium's children. They retain
+ // the profile lock and open databases, preventing both relaunch and fixture disposal.
+ const closed = new Promise<void>((resolve) => child.once('close', () => resolve()))
+ if (process.platform === 'win32') {
+ await promisify(execFile)('taskkill', ['/pid', String(child.pid), '/T', '/F'])
+ } else {
+ child.kill('SIGKILL')
+ }
+ await closed
this.alive = false
}
@@ -379,62 +395,77 @@ const ALLOWED_NEXT: Record<DownloadStatus, DownloadStatus[]> = {
cancelled: ['cancelled']
}
-/** Rules every download event must satisfy, whatever the scenario. */
+/** Rules every download event must satisfy, whatever the scenario. Node assertions keep this
+ * exhaustive scan synchronous without creating a report step for every block of every event.
+ * Failures still carry the download, status and work-unit context. */
export function checkEvents(sessions: DownloadState[][]): void {
for (const events of sessions) {
const lastStatus = new Map<string, DownloadStatus>()
for (const state of events) {
const label = `${state.id} @ ${state.status}`
if (state.totalBytes > 0) {
- expect(state.bytesDownloaded, `${label}: bytesDownloaded ≤ totalBytes`).toBeLessThanOrEqual(
- state.totalBytes
+ assert.ok(
+ state.bytesDownloaded <= state.totalBytes,
+ `${label}: bytesDownloaded ≤ totalBytes`
)
}
const units = state.kind === 'http' ? state.blocks : state.pieces
- expect(
+ assert.equal(
units.every((unit, index) => unit.index === index),
+ true,
`${label}: every work unit is there, in order`
- ).toBe(true)
- expect(units.length, `${label}: as many work units as planned`).toBe(
- state.kind === 'http' ? state.totalBlocks : state.totalPieces
+ )
+ assert.equal(
+ units.length,
+ state.kind === 'http' ? state.totalBlocks : state.totalPieces,
+ `${label}: as many work units as planned`
)
for (const unit of units) {
const attributed = Object.values(unit.bytesByInterface).reduce((a, b) => a + b, 0)
- expect(attributed, `${label}: unit ${unit.index} attribution sums to its bytes`).toBe(
- unit.bytesDownloaded
+ assert.equal(
+ attributed,
+ unit.bytesDownloaded,
+ `${label}: unit ${unit.index} attribution sums to its bytes`
)
if (unit.rangeEnd !== null) {
const size = unit.rangeEnd - unit.rangeStart + 1
- expect(
- unit.bytesDownloaded,
- `${label}: unit ${unit.index} within its size`
- ).toBeLessThanOrEqual(size)
+ assert.ok(unit.bytesDownloaded <= size, `${label}: unit ${unit.index} within its size`)
if (unit.status === 'completed') {
- expect(unit.bytesDownloaded, `${label}: completed unit ${unit.index} is full`).toBe(
- size
+ assert.equal(
+ unit.bytesDownloaded,
+ size,
+ `${label}: completed unit ${unit.index} is full`
)
}
}
if (unit.kind === 'torrent') {
- expect(unit.provisionalBytes).toBeGreaterThanOrEqual(0)
- expect(unit.provisionalBytes).toBeLessThanOrEqual(
- unit.rangeEnd === null ? 0 : unit.rangeEnd - unit.rangeStart + 1
+ assert.ok(unit.provisionalBytes >= 0)
+ assert.ok(
+ unit.provisionalBytes <=
+ (unit.rangeEnd === null ? 0 : unit.rangeEnd - unit.rangeStart + 1)
)
}
}
if (state.kind === 'torrent') {
+ assert.equal(
+ new Set(state.peers.map((peer) => peer.id)).size,
+ state.peers.length,
+ `${label}: peer IDs are unique across networks`
+ )
// Peers are connections, not piece owners. Each belongs to one known network and exposes
// only transfer telemetry; verified progress belongs to pieces above.
for (const peer of state.peers) {
- expect(
- state.networks.map((network) => network.id),
+ assert.ok(
+ state.networks.map((network) => network.id).includes(peer.interfaceId),
`${label}: peer ${peer.id} is on a network of this download`
- ).toContain(peer.interfaceId)
- expect(['connected', 'receiving']).toContain(peer.status)
+ )
+ assert.ok(['connected', 'receiving'].includes(peer.status))
}
const uploaded = state.networks.reduce((sum, network) => sum + network.bytesUploaded, 0)
- expect(uploaded, `${label}: the networks' uploads add up to the download's`).toBe(
- state.bytesUploaded
+ assert.equal(
+ uploaded,
+ state.bytesUploaded,
+ `${label}: the networks' uploads add up to the download's`
)
} else if (state.status === 'downloading') {
// A stream holds a block exactly while it is fetching it. A block has at most one stream
@@ -444,32 +475,37 @@ export function checkEvents(sessions: DownloadState[][]): void {
const hedges = new Map<number, number>()
for (const stream of state.streams) {
const holding = stream.currentBlockIndex !== undefined
- expect(holding, `${label}: stream ${stream.id} (${stream.status}) holds a block`).toBe(
- stream.status === 'downloading'
+ assert.equal(
+ holding,
+ stream.status === 'downloading',
+ `${label}: stream ${stream.id} (${stream.status}) holds a block`
)
if (stream.currentBlockIndex === undefined) {
- expect(stream.hedge, `${label}: idle stream ${stream.id} is not racing`).toBeFalsy()
+ assert.ok(!stream.hedge, `${label}: idle stream ${stream.id} is not racing`)
continue
}
const tally = stream.hedge ? hedges : primaries
tally.set(stream.currentBlockIndex, (tally.get(stream.currentBlockIndex) ?? 0) + 1)
}
for (const [index, count] of primaries) {
- expect(count, `${label}: block ${index} has one stream fetching it`).toBe(1)
+ assert.equal(count, 1, `${label}: block ${index} has one stream fetching it`)
}
for (const [index, count] of hedges) {
- expect(count, `${label}: block ${index} has at most two hedges`).toBeLessThanOrEqual(2)
+ assert.ok(count <= 2, `${label}: block ${index} has at most two hedges`)
}
for (const index of primaries.keys()) {
- expect(state.blocks[index]?.status, `${label}: held block ${index} is in flight`).toBe(
- 'downloading'
+ assert.equal(
+ state.blocks[index]?.status,
+ 'downloading',
+ `${label}: held block ${index} is in flight`
)
}
}
const previous = lastStatus.get(state.id)
if (previous) {
- expect(ALLOWED_NEXT[previous], `${state.id}: ${previous} → ${state.status}`).toContain(
- state.status
+ assert.ok(
+ ALLOWED_NEXT[previous].includes(state.status),
+ `${state.id}: ${previous} → ${state.status}`
)
}
lastStatus.set(state.id, state.status)
diff --git a/e2e/invariants.spec.ts b/e2e/invariants.spec.ts
new file mode 100644
index 0000000..a87cee9
--- /dev/null
+++ b/e2e/invariants.spec.ts
@@ -0,0 +1,69 @@
+import { expect, test } from '@playwright/test'
+import type { HttpDownloadState } from '../src/shared/types'
+import { checkEvents } from './fixtures'
+
+const paused = (): HttpDownloadState => ({
+ kind: 'http',
+ id: 'invariant-download',
+ url: 'http://example.test/file',
+ fileName: 'file',
+ destinationPath: '/tmp/file',
+ totalBytes: 100,
+ bytesDownloaded: 100,
+ speedBytesPerSec: 0,
+ status: 'paused',
+ networks: [],
+ streams: [],
+ peakStreams: 0,
+ totalBlocks: 1,
+ blockSizeBytes: 100,
+ startedAt: 0,
+ blocks: [
+ {
+ kind: 'http',
+ index: 0,
+ rangeStart: 0,
+ rangeEnd: 99,
+ status: 'completed',
+ bytesDownloaded: 100,
+ bytesByInterface: { a: 100 }
+ }
+ ]
+})
+
+test('event validation retains integrity failures and download context', () => {
+ const valid = paused()
+ expect(() =>
+ checkEvents([[valid, { ...valid, status: 'downloading' }, { ...valid, status: 'completed' }]])
+ ).not.toThrow()
+
+ const corrupt = paused()
+ corrupt.blocks[0].bytesByInterface.a = 99
+ expect(() => checkEvents([[corrupt]])).toThrow(/invariant-download.*unit 0 attribution/)
+
+ const short = paused()
+ short.blocks[0].bytesDownloaded = 99
+ short.blocks[0].bytesByInterface.a = 99
+ expect(() => checkEvents([[short]])).toThrow(/invariant-download.*completed unit 0 is full/)
+
+ expect(() => checkEvents([[{ ...valid, status: 'completed' }, valid]])).toThrow(
+ /completed → paused/
+ )
+})
+
+test('event validation checks long histories without per-block report steps', () => {
+ const state = paused()
+ state.blocks = Array.from({ length: 256 }, (_, index) => ({
+ ...state.blocks[0],
+ index,
+ rangeStart: index * 100,
+ rangeEnd: index * 100 + 99
+ }))
+ state.totalBlocks = state.blocks.length
+ state.totalBytes = state.bytesDownloaded = state.totalBlocks * 100
+ const history = Array.from({ length: 1000 }, () => state)
+ expect(() => checkEvents([history])).not.toThrow()
+ // A failure at the end must still be inspected, rather than sampling a large history.
+ const bad = { ...state, bytesDownloaded: state.totalBytes + 1 }
+ expect(() => checkEvents([[...history, bad]])).toThrow(/bytesDownloaded ≤ totalBytes/)
+})
diff --git a/e2e/openLinks.spec.ts b/e2e/openLinks.spec.ts
index cbd9dfb..dfaf097 100644
--- a/e2e/openLinks.spec.ts
+++ b/e2e/openLinks.spec.ts
@@ -1,7 +1,7 @@
import type { Locator } from '@playwright/test'
import { spawn } from 'node:child_process'
import { createRequire } from 'node:module'
-import { expect, PROJECT_ROOT, test, type PlexoApp } from './fixtures'
+import { electronArgs, expect, PROJECT_ROOT, test, type PlexoApp } from './fixtures'
import { seededBytes } from './origin'
import { named, Swarm, torrentFileOnDisk } from './torrentSwarm'
@@ -39,13 +39,24 @@ test.describe('links handed over by the OS', () => {
plexo
}) => {
const electronBinary = createRequire(__filename)('electron') as string
- const second = spawn(electronBinary, [PROJECT_ROOT, MAGNET], {
+ const second = spawn(electronBinary, electronArgs(PROJECT_ROOT, [MAGNET]), {
env: { ...process.env, PLEXO_USER_DATA: plexo.dirs.userData, PLEXO_E2E_HIDE_WINDOW: '1' },
- stdio: 'ignore'
+ stdio: ['ignore', 'pipe', 'pipe']
})
- const exitCode = await new Promise<number | null>((resolve) => second.once('exit', resolve))
-
- expect(exitCode).toBe(0)
+ const output: string[] = []
+ second.stdout?.on('data', (data) => output.push(String(data)))
+ second.stderr?.on('data', (data) => output.push(String(data)))
+ try {
+ const exit = await new Promise<{ code: number | null; signal: string | null }>(
+ (resolve, reject) => {
+ second.once('error', reject)
+ second.once('close', (code, signal) => resolve({ code, signal }))
+ }
+ )
+ expect(exit, output.join('')).toEqual({ code: 0, signal: null })
+ } finally {
+ if (second.exitCode === null && second.signalCode === null) second.kill('SIGKILL')
+ }
await expect(linkField(plexo)).toHaveValue(MAGNET)
})
diff --git a/e2e/selection.spec.ts b/e2e/selection.spec.ts
index ab611e4..e5fdb15 100644
--- a/e2e/selection.spec.ts
+++ b/e2e/selection.spec.ts
@@ -120,10 +120,13 @@ test('trashing finished torrent files preserves unrelated files in the torrent f
await plexo.page
.getByRole('checkbox', { name: `Select ${completed.fileName}`, exact: true })
.check()
- await plexo.page.getByRole('button', { name: /^Move files to Trash…/ }).click()
+ const trashName = process.platform === 'win32' ? 'Recycle Bin' : 'Trash'
+ await plexo.page
+ .getByRole('button', { name: `Move files to ${trashName}… (1)`, exact: true })
+ .click()
await plexo.page
.getByRole('alertdialog')
- .getByRole('button', { name: 'Move files to Trash', exact: true })
+ .getByRole('button', { name: `Move files to ${trashName}`, exact: true })
.click()
await expect(plexo.page.getByText('No downloads yet', { exact: true })).toBeVisible()
expect(await readFile(join(completed.destinationPath, 'personal.txt'), 'utf8')).toBe('keep me')
diff --git a/e2e/ui.spec.ts b/e2e/ui.spec.ts
index c987c15..c32fcdb 100644
--- a/e2e/ui.spec.ts
+++ b/e2e/ui.spec.ts
@@ -25,6 +25,9 @@ async function stubNativeUi(
}
test.describe('a torrent through the UI', () => {
+ // This journey inspects a peer row, not network reassignment. Keep one network stable;
+ // routing across networks and globally unique peer IDs are checked by torrent specs/invariants.
+ test.use({ appEnv: { PLEXO_E2E_INTERFACES: interfacesEnv({ a: NETWORKS.a }) } })
test('choose its files, watch its peers, finish', async ({ plexo, dirs }) => {
const swarm = await new Swarm().start()
try {
@@ -72,11 +75,7 @@ test.describe('a torrent through the UI', () => {
// What it runs. A peer has no progress of its own: a dash, not a bar.
await expect(peerRow).toContainText('WebTorrent')
await expect(peerRow.getByRole('progressbar')).toHaveCount(0)
- // Each peer's number is its own across the download: no two rows share one, whichever
- // networks they're on.
- for (const button of await page.getByRole('button', { name: /^\d+ peers?/ }).all()) {
- if ((await button.getAttribute('aria-expanded')) !== 'true') await button.click()
- }
+ // Each rendered peer has its own number.
const numbers = (await page.getByText(/^Peer #\d+$/).allTextContents()).map((text) =>
text.trim()
)
@@ -114,6 +113,55 @@ test.describe('a torrent through the UI', () => {
})
test.describe('UI journeys @smoke', () => {
+ test('minimum window keeps download controls and a network row in view', async ({
+ plexo,
+ serve
+ }) => {
+ const minimum = await plexo.evaluateMain(({ BrowserWindow }) => {
+ const window = BrowserWindow.getAllWindows()[0]
+ const [width, height] = window.getMinimumSize()
+ window.setSize(width, height)
+ return { minimum: [width, height], size: window.getSize() }
+ }, null)
+ expect(minimum.minimum).toEqual([720, 620])
+ expect(minimum.size).toEqual(minimum.minimum)
+ const origin = await serve({ size: SIZE })
+ const reached = origin.hold(0)
+ await plexo.start(origin.url(), origin.sha256)
+ await reached
+ const page = plexo.page
+ await page.getByRole('button', { name: 'Open test.bin', exact: true }).click()
+ // An empty bar is still a progress indicator: its track and accessible value must exist
+ // before the server sends the first byte.
+ const progress = page.getByRole('table', { name: 'Networks' }).getByRole('progressbar').first()
+ await expect(progress).toHaveAttribute('aria-valuenow', '0')
+ await expect(progress).toBeVisible()
+ await expect(page.getByRole('button', { name: 'Pause', exact: true })).toBeInViewport({
+ ratio: 1
+ })
+ await expect(page.getByRole('columnheader', { name: 'Network', exact: true })).toBeInViewport({
+ ratio: 1
+ })
+ await expect(
+ page.getByRole('table', { name: 'Networks' }).getByRole('checkbox').first()
+ ).toBeInViewport({ ratio: 1 })
+ expect(
+ await page.evaluate(
+ () => document.documentElement.scrollWidth <= document.documentElement.clientWidth
+ )
+ ).toBe(true)
+ await page.getByRole('button', { name: 'Pause', exact: true }).click()
+ await expect(page.getByRole('button', { name: 'Resume', exact: true })).toBeInViewport({
+ ratio: 1
+ })
+ origin.release()
+ await page.getByRole('button', { name: 'Resume', exact: true }).click()
+ await plexo.waitForHttpStatus('completed')
+ await expect(page.getByRole('button', { name: /Show in (Finder|folder)/ })).toBeInViewport({
+ ratio: 1
+ })
+ })
+
test('paste a link, start, pause, resume, finish, reveal the file', async ({
plexo,
serve,
@@ -236,6 +284,9 @@ test.describe('settings @smoke', () => {
await stubNativeUi(plexo, dirs.dest)
await plexo.newDownload()
await page().getByRole('button', { name: 'Change…' }).click()
+ const destinationRow = (): Locator =>
+ page().getByText('Save to', { exact: true }).locator('..')
+ const chosenDestination = await destinationRow().innerText()
await page().keyboard.press('Escape')
// A function: the window, and so the page, is a new one after a relaunch.
const networksMenu = (): Locator =>
@@ -257,7 +308,10 @@ test.describe('settings @smoke', () => {
await expect(page().getByRole('alertdialog')).toBeHidden()
await expect(page().getByRole('button', { name: labelAfterSwitch })).toBeVisible()
await plexo.newDownload()
- await expect(page().getByText(dirs.dest)).toBeVisible()
+ await expect(destinationRow()).toHaveText(chosenDestination, { useInnerText: true })
+ // Presentation may abbreviate home; persistence must retain the usable absolute path.
+ const saved = JSON.parse(await readFile(join(dirs.userData, 'app-settings.json'), 'utf8'))
+ expect(saved.destinationDir).toBe(dirs.dest)
await page().keyboard.press('Escape')
await networksMenu().click()
await expect(page().getByText('Office fibre')).toBeVisible()
@@ -309,6 +363,10 @@ test.describe('no networks', () => {
test.use({ appEnv: { PLEXO_E2E_INTERFACES: '' } })
test('a network appearing makes the list ready for downloads @smoke', async ({ plexo }) => {
+ await expect(plexo.page.getByText('No networks connected')).toBeVisible()
+ // A manual scan is safe while the list stays empty. Once an interface appears, the
+ // background monitor can remove this button before Playwright finishes clicking it.
+ await plexo.page.getByRole('button', { name: 'Scan again' }).click()
await expect(plexo.page.getByText('No networks connected')).toBeVisible()
await plexo.evaluateMain(
(_electron, value) => {
@@ -316,7 +374,6 @@ test.describe('no networks', () => {
},
interfacesEnv({ a: NETWORKS['a'] })
)
- await plexo.page.getByRole('button', { name: 'Scan again' }).click()
await expect(plexo.page.getByText('No downloads yet')).toBeVisible()
})
})
diff --git a/src/renderer/src/components/NetworkRow.tsx b/src/renderer/src/components/NetworkRow.tsx
index 053207b..c6fe249 100644
--- a/src/renderer/src/components/NetworkRow.tsx
+++ b/src/renderer/src/components/NetworkRow.tsx
@@ -62,9 +62,15 @@ function ProgressBar({
role="progressbar"
aria-label={label}
aria-valuenow={Math.round(percent)}
- className="h-full rounded-full transition-[width] duration-200 ease-out"
- style={{ width: `${percent}%`, background: color }}
- />
+ className="h-full w-full"
+ >
+ {/* The indicator includes its empty track. Only its decorative fill changes width. */}
+ <div
+ aria-hidden="true"
+ className="h-full rounded-full transition-[width] duration-200 ease-out"
+ style={{ width: `${percent}%`, background: color }}
+ />
+ </div>
</div>
)
}