mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-20 23:46:14 -04:00
created the home button to go back to the main page when done with current pad, also tried to make a test
This commit is contained in:
parent
1e5b302a79
commit
60e19bc281
9 changed files with 69 additions and 0 deletions
|
@ -241,6 +241,12 @@ module.exports = {
|
||||||
embed: defaultButtonAttributes('embed'),
|
embed: defaultButtonAttributes('embed'),
|
||||||
showusers: defaultButtonAttributes('showusers'),
|
showusers: defaultButtonAttributes('showusers'),
|
||||||
|
|
||||||
|
gohome:{
|
||||||
|
command: 'gohome',
|
||||||
|
localizationId: 'pad.toolbar.gohome.title',
|
||||||
|
class: 'homeicon homeicon-exit',
|
||||||
|
},
|
||||||
|
|
||||||
timeslider_export: {
|
timeslider_export: {
|
||||||
command: 'import_export',
|
command: 'import_export',
|
||||||
localizationId: 'timeslider.toolbar.exportlink.title',
|
localizationId: 'timeslider.toolbar.exportlink.title',
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
@import url("pad/gritter.css");
|
@import url("pad/gritter.css");
|
||||||
@import url("pad/loadingbox.css");
|
@import url("pad/loadingbox.css");
|
||||||
@import url("pad/form.css");
|
@import url("pad/form.css");
|
||||||
|
@import url("pad/home.css");
|
||||||
|
|
||||||
html {
|
html {
|
||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
|
|
9
src/static/css/pad/home.css
Normal file
9
src/static/css/pad/home.css
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
.homeicon-exit:before {
|
||||||
|
content: "\2302";
|
||||||
|
margin-right: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.homeicon:hover{
|
||||||
|
background-color: grey;
|
||||||
|
}
|
||||||
|
|
|
@ -74,6 +74,9 @@
|
||||||
.buttonicon-showusers:before {
|
.buttonicon-showusers:before {
|
||||||
content: "\e835";
|
content: "\e835";
|
||||||
}
|
}
|
||||||
|
.buttonicon-showusers:before {
|
||||||
|
content: "\e835";
|
||||||
|
}
|
||||||
.buttonicon-savedRevision:before {
|
.buttonicon-savedRevision:before {
|
||||||
content: "\e856";
|
content: "\e856";
|
||||||
}
|
}
|
||||||
|
|
|
@ -387,6 +387,11 @@ exports.padeditbar = new class {
|
||||||
$('#myusernameedit').trigger('focus');
|
$('#myusernameedit').trigger('focus');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.registerCommand('gohome', () => {
|
||||||
|
console.log('Go Home button clicked');
|
||||||
|
window.location.href = '/';
|
||||||
|
});
|
||||||
|
|
||||||
this.registerCommand('embed', () => {
|
this.registerCommand('embed', () => {
|
||||||
this.setEmbedLinks();
|
this.setEmbedLinks();
|
||||||
this.toggleDropDown('embed');
|
this.toggleDropDown('embed');
|
||||||
|
|
|
@ -20,6 +20,10 @@ export const toggleUserList = async (page: Page) => {
|
||||||
await page.locator("button[data-l10n-id='pad.toolbar.showusers.title']").click()
|
await page.locator("button[data-l10n-id='pad.toolbar.showusers.title']").click()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const leavePad = async (page: Page) => {
|
||||||
|
await page.locator("button[data-l10n-id='pad.toolbar.gohome.title']").click();
|
||||||
|
}
|
||||||
|
|
||||||
export const setUserName = async (page: Page, userName: string) => {
|
export const setUserName = async (page: Page, userName: string) => {
|
||||||
await page.waitForSelector('[class="popup popup-show"]')
|
await page.waitForSelector('[class="popup popup-show"]')
|
||||||
await page.click("input[data-l10n-id='pad.userlist.entername']");
|
await page.click("input[data-l10n-id='pad.userlist.entername']");
|
||||||
|
|
16
src/tests/frontend-new/specs/leavePadTests.ts
Normal file
16
src/tests/frontend-new/specs/leavePadTests.ts
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
import { test, expect } from '@playwright/test'; // Assuming Playwright is being used
|
||||||
|
import { leavePad } from '../helper/padHelper'; // Import the exitPad function
|
||||||
|
|
||||||
|
test('should exit the pad and return to the homepage', async ({ page }) => {
|
||||||
|
// Open a new pad (this can use helper.newPad() if it exists)
|
||||||
|
await page.goto('http://localhost:9001/p/test-' + Date.now()); // Or use helper.newPad()
|
||||||
|
|
||||||
|
// Ensure the page is loaded
|
||||||
|
await page.waitForLoadState('domcontentloaded');
|
||||||
|
|
||||||
|
// Click the exit button using the exitPad function
|
||||||
|
await leavePad(page);
|
||||||
|
|
||||||
|
// Verify that the page has navigated to the homepage
|
||||||
|
await expect(page).toHaveURL('http://localhost:9001/');
|
||||||
|
});
|
|
@ -85,6 +85,21 @@ helper.toggleUserList = async () => {
|
||||||
await helper.waitForPromise(() => !isVisible);
|
await helper.waitForPromise(() => !isVisible);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
helper.homeButton = () => helper.padChrome$("button[data-l10n-id='pad.toolbar.gohome.title']");
|
||||||
|
|
||||||
|
helper.leavePad = async () => {
|
||||||
|
const button = helper.homeButton();
|
||||||
|
button.trigger('click');
|
||||||
|
await helper.waitForPromise(() => window.location.pathname === '/');
|
||||||
|
};
|
||||||
|
|
||||||
|
helper.newPad = async (page: Page) => {
|
||||||
|
// create a new pad before each test run
|
||||||
|
const padId = "FRONTEND_TESTS"+randomUUID();
|
||||||
|
await page.goto('http://localhost:9001/p/'+padId);
|
||||||
|
await page.waitForSelector('iframe[name="ace_outer"]');
|
||||||
|
return padId;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Gets the user name input field
|
* Gets the user name input field
|
||||||
*
|
*
|
||||||
|
|
10
src/tests/frontend/specs/leavePadTest.js
Normal file
10
src/tests/frontend/specs/leavePadTest.js
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
describe("Leave Pad Functionality", function () {
|
||||||
|
beforeEach(async function () {
|
||||||
|
await helper.newPad(); // Open a new pad before each test
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should leave the pad and go back to the homepage", async function () {
|
||||||
|
await helper.leavePad(); // Clicks the exit button
|
||||||
|
expect(window.location.pathname).toBe("/"); // Confirms we are on the homepage
|
||||||
|
});
|
||||||
|
});
|
Loading…
Add table
Add a link
Reference in a new issue