Skip to content

Commit 6498720

Browse files
committed
Stashing e2e changes
1 parent c1044e0 commit 6498720

6 files changed

Lines changed: 849 additions & 4 deletions

File tree

packages/desktop/.env.development

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ QPS_ENABLED=true
66
QSS_ENDPOINT=ws://127.0.0.1:3003
77
LOG_TO_FILE=true
88
ENVFILE=.env.development
9+
NODE_ENV=development
910
DEBUG=state-manager*,desktop*,utils*,identity*,backend*,-backend:Libp2p*,-backend:auth:cryptoService,-localfirst*,-backend:Tor*,-backend:TimedQueue

packages/desktop/src/renderer/components/Channel/AddMembersChannel/AddMembersChannelComponent.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ export const AddMembersChannelComponent: React.FC<ReturnType<typeof useModal> &
211211
})}
212212
component='li'
213213
selected={state.selected}
214+
data-testid={`${channelName}-add-members-autocomplete-option-${option.label}`}
214215
{...optionProps}
215216
>
216217
<Grid container item alignItems='center' direction='row' display='flex' gap='5px' padding='0px 0px'>
@@ -229,6 +230,7 @@ export const AddMembersChannelComponent: React.FC<ReturnType<typeof useModal> &
229230
userProfile={userProfile}
230231
userId={userProfile.userId}
231232
size={theme.componentSizes.avatar.small}
233+
data-testid={`${channelName}-add-members-autocomplete-${option.label}-profilePhoto`}
232234
/>
233235
<Typography
234236
variant='body2'
@@ -279,6 +281,7 @@ export const AddMembersChannelComponent: React.FC<ReturnType<typeof useModal> &
279281
sx={{ width: 300 }}
280282
renderInput={params => <TextField {...params} label='Add members' />}
281283
onChange={handleAutoCompleteChange}
284+
data-testid={`${channelName}-add-members-autocomplete`}
282285
/>
283286
</ThemeProvider>
284287
</StyledGrid>
@@ -289,7 +292,7 @@ export const AddMembersChannelComponent: React.FC<ReturnType<typeof useModal> &
289292
size='small'
290293
fullWidth
291294
className={classes.button}
292-
data-testid='addMembersChannelButton'
295+
data-testid={`${channelName}-add-members-button`}
293296
>
294297
Add {selectedMembers.length} members
295298
</Button>

packages/desktop/src/renderer/components/ContextMenu/ContextMenu.component.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ export const ContextMenuItem: FC<ContextMenuItemProps> = ({ title, action }) =>
110110
cursor: 'pointer',
111111
}}
112112
onClick={action}
113-
data-testid={`contextMenuItem${title}`}
113+
data-testid={`contextMenuItem${title.replace(' ', '_')}`}
114114
>
115115
<Grid
116116
style={{

packages/desktop/src/renderer/components/Sidebar/ChannelsPanel/ChannelsPanel.test.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,6 @@ describe('Channels panel', () => {
116116
handleOpen: function (_args?: any): any {},
117117
handleClose: function (): any {},
118118
}}
119-
myUserProfile={aliceUserProfile}
120119
isTorInitialized={true}
121120
/>
122121
<DirectMessagesPanel

packages/e2e-tests/src/selectors.ts

Lines changed: 80 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -660,6 +660,22 @@ export class ChannelContextMenu {
660660
await tab.click()
661661
}
662662

663+
async openAddMembersModal() {
664+
const tab = this.driver.wait(
665+
until.elementLocated(By.xpath('//div[@data-testid="contextMenuItemAdd_members"]')),
666+
15_000,
667+
`Channel context menu channel add members tab couldn't be located within timeout`,
668+
500
669+
)
670+
await this.driver.wait(
671+
until.elementIsVisible(tab),
672+
15_000,
673+
`Channel context menu channel add members tab was not visibile within timeout`,
674+
500
675+
)
676+
await tab.click()
677+
}
678+
663679
// TODO: replace sleep
664680
async deleteChannel() {
665681
const button = this.driver.wait(
@@ -677,6 +693,43 @@ export class ChannelContextMenu {
677693
await button.click()
678694
await sleep(5000)
679695
}
696+
697+
// TODO: replace sleep
698+
async addMembersToChannel(channelName: string, memberNames: string[]) {
699+
const autoCompleteInput = this.driver.wait(
700+
until.elementLocated(By.xpath(`//*[@data-testid="${channelName}-add-members-autocomplete"]`)),
701+
20_000,
702+
`Channel add members autocomplete input couldn't be located within timeout`,
703+
500
704+
)
705+
await this.driver.wait(
706+
until.elementIsVisible(autoCompleteInput),
707+
15_000,
708+
`Channel context menu channel add members autocomplete input was not visibile within timeout`,
709+
500
710+
)
711+
712+
for (const memberName of memberNames) {
713+
await autoCompleteInput.click()
714+
autoCompleteInput.sendKeys(memberName)
715+
autoCompleteInput.sendKeys(Key.ENTER)
716+
}
717+
718+
const button = this.driver.wait(
719+
until.elementLocated(By.xpath('//button[@data-testid="addMembersChannelButton"]')),
720+
20_000,
721+
`Channel add members button couldn't be located within timeout`,
722+
500
723+
)
724+
await this.driver.wait(
725+
until.elementIsVisible(button),
726+
15_000,
727+
`Channel context menu channel add members button was not visibile within timeout`,
728+
500
729+
)
730+
await button.click()
731+
await sleep(5000)
732+
}
680733
}
681734

682735
export class UserProfileContextMenu {
@@ -1199,6 +1252,15 @@ export class Channel {
11991252
)
12001253
}
12011254

1255+
get lock() {
1256+
return this.driver.wait(
1257+
until.elementLocated(By.xpath(`//svg[@data-testid='channelTitle-private']`)),
1258+
10_000,
1259+
`Channel title element for ${this.name} couldn't be found within timeout`,
1260+
500
1261+
)
1262+
}
1263+
12021264
get messagesList() {
12031265
return this.driver.wait(
12041266
until.elementLocated(By.xpath('//ul[@id="messages-scroll"]')),
@@ -2013,7 +2075,7 @@ export class Sidebar {
20132075
return channel
20142076
}
20152077

2016-
async addNewChannel(name: string): Promise<Channel> {
2078+
async addNewChannel(name: string, isPublic: boolean = true): Promise<Channel> {
20172079
const button = await this.driver.wait(
20182080
until.elementLocated(By.xpath('//button[@data-testid="addChannelButton"]')),
20192081
5_000,
@@ -2032,6 +2094,23 @@ export class Sidebar {
20322094
await this.driver.wait(until.elementIsVisible(channelNameInput), 5_000)
20332095
await this.driver.wait(until.elementIsEnabled(channelNameInput), 5_000)
20342096
await channelNameInput.sendKeys(name)
2097+
2098+
const channelPrivateToggle = await this.driver.wait(
2099+
until.elementLocated(By.xpath('//span[@data-testid="createChannel-private-form-control-toggle"]')),
2100+
5_000,
2101+
`Channel private toggle couldn't be found within timeout`,
2102+
500
2103+
)
2104+
await this.driver.wait(until.elementIsVisible(channelPrivateToggle), 5_000)
2105+
if ((await channelPrivateToggle.getAttribute('class')).includes('checked')) {
2106+
throw new Error('Channel privacy toggle was enabled before clicking')
2107+
}
2108+
if (!isPublic) {
2109+
await channelPrivateToggle.click()
2110+
if (!(await channelPrivateToggle.getAttribute('class')).includes('checked')) {
2111+
throw new Error('Channel privacy toggle was disabled after clicking')
2112+
}
2113+
}
20352114
const channelNameButton = await this.driver.wait(
20362115
until.elementLocated(By.xpath('//button[@data-testid="channelNameSubmit"]')),
20372116
5_000,

0 commit comments

Comments
 (0)