feat: fixed tests

This commit is contained in:
SamTV12345 2025-06-25 22:22:24 +02:00
parent 4093320544
commit 6766165b32
2 changed files with 9 additions and 12 deletions

View file

@ -23,11 +23,9 @@ exports.expressCreateServer = (hookName: string, args: ArgsExpressType, cb: Func
return cb();
}
args.app.get('/admin/*', (req: any, res: any) => {
// parse URL
const parsedUrl = url.parse(req.url);
// extract URL path
let pathname = ADMIN_PATH + `${parsedUrl.pathname}`;
pathname = path.normalize(path.join(ADMIN_PATH), parsedUrl.pathname)
let pathname = path.join(ADMIN_PATH + req.url);
pathname = path.normalize(pathname)
if (!pathname.startsWith(ADMIN_PATH)) {
res.statusCode = 403;

View file

@ -13,18 +13,17 @@ test.describe('Plugins page', ()=> {
await page.waitForSelector('.search-field');
const pluginTable = page.locator('table tbody').nth(1);
await expect(pluginTable).not.toBeEmpty()
const plugins = await pluginTable.locator('tr').count()
expect(plugins).toBeGreaterThan(10)
await expect(pluginTable.locator('tr')).toHaveCount(190)
})
test('Searches for a plugin', async ({page}) => {
await page.waitForSelector('.search-field');
await page.click('.search-field')
await page.keyboard.type('ep_font_color3')
await page.keyboard.type('ep_font_color')
await page.keyboard.press('Enter')
const pluginTable = page.locator('table tbody').nth(1);
await expect(pluginTable.locator('tr')).toHaveCount(1)
await expect(pluginTable.locator('tr').first()).toContainText('ep_font_color3')
await expect(pluginTable.locator('tr').first()).toContainText('ep_font_color')
})
@ -35,17 +34,17 @@ test.describe('Plugins page', ()=> {
timeout: 15000
})
const plugins = await pluginTable.locator('tr').count()
expect(plugins).toBeGreaterThan(10)
await expect(pluginTable.locator('tr')).toHaveCount(190)
// Now everything is loaded, lets install a plugin
await page.click('.search-field')
await page.keyboard.type('ep_font_color3')
await page.keyboard.type('ep_font_color')
await page.keyboard.press('Enter')
await expect(pluginTable.locator('tr')).toHaveCount(1)
const pluginRow = pluginTable.locator('tr').first()
await expect(pluginRow).toContainText('ep_font_color3')
await expect(pluginRow).toContainText('ep_font_color')
// Select Installation button
await pluginRow.locator('td').nth(4).locator('button').first().click()
@ -59,7 +58,7 @@ test.describe('Plugins page', ()=> {
const installedPluginRow = installedPluginsRows.nth(1)
await expect(installedPluginRow).toContainText('ep_font_color3')
await expect(installedPluginRow).toContainText('ep_font_color')
await installedPluginRow.locator('td').nth(2).locator('button').first().click()
// Wait for the uninstallation to complete