@@ -23,6 +23,7 @@ describe("questdb schema with working tables", () => {
2323 } ) ;
2424
2525 afterEach ( ( ) => {
26+ cy . realPress ( "Home" ) ;
2627 cy . collapseTables ( ) ;
2728 cy . refreshSchema ( ) ;
2829 cy . expandTables ( ) ;
@@ -37,9 +38,9 @@ describe("questdb schema with working tables", () => {
3738 } ) ;
3839
3940 it ( "should show the symbol column details" , ( ) => {
40- cy . getByDataHook ( "schema-table-title" ) . contains ( "btc_trades" ) . click ( ) ;
41- cy . getByDataHook ( "schema-folder-title" ) . contains ( "Columns" ) . click ( ) ;
42- cy . getByDataHook ( "schema-column-title" ) . contains ( "symbol" ) . click ( ) ;
41+ cy . getByDataHook ( "schema-table-title" ) . contains ( "btc_trades" ) . dblclick ( ) ;
42+ cy . getByDataHook ( "schema-folder-title" ) . contains ( "Columns" ) . dblclick ( ) ;
43+ cy . getByDataHook ( "schema-column-title" ) . contains ( "symbol" ) . dblclick ( ) ;
4344
4445 cy . getByDataHook ( "schema-row" ) . should ( ( $el ) => {
4546 expect ( $el . text ( ) ) . to . include ( "Indexed:" ) ;
@@ -58,8 +59,8 @@ describe("questdb schema with working tables", () => {
5859 } ) ;
5960
6061 it ( "should show the storage details" , ( ) => {
61- cy . getByDataHook ( "schema-table-title" ) . contains ( "btc_trades" ) . click ( ) ;
62- cy . getByDataHook ( "schema-row" ) . contains ( "Storage details" ) . click ( ) ;
62+ cy . getByDataHook ( "schema-table-title" ) . contains ( "btc_trades" ) . dblclick ( ) ;
63+ cy . getByDataHook ( "schema-row" ) . contains ( "Storage details" ) . dblclick ( ) ;
6364
6465 cy . getByDataHook ( "schema-row" ) . should ( ( $el ) => {
6566 expect ( $el . text ( ) ) . to . include ( "WAL:" ) ;
@@ -99,6 +100,139 @@ describe("questdb schema with working tables", () => {
99100 } ) ;
100101} ) ;
101102
103+ describe ( "keyboard navigation" , ( ) => {
104+ before ( ( ) => {
105+ cy . loadConsoleWithAuth ( ) ;
106+ tables . forEach ( ( table ) => {
107+ cy . createTable ( table ) ;
108+ } ) ;
109+ materializedViews . forEach ( ( mv ) => {
110+ cy . createMaterializedView ( mv ) ;
111+ } ) ;
112+ cy . refreshSchema ( ) ;
113+ } ) ;
114+
115+ beforeEach ( ( ) => {
116+ cy . clearEditor ( ) ;
117+ cy . collapseTables ( ) ;
118+ cy . collapseMatViews ( ) ;
119+ cy . expandTables ( ) ;
120+ } ) ;
121+
122+ it ( "should expand and collapse folders using keyboard" , ( ) => {
123+ cy . getByDataHook ( "schema-table-title" ) . contains ( "btc_trades" ) . dblclick ( ) ;
124+ cy . getByDataHook ( "schema-folder-title" ) . should ( "contain" , "Columns" ) ;
125+ // go to the columns folder
126+ cy . realPress ( "ArrowDown" ) ;
127+
128+ // expand the columns folder
129+ cy . realPress ( "ArrowRight" ) ;
130+ cy . getByDataHook ( "schema-row" ) . should ( "contain" , "symbol" ) ;
131+
132+ // go to the symbol column
133+ cy . realPress ( "ArrowRight" ) ;
134+
135+ // expand the symbol column
136+ cy . realPress ( "ArrowRight" ) ;
137+ cy . getByDataHook ( "schema-row" ) . should ( "contain" , "Indexed:" ) ;
138+
139+ // collapse the symbol column
140+ cy . realPress ( "ArrowLeft" ) ;
141+ cy . contains ( "Indexed:" ) . should ( "not.exist" ) ;
142+
143+ // go to columns folder
144+ cy . realPress ( "ArrowLeft" ) ;
145+ cy . focused ( ) . should ( "contain" , "Columns" ) ;
146+
147+ // collapse the columns folder
148+ cy . focused ( ) . should ( "contain" , "Columns" ) ;
149+ cy . realPress ( "ArrowLeft" ) ;
150+ cy . contains ( "symbol" ) . should ( "not.exist" ) ;
151+
152+ // go to the btc_trades table
153+ cy . realPress ( "ArrowLeft" ) ;
154+ cy . focused ( ) . should ( "contain" , "btc_trades" ) ;
155+
156+ // collapse the table
157+ cy . focused ( ) . should ( "contain" , "btc_trades" ) ;
158+ cy . realPress ( "ArrowLeft" ) ;
159+ cy . contains ( "Columns" ) . should ( "not.exist" ) ;
160+
161+ // go to the tables folder
162+ cy . realPress ( "ArrowLeft" ) ;
163+ cy . focused ( ) . should ( "contain" , `Tables (${ tables . length } )` ) ;
164+
165+ // collapse the tables folder
166+ cy . focused ( ) . should ( "contain" , "Tables" ) ;
167+ cy . realPress ( "ArrowLeft" ) ;
168+ cy . contains ( "btc_trades" ) . should ( "not.exist" ) ;
169+
170+ // go to the materialized views folder
171+ cy . realPress ( "ArrowDown" ) ;
172+
173+ // expand the materialized views folder
174+ cy . realPress ( "ArrowRight" ) ;
175+ cy . getByDataHook ( "schema-row" ) . should ( "contain" , "btc_trades_mv" ) ;
176+
177+ // go to the materialized view
178+ cy . realPress ( "ArrowRight" ) ;
179+
180+ // expand the materialized view
181+ cy . realPress ( "ArrowRight" ) ;
182+ cy . getByDataHook ( "schema-row" ) . should ( "contain" , "Base tables" ) ;
183+
184+ cy . getByDataHook ( "schema-row" ) . contains ( "Base tables" ) . dblclick ( ) ;
185+ cy . getByDataHook ( "schema-detail-title" ) . should ( "contain" , "btc_trades" ) ;
186+
187+ // collapse base tables
188+ cy . realPress ( "ArrowLeft" ) ;
189+ cy . contains ( '[data-hook="schema-detail-title"]' , "btc_trades" ) . should (
190+ "not.exist"
191+ ) ;
192+
193+ // collapse the materialized view
194+ cy . getByDataHook ( "schema-row" ) . contains ( "btc_trades_mv" ) . dblclick ( ) ;
195+ cy . contains ( "Base tables" ) . should ( "not.exist" ) ;
196+
197+ // go to materialized views folder
198+ cy . realPress ( "ArrowUp" ) ;
199+
200+ // collapse the materialized views folder
201+ cy . realPress ( "ArrowLeft" ) ;
202+ cy . contains ( "btc_trades_mv" ) . should ( "not.exist" ) ;
203+ } ) ;
204+
205+ it ( "should switch the focus between grid and schema" , ( ) => {
206+ cy . getEditorContent ( ) . should ( "be.visible" ) ;
207+ cy . typeQuery ( "SELECT 123123;" ) ;
208+ cy . runLine ( ) ;
209+ cy . focused ( ) . should ( "contain" , "123123" ) ;
210+
211+ cy . expandMatViews ( ) ;
212+ cy . focused ( ) . should (
213+ "contain" ,
214+ `Materialized views (${ materializedViews . length } )`
215+ ) ;
216+ cy . contains ( ".qg-c-active" , "123123" ) . should ( "not.exist" ) ;
217+
218+ cy . contains ( ".qg-c" , "123123" ) . click ( ) ;
219+ cy . focused ( ) . should ( "contain" , "123123" ) ;
220+ cy . getByDataHook ( "collapse-materialized-views" ) . should (
221+ "not.have.class" ,
222+ "focused"
223+ ) ;
224+ } ) ;
225+
226+ it ( "should go to the last item with End, and first item with Home" , ( ) => {
227+ cy . expandMatViews ( ) ;
228+ cy . realPress ( "Home" ) ;
229+ cy . focused ( ) . should ( "contain" , `Tables (${ tables . length } )` ) ;
230+ cy . realPress ( "End" ) ;
231+ const lastMatView = materializedViews [ materializedViews . length - 1 ] ;
232+ cy . focused ( ) . should ( "contain" , lastMatView ) ;
233+ } ) ;
234+ } ) ;
235+
102236describe ( "questdb schema with suspended tables with Linux OS error codes" , ( ) => {
103237 before ( ( ) => {
104238 cy . loadConsoleWithAuth ( ) ;
@@ -295,8 +429,10 @@ describe("materialized views", () => {
295429
296430 it ( "should show the base table and copy schema for a materialized view" , ( ) => {
297431 cy . expandMatViews ( ) ;
298- cy . getByDataHook ( "schema-matview-title" ) . contains ( "btc_trades_mv" ) . click ( ) ;
299- cy . getByDataHook ( "schema-row" ) . contains ( "Base tables" ) . click ( ) ;
432+ cy . getByDataHook ( "schema-matview-title" )
433+ . contains ( "btc_trades_mv" )
434+ . dblclick ( ) ;
435+ cy . getByDataHook ( "schema-row" ) . contains ( "Base tables" ) . dblclick ( ) ;
300436 cy . getByDataHook ( "schema-detail-title" )
301437 . contains ( "btc_trades" )
302438 . should ( "exist" ) ;
0 commit comments