mirror of
https://github.com/tiddly-gittly/TidGi-Desktop.git
synced 2025-12-06 10:41:02 -08:00
test: add Opening Preferences Notifications
This commit is contained in:
parent
441642fddb
commit
e43e4a7f16
3 changed files with 34 additions and 8 deletions
|
|
@ -8,8 +8,20 @@ Feature: Open
|
||||||
Then the element "#new-user-tip" is on the page
|
Then the element "#new-user-tip" is on the page
|
||||||
Then the element "#add-workspace-button" is on the page
|
Then the element "#add-workspace-button" is on the page
|
||||||
|
|
||||||
Scenario: Opening TiddlyGit
|
Scenario: Opening Add Workspace Page
|
||||||
Given the app is launched
|
Given the app is launched
|
||||||
Then the element "#add-workspace-button" is on the page
|
Then the element "#add-workspace-button" is on the page
|
||||||
Then click on this element
|
Then click on this element
|
||||||
Then "Add Workspace" window show up
|
Then "Add Workspace" window show up
|
||||||
|
|
||||||
|
Scenario: Opening Preferences Page
|
||||||
|
Given the app is launched
|
||||||
|
Then the element "#open-preferences-button" is on the page
|
||||||
|
Then click on this element
|
||||||
|
Then "Preferences" window show up
|
||||||
|
|
||||||
|
Scenario: Opening Notifications Page
|
||||||
|
Given the app is launched
|
||||||
|
Then the element "#open-notification-settings-button" is on the page
|
||||||
|
Then click on this element
|
||||||
|
Then "Notifications" window show up
|
||||||
|
|
@ -6,24 +6,32 @@ import { TiddlyGitWorld } from '../supports/world';
|
||||||
|
|
||||||
setWorldConstructor(TiddlyGitWorld);
|
setWorldConstructor(TiddlyGitWorld);
|
||||||
|
|
||||||
Given('the app is launched', { timeout: 120 * 1000 }, async function (this: TiddlyGitWorld) {
|
Given('the app is launched', async function (this: TiddlyGitWorld) {
|
||||||
await this.start();
|
await this.start();
|
||||||
const windowCount = await this.app?.client?.getWindowCount();
|
const windowCount = await this.app?.client?.getWindowCount();
|
||||||
expect(windowCount).equal(1);
|
expect(windowCount).equal(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
Then('the element {string} is on the page', { timeout: 120 * 1000 }, async function (this: TiddlyGitWorld, elementSelector: string) {
|
Then('the element {string} is on the page', async function (this: TiddlyGitWorld, elementSelector: string) {
|
||||||
const result = await this.getElement(elementSelector);
|
const result = await this.getElement(elementSelector);
|
||||||
expect(result).to.not.be.undefined;
|
expect(result).to.not.be.undefined;
|
||||||
this.updateContext({ previousElement: result });
|
this.updateContext({ previousElement: result });
|
||||||
});
|
});
|
||||||
Then('click on this element', { timeout: 120 * 1000 }, async function (this: TiddlyGitWorld) {
|
Then('click on this element', async function (this: TiddlyGitWorld) {
|
||||||
expect(this.context?.previousElement).to.not.be.undefined;
|
expect(this.context?.previousElement).to.not.be.undefined;
|
||||||
if (this.context?.previousElement !== undefined) {
|
if (this.context?.previousElement !== undefined) {
|
||||||
await this.context.previousElement.click();
|
await this.context.previousElement.click();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
Then('{string} window show up', { timeout: 120 * 1000 }, async function (this: TiddlyGitWorld, windowName: string) {
|
Then('click on {string} element', async function (this: TiddlyGitWorld, elementSelector: string) {
|
||||||
|
const result = await this.getElement(elementSelector);
|
||||||
|
expect(result).to.not.be.undefined;
|
||||||
|
if (result !== undefined) {
|
||||||
|
this.updateContext({ previousElement: result });
|
||||||
|
await result.click();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Then('{string} window show up', async function (this: TiddlyGitWorld, windowName: string) {
|
||||||
// await delay(1000);
|
// await delay(1000);
|
||||||
const windowCount = await this.app?.client?.getWindowCount();
|
const windowCount = await this.app?.client?.getWindowCount();
|
||||||
expect(windowCount).equal(2);
|
expect(windowCount).equal(2);
|
||||||
|
|
|
||||||
|
|
@ -221,10 +221,16 @@ export default function Main(): JSX.Element {
|
||||||
<WorkspaceSelector id="add" onClick={() => void window.service.window.open(WindowNames.addWorkspace)} />
|
<WorkspaceSelector id="add" onClick={() => void window.service.window.open(WindowNames.addWorkspace)} />
|
||||||
</SidebarTop>
|
</SidebarTop>
|
||||||
<SideBarEnd>
|
<SideBarEnd>
|
||||||
<IconButton aria-label={t('Preference.Notifications')} onClick={async () => await window.service.window.open(WindowNames.notifications)}>
|
<IconButton
|
||||||
|
id="open-notification-settings-button"
|
||||||
|
aria-label={t('Preference.Notifications')}
|
||||||
|
onClick={async () => await window.service.window.open(WindowNames.notifications)}>
|
||||||
{typeof pauseNotifications === 'string' && pauseNotifications.length > 0 ? <NotificationsPausedIcon /> : <NotificationsIcon />}
|
{typeof pauseNotifications === 'string' && pauseNotifications.length > 0 ? <NotificationsPausedIcon /> : <NotificationsIcon />}
|
||||||
</IconButton>
|
</IconButton>
|
||||||
<IconButton aria-label={t('ContextMenu.Preferences')} onClick={async () => await window.service.window.open(WindowNames.preferences)}>
|
<IconButton
|
||||||
|
id="open-preferences-button"
|
||||||
|
aria-label={t('ContextMenu.Preferences')}
|
||||||
|
onClick={async () => await window.service.window.open(WindowNames.preferences)}>
|
||||||
<SettingsIcon />
|
<SettingsIcon />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
</SideBarEnd>
|
</SideBarEnd>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue