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
5 changes: 3 additions & 2 deletions src/tests/backend-new/specs/updater/RollbackHandler.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import path from 'node:path';
import {describe, it, expect, vi, beforeEach, afterEach} from 'vitest';
import {checkPendingVerification, performRollback, RollbackDeps} from '../../../../node/updater/RollbackHandler';
import {EMPTY_STATE} from '../../../../node/updater/types';
Expand Down Expand Up @@ -120,8 +121,8 @@ describe('performRollback', () => {
};
await performRollback(state, deps);
expect(deps.copyFile).toHaveBeenCalledWith(
'/srv/etherpad/var/update-backup/pnpm-lock.yaml',
'/srv/etherpad/pnpm-lock.yaml',
path.join(deps.backupDir, 'pnpm-lock.yaml'),
path.join(deps.repoDir, 'pnpm-lock.yaml'),
);
const lastSave = (deps.saveState as any).mock.calls.at(-1)[0];
expect(lastSave.execution.status).toBe('rolled-back');
Expand Down
6 changes: 5 additions & 1 deletion src/tests/backend-new/specs/updater/UpdateExecutor.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import path from 'node:path';
import {describe, it, expect, vi, beforeEach} from 'vitest';
import {executeUpdate, ExecutorDeps} from '../../../../node/updater/UpdateExecutor';
import {EMPTY_STATE, UpdateState} from '../../../../node/updater/types';
Expand Down Expand Up @@ -64,7 +65,10 @@ describe('executeUpdate', () => {
const r = await executeUpdate(deps);
expect(r).toEqual({outcome: 'pending-verification'});
expect(copies).toEqual([
{src: '/srv/etherpad/pnpm-lock.yaml', dst: '/srv/etherpad/var/update-backup/pnpm-lock.yaml'},
{
src: path.join(deps.repoDir, 'pnpm-lock.yaml'),
dst: path.join(deps.backupDir, 'pnpm-lock.yaml'),
},
]);
expect(states.at(-1)?.execution.status).toBe('pending-verification');
expect((states.at(-1)?.execution as any).fromSha).toBe('abc123');
Expand Down
23 changes: 11 additions & 12 deletions src/tests/frontend-new/admin-spec/adminupdateplugins.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,23 +48,22 @@ test.describe('Plugins page', ()=> {

// Select Installation button
await pluginRow.locator('td').nth(4).locator('button').first().click()
await page.waitForTimeout(100)
await page.waitForSelector('table tbody')
const installedPlugins = page.locator('table tbody').first()
const installedPluginsRows = installedPlugins.locator('tr')
await expect(installedPluginsRows).toHaveCount(2, {
timeout: 15000
})

const installedPluginRow = installedPluginsRows.nth(1)
// The installed-plugins table can grow by more than one row if the
// installed plugin pulls in transitive plugin deps (e.g.
// ep_set_title_on_pad depends on ep_plugin_helpers as of 0.7.2), so
// assert by name rather than by row count.
const installedPlugins = page.locator('table tbody').first()
const installedPluginRow = installedPlugins.locator('tr', {hasText: 'ep_set_title_on_pad'})
await expect(installedPluginRow).toHaveCount(1, {timeout: 15000})

await expect(installedPluginRow).toContainText('ep_set_title_on_pad')
await installedPluginRow.locator('td').nth(2).locator('button').first().click()

// Wait for the uninstallation to complete
await expect(installedPluginsRows).toHaveCount(1, {
timeout: 15000
})
// Wait for the uninstallation to complete: the row for
// ep_set_title_on_pad should disappear. Other installed plugins
// (etherpad-lite itself, transitive plugin deps) may stay.
await expect(installedPluginRow).toHaveCount(0, {timeout: 15000})
await page.waitForTimeout(5000)
})
})
Expand Down
Loading