-
Notifications
You must be signed in to change notification settings - Fork 6.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(tests): Adds kick, lastN and lobby tests. #15517
base: master
Are you sure you want to change the base?
Conversation
807ce67
to
a8de771
Compare
@@ -135,7 +151,7 @@ export class Participant { | |||
if (!options.skipDisplayName) { | |||
// @ts-ignore | |||
config.userInfo = { | |||
displayName: options.displayName || this._name | |||
displayName: this._displayName = options.displayName || this._name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you intend this to be an assignment? Since there is a getter, shouldn't this be this.displayName
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, this is where we set it from the options... But I can drop part of the later changes where I use a constant instead of call the dispalyName getter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No strong opinion, you pick!
tests/helpers/Participant.ts
Outdated
@@ -291,7 +309,7 @@ export class Participant { | |||
*/ | |||
async waitToJoinMUC(): Promise<void> { | |||
return this.driver.waitUntil( | |||
() => this.isInMuc(), | |||
async () => await this.isInMuc(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this necessary? It will make the function return a promise, and if this.isInMuc()
already does that, this change shouldn't be necessary.
tests/helpers/Participant.ts
Outdated
timeout = 15_000, msg = `expected to send data in 15s for ${this.name}`): Promise<void> { | ||
const driver = this.driver; | ||
|
||
return driver.waitUntil(async () => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The async / await here should be unnecessary for the same reason as above.
feat(dialog): Adds a print when opening and hiding dialogs.
timeoutMsg: 'Knocking participant notification not displayed' | ||
}); | ||
|
||
return await knockingParticipantNotification.getText(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really want await
here?
Generally in most cases return await
would not make any sense, it would do exactly the same as what return
would do.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting read: https://nurkiewicz.com/2024/08/return-await-in-javascript.html I'd keep the await
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hah, interesting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting indeed. Do we care about the difference on the stack trace for those cases?
To me the version without await looks way more readable. I would still remove it unless we are sure we are going to need the extra line on the stack trace.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here are some examples:
[0-0] RUNNING in MultiRemote - file:///tests/specs/alone/invite.spec.ts
[0-0] Error in "Invite.url displayed"
Error: Can't call click on element with selector "#modal-header-close-button1" because element wasn't found
at async Context.<anonymous> (/Users/damencho/dev/jitsi-meet/tests/specs/alone/invite.spec.ts:18:9)
This ^ is from the following function:
clickCloseButton(): Promise<void> {
return this.participant.driver.$(`#${CLOSE_BUTTON}`).click();
}
Next one:
[0-0] Error in "Invite.dial-in displayed"
Error: Can't call click on element with selector "#modal-header-close-button1" because element wasn't found
at async Context.<anonymous> (/Users/damencho/dev/jitsi-meet/tests/specs/alone/invite.spec.ts:24:9)
This is from:
async clickCloseButton2(): Promise<void> {
return this.participant.driver.$(`#${CLOSE_BUTTON}`).click();
}
Last one:
[0-0] Error in "Invite.view more numbers"
Error: Can't call click on element with selector "#modal-header-close-button1" because element wasn't found
at async InviteDialog.clickCloseButton3 (/Users/damencho/dev/jitsi-meet/tests/pageobjects/BaseDialog.ts:25:9)
at async Context.<anonymous> (/Users/damencho/dev/jitsi-meet/tests/specs/alone/invite.spec.ts:41:9)
[0-0] FAILED in MultiRemote - file:///tests/specs/alone/invite.spec.ts
This is from:
async clickCloseButton3(): Promise<void> {
await this.participant.driver.$(`#${CLOSE_BUTTON}`).click();
}
For this example it seems ok to miss the line at async InviteDialog.clickCloseButton3 (/Users/damencho/dev/jitsi-meet/tests/pageobjects/BaseDialog.ts:25:9)
... but I guess if there more calls on the chain we may need that ... Will do another example with one more step in the chain of calls.
tests/pageobjects/Notifications.ts
Outdated
* The notification that someone's access was approved. | ||
*/ | ||
async getLobbyParticipantAccessGranted() { | ||
return await this.getNotificationText(LOBBY_PARTICIPANT_ACCESS_GRANTED_TEST_ID); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto
|
||
await notificationElement.waitForExist(); | ||
|
||
return await notificationElement.getText(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto.
tests/pageobjects/Notifications.ts
Outdated
* The notification test that someone's access was denied. | ||
*/ | ||
async getLobbyParticipantAccessDenied() { | ||
return await this.getNotificationText(LOBBY_PARTICIPANT_ACCESS_DENIED_TEST_ID); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see that menu of the underlying wdio operations are async and we use await.
I'm wondering do we expect them to fail from time to time? Should we generally add any error handing, try-catch, etc. ? Have we tought what to do if some of those fail? Maybe exit and fail everything?
* Checks internally whether lobby room is joined. | ||
*/ | ||
async isLobbyRoomJoined() { | ||
return await this.participant.driver.execute( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe remove the async/await here too
tests/pageobjects/SecurityDialog.ts
Outdated
/** | ||
* Returns is the lobby enabled. | ||
*/ | ||
async isLobbyEnabled() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is redundant async, isn't it?
tests/pageobjects/SecurityDialog.ts
Outdated
* Waits for the lobby to be enabled or disabled. | ||
* @param reverse | ||
*/ | ||
async waitForLobbyEnabled(reverse = false) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is redundant async, isn't it?
tests/pageobjects/SecurityDialog.ts
Outdated
* Checks whether lobby section is present in the UI. | ||
*/ | ||
async isLobbySectionPresent() { | ||
return await this.getLobbySwitch().isExisting(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we don't need async/await?
tests/pageobjects/SecurityDialog.ts
Outdated
* @return {@code true} if the conference is displayed as locked locally in | ||
* the security dialog, {@code false} otherwise. | ||
*/ | ||
private async isLockedLocally() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is redundant async, isn't it?
tests/pageobjects/SecurityDialog.ts
Outdated
* in the security dialog, {@code false} otherwise. | ||
*/ | ||
private async isLockedRemotely() { | ||
return await this.participant.driver.$(`.${REMOTE_LOCK}`).isExisting(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we don't need async/await?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Added some comments about redundant async/awaits and a question!
If those failed the test is marked as failed and this is what we want. |
@hristoterezov I think I have addressed all of those, I went and through the other page objects and fix more like that. |
No description provided.