@@ -19,10 +19,17 @@ limitations under the License.
19
19
import { SynapseInstance } from "../../plugins/synapsedocker" ;
20
20
import { MatrixClient } from "../../global" ;
21
21
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
+
22
27
describe ( "Threads" , ( ) => {
23
28
let synapse : SynapseInstance ;
24
29
25
30
beforeEach ( ( ) => {
31
+ // Default threads to ON for this spec
32
+ cy . enableLabsFeature ( "feature_threadstable" ) ;
26
33
cy . window ( ) . then ( ( win ) => {
27
34
win . localStorage . setItem ( "mx_lhs_size" , "0" ) ; // Collapse left panel for these tests
28
35
} ) ;
@@ -37,6 +44,35 @@ describe("Threads", () => {
37
44
cy . stopSynapse ( synapse ) ;
38
45
} ) ;
39
46
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
+
40
76
it ( "should be usable for a conversation" , ( ) => {
41
77
let bot : MatrixClient ;
42
78
cy . getBot ( synapse , {
0 commit comments