@@ -19,10 +19,17 @@ limitations under the License.
1919import { SynapseInstance } from "../../plugins/synapsedocker" ;
2020import { MatrixClient } from "../../global" ;
2121
22+ function markWindowBeforeReload ( ) : void {
23+ // mark our window object to "know" when it gets reloaded
24+ cy . window ( ) . then ( ( w ) => ( w . beforeReload = true ) ) ;
25+ }
26+
2227describe ( "Threads" , ( ) => {
2328 let synapse : SynapseInstance ;
2429
2530 beforeEach ( ( ) => {
31+ // Default threads to ON for this spec
32+ cy . enableLabsFeature ( "feature_threadstable" ) ;
2633 cy . window ( ) . then ( ( win ) => {
2734 win . localStorage . setItem ( "mx_lhs_size" , "0" ) ; // Collapse left panel for these tests
2835 } ) ;
@@ -37,6 +44,35 @@ describe("Threads", () => {
3744 cy . stopSynapse ( synapse ) ;
3845 } ) ;
3946
47+ it ( "should reload when enabling threads beta" , ( ) => {
48+ markWindowBeforeReload ( ) ;
49+
50+ // Turn off
51+ cy . openUserSettings ( "Labs" ) . within ( ( ) => {
52+ // initially the new property is there
53+ cy . window ( ) . should ( "have.prop" , "beforeReload" , true ) ;
54+
55+ cy . leaveBeta ( "Threaded messages" ) ;
56+ cy . wait ( 1000 ) ;
57+ // after reload the property should be gone
58+ cy . window ( ) . should ( "not.have.prop" , "beforeReload" ) ;
59+ } ) ;
60+
61+ cy . get ( ".mx_MatrixChat" , { timeout : 15000 } ) ; // wait for the app
62+ markWindowBeforeReload ( ) ;
63+
64+ // Turn on
65+ cy . openUserSettings ( "Labs" ) . within ( ( ) => {
66+ // initially the new property is there
67+ cy . window ( ) . should ( "have.prop" , "beforeReload" , true ) ;
68+
69+ cy . joinBeta ( "Threaded messages" ) ;
70+ cy . wait ( 1000 ) ;
71+ // after reload the property should be gone
72+ cy . window ( ) . should ( "not.have.prop" , "beforeReload" ) ;
73+ } ) ;
74+ } ) ;
75+
4076 it ( "should be usable for a conversation" , ( ) => {
4177 let bot : MatrixClient ;
4278 cy . getBot ( synapse , {
0 commit comments