This repository has been archived by the owner on Sep 11, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 833
WIP: Implement Knocking
#9093
Closed
Closed
WIP: Implement Knocking
#9093
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
f3ce267
Added `feature_knocking` in Settings.tsx
ankur12-1610 04af2d8
Added knocking option in CreateRoomDialog
ankur12-1610 a4984b9
Added conditional rendering for the JoinRule DropDown based on labs f…
ankur12-1610 942db0c
Resolved the nits and added the knocking svg
ankur12-1610 aaecd18
Added `Ask to join` option in Room Settings
ankur12-1610 23e9f63
Added iterative method to splice the definitions
ankur12-1610 82993af
Added cypress test for the implemented milestone
ankur12-1610 8e7b212
Resolved linting errors
ankur12-1610 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
/* | ||
Copyright 2022 The Matrix.org Foundation C.I.C. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
/// <reference types="cypress" /> | ||
|
||
import { SynapseInstance } from "../../plugins/synapsedocker"; | ||
import Chainable = Cypress.Chainable; | ||
|
||
function openCreateRoomDialog(): Chainable<JQuery<HTMLElement>> { | ||
cy.get('[aria-label="Add room"]').click(); | ||
cy.get('.mx_ContextualMenu [aria-label="New room"]').click(); | ||
return cy.get(".mx_CreateRoomDialog"); | ||
} | ||
|
||
describe("Knocking", () => { | ||
let synapse: SynapseInstance; | ||
|
||
beforeEach(() => { | ||
cy.startSynapse("default").then(data => { | ||
synapse = data; | ||
|
||
cy.initTestUser(synapse, "Tom"); | ||
}); | ||
}); | ||
|
||
afterEach(() => { | ||
cy.stopSynapse(synapse); | ||
}); | ||
|
||
it("should be able to create a room with knock JoinRule", () => { | ||
// Enables labs flag feature | ||
cy.enableLabsFeature("feature_knocking"); | ||
const name = "Test room 1"; | ||
const topic = "This is a test room"; | ||
|
||
// Create a room with knock JoinRule | ||
openCreateRoomDialog().within(() => { | ||
cy.get('[label="Name"]').type(name); | ||
cy.get('[label="Topic (optional)"]').type(topic); | ||
cy.get(".mx_JoinRuleDropdown").click(); | ||
cy.get(".mx_JoinRuleDropdown_knock").click(); | ||
cy.startMeasuring("from-submit-to-room"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure what is the purpose of this? I am not sure if it makes sense to have a performance test specific to knocking? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I thought since we are using it in |
||
cy.get(".mx_Dialog_primary").click(); | ||
}); | ||
|
||
// The room settings initially are set to Ask to join | ||
cy.openRoomSettings("Security & Privacy"); | ||
cy.closeDialog(); | ||
|
||
//Check if the room settings are visible if labs flag is disabled | ||
cy.openUserSettings("Labs").within(() => { | ||
//disables labs flag feature | ||
cy.get("[aria-label='Knocking']").click(); | ||
// cy.disableLabsFeature("feature_knocking"); | ||
}); | ||
cy.closeDialog(); | ||
|
||
//the default joinRule is set to Private (invite only) when the labs flag is disabled | ||
cy.openRoomSettings("Security & Privacy"); | ||
cy.closeDialog(); | ||
|
||
// Click the expand link button to get more detailed view | ||
cy.get(".mx_GenericEventListSummary_toggle[aria-expanded=false]").click(); | ||
|
||
cy.stopMeasuring("from-submit-to-room"); | ||
cy.get(".mx_RoomHeader_nametext").contains(name); | ||
cy.get(".mx_RoomHeader_topic").contains(topic); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 we tend to use aria-label for selecting usually but it probably doesn't matter much