Skip to content
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

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open

Conversation

damencho
Copy link
Member

No description provided.

@damencho damencho changed the title feat(tests): Adds follow-me, invite dialog, lastN and lobby tests. feat(tests): Adds kick, lastN and lobby tests. Jan 22, 2025
@damencho damencho force-pushed the more-tests8 branch 2 times, most recently from 807ce67 to a8de771 Compare January 23, 2025 00:32
@@ -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
Copy link
Member

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 ?

Copy link
Member Author

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.

Copy link
Member

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!

@@ -291,7 +309,7 @@ export class Participant {
*/
async waitToJoinMUC(): Promise<void> {
return this.driver.waitUntil(
() => this.isInMuc(),
async () => await this.isInMuc(),
Copy link
Member

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.

timeout = 15_000, msg = `expected to send data in 15s for ${this.name}`): Promise<void> {
const driver = this.driver;

return driver.waitUntil(async () =>
Copy link
Member

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.

tests/helpers/Participant.ts Show resolved Hide resolved
feat(dialog): Adds a print when opening and hiding dialogs.
timeoutMsg: 'Knocking participant notification not displayed'
});

return await knockingParticipantNotification.getText();
Copy link
Member

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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hah, interesting.

Copy link
Member

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.

Copy link
Member Author

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.

* The notification that someone's access was approved.
*/
async getLobbyParticipantAccessGranted() {
return await this.getNotificationText(LOBBY_PARTICIPANT_ACCESS_GRANTED_TEST_ID);
Copy link
Member

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();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto.

* The notification test that someone's access was denied.
*/
async getLobbyParticipantAccessDenied() {
return await this.getNotificationText(LOBBY_PARTICIPANT_ACCESS_DENIED_TEST_ID);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto.

Copy link
Member

@hristoterezov hristoterezov left a 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(
Copy link
Member

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

/**
* Returns is the lobby enabled.
*/
async isLobbyEnabled() {
Copy link
Member

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?

* Waits for the lobby to be enabled or disabled.
* @param reverse
*/
async waitForLobbyEnabled(reverse = false) {
Copy link
Member

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?

* Checks whether lobby section is present in the UI.
*/
async isLobbySectionPresent() {
return await this.getLobbySwitch().isExisting();
Copy link
Member

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?

* @return {@code true} if the conference is displayed as locked locally in
* the security dialog, {@code false} otherwise.
*/
private async isLockedLocally() {
Copy link
Member

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?

* in the security dialog, {@code false} otherwise.
*/
private async isLockedRemotely() {
return await this.participant.driver.$(`.${REMOTE_LOCK}`).isExisting();
Copy link
Member

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?

Copy link
Member

@hristoterezov hristoterezov left a 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!

@damencho
Copy link
Member Author

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?

If those failed the test is marked as failed and this is what we want.

@damencho
Copy link
Member Author

@hristoterezov I think I have addressed all of those, I went and through the other page objects and fix more like that.
AVmoderation and lobby tests need more love though ... may give it a shot tomorrow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants