Skip to content

Commit 6766165

Browse files
committed
feat: fixed tests
1 parent 4093320 commit 6766165

File tree

2 files changed

+9
-12
lines changed

2 files changed

+9
-12
lines changed

src/node/hooks/express/admin.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,9 @@ exports.expressCreateServer = (hookName: string, args: ArgsExpressType, cb: Func
2323
return cb();
2424
}
2525
args.app.get('/admin/*', (req: any, res: any) => {
26-
// parse URL
27-
const parsedUrl = url.parse(req.url);
2826
// extract URL path
29-
let pathname = ADMIN_PATH + `${parsedUrl.pathname}`;
30-
pathname = path.normalize(path.join(ADMIN_PATH), parsedUrl.pathname)
27+
let pathname = path.join(ADMIN_PATH + req.url);
28+
pathname = path.normalize(pathname)
3129

3230
if (!pathname.startsWith(ADMIN_PATH)) {
3331
res.statusCode = 403;

src/tests/frontend-new/admin-spec/adminupdateplugins.spec.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,17 @@ test.describe('Plugins page', ()=> {
1313
await page.waitForSelector('.search-field');
1414
const pluginTable = page.locator('table tbody').nth(1);
1515
await expect(pluginTable).not.toBeEmpty()
16-
const plugins = await pluginTable.locator('tr').count()
17-
expect(plugins).toBeGreaterThan(10)
16+
await expect(pluginTable.locator('tr')).toHaveCount(190)
1817
})
1918

2019
test('Searches for a plugin', async ({page}) => {
2120
await page.waitForSelector('.search-field');
2221
await page.click('.search-field')
23-
await page.keyboard.type('ep_font_color3')
22+
await page.keyboard.type('ep_font_color')
2423
await page.keyboard.press('Enter')
2524
const pluginTable = page.locator('table tbody').nth(1);
2625
await expect(pluginTable.locator('tr')).toHaveCount(1)
27-
await expect(pluginTable.locator('tr').first()).toContainText('ep_font_color3')
26+
await expect(pluginTable.locator('tr').first()).toContainText('ep_font_color')
2827
})
2928

3029

@@ -35,17 +34,17 @@ test.describe('Plugins page', ()=> {
3534
timeout: 15000
3635
})
3736
const plugins = await pluginTable.locator('tr').count()
38-
expect(plugins).toBeGreaterThan(10)
37+
await expect(pluginTable.locator('tr')).toHaveCount(190)
3938

4039
// Now everything is loaded, lets install a plugin
4140

4241
await page.click('.search-field')
43-
await page.keyboard.type('ep_font_color3')
42+
await page.keyboard.type('ep_font_color')
4443
await page.keyboard.press('Enter')
4544

4645
await expect(pluginTable.locator('tr')).toHaveCount(1)
4746
const pluginRow = pluginTable.locator('tr').first()
48-
await expect(pluginRow).toContainText('ep_font_color3')
47+
await expect(pluginRow).toContainText('ep_font_color')
4948

5049
// Select Installation button
5150
await pluginRow.locator('td').nth(4).locator('button').first().click()
@@ -59,7 +58,7 @@ test.describe('Plugins page', ()=> {
5958

6059
const installedPluginRow = installedPluginsRows.nth(1)
6160

62-
await expect(installedPluginRow).toContainText('ep_font_color3')
61+
await expect(installedPluginRow).toContainText('ep_font_color')
6362
await installedPluginRow.locator('td').nth(2).locator('button').first().click()
6463

6564
// Wait for the uninstallation to complete

0 commit comments

Comments
 (0)