mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-07-03 11:22:14 -04:00
feat: fixed tests
This commit is contained in:
parent
4093320544
commit
6766165b32
2 changed files with 9 additions and 12 deletions
|
@ -23,11 +23,9 @@ exports.expressCreateServer = (hookName: string, args: ArgsExpressType, cb: Func
|
||||||
return cb();
|
return cb();
|
||||||
}
|
}
|
||||||
args.app.get('/admin/*', (req: any, res: any) => {
|
args.app.get('/admin/*', (req: any, res: any) => {
|
||||||
// parse URL
|
|
||||||
const parsedUrl = url.parse(req.url);
|
|
||||||
// extract URL path
|
// extract URL path
|
||||||
let pathname = ADMIN_PATH + `${parsedUrl.pathname}`;
|
let pathname = path.join(ADMIN_PATH + req.url);
|
||||||
pathname = path.normalize(path.join(ADMIN_PATH), parsedUrl.pathname)
|
pathname = path.normalize(pathname)
|
||||||
|
|
||||||
if (!pathname.startsWith(ADMIN_PATH)) {
|
if (!pathname.startsWith(ADMIN_PATH)) {
|
||||||
res.statusCode = 403;
|
res.statusCode = 403;
|
||||||
|
|
|
@ -13,18 +13,17 @@ test.describe('Plugins page', ()=> {
|
||||||
await page.waitForSelector('.search-field');
|
await page.waitForSelector('.search-field');
|
||||||
const pluginTable = page.locator('table tbody').nth(1);
|
const pluginTable = page.locator('table tbody').nth(1);
|
||||||
await expect(pluginTable).not.toBeEmpty()
|
await expect(pluginTable).not.toBeEmpty()
|
||||||
const plugins = await pluginTable.locator('tr').count()
|
await expect(pluginTable.locator('tr')).toHaveCount(190)
|
||||||
expect(plugins).toBeGreaterThan(10)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
test('Searches for a plugin', async ({page}) => {
|
test('Searches for a plugin', async ({page}) => {
|
||||||
await page.waitForSelector('.search-field');
|
await page.waitForSelector('.search-field');
|
||||||
await page.click('.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')
|
await page.keyboard.press('Enter')
|
||||||
const pluginTable = page.locator('table tbody').nth(1);
|
const pluginTable = page.locator('table tbody').nth(1);
|
||||||
await expect(pluginTable.locator('tr')).toHaveCount(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
|
timeout: 15000
|
||||||
})
|
})
|
||||||
const plugins = await pluginTable.locator('tr').count()
|
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
|
// Now everything is loaded, lets install a plugin
|
||||||
|
|
||||||
await page.click('.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')
|
await page.keyboard.press('Enter')
|
||||||
|
|
||||||
await expect(pluginTable.locator('tr')).toHaveCount(1)
|
await expect(pluginTable.locator('tr')).toHaveCount(1)
|
||||||
const pluginRow = pluginTable.locator('tr').first()
|
const pluginRow = pluginTable.locator('tr').first()
|
||||||
await expect(pluginRow).toContainText('ep_font_color3')
|
await expect(pluginRow).toContainText('ep_font_color')
|
||||||
|
|
||||||
// Select Installation button
|
// Select Installation button
|
||||||
await pluginRow.locator('td').nth(4).locator('button').first().click()
|
await pluginRow.locator('td').nth(4).locator('button').first().click()
|
||||||
|
@ -59,7 +58,7 @@ test.describe('Plugins page', ()=> {
|
||||||
|
|
||||||
const installedPluginRow = installedPluginsRows.nth(1)
|
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()
|
await installedPluginRow.locator('td').nth(2).locator('button').first().click()
|
||||||
|
|
||||||
// Wait for the uninstallation to complete
|
// Wait for the uninstallation to complete
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue