11import { expect , test } from '@playwright/test' ;
22
33import { PageModel } from '../../models/PageModel' ;
4+ import { tenantName } from '../../utils/constants' ;
45import { toggleExperiment } from '../../utils/toggleExperiment' ;
6+ import { TenantPage } from '../tenant/TenantPage' ;
57
68import { Sidebar } from './Sidebar' ;
79
@@ -51,11 +53,52 @@ test.describe('Test Sidebar', async () => {
5153 expect ( menuItems ) . toEqual ( [ 'General' , 'Editor' , 'Experiments' , 'About' ] ) ;
5254 } ) ;
5355
54- test ( 'Documentation button is visible and clickable' , async ( { page} ) => {
56+ test ( 'Information button is visible and clickable' , async ( { page} ) => {
5557 const sidebar = new Sidebar ( page ) ;
5658 await sidebar . waitForSidebarToLoad ( ) ;
57- await expect ( sidebar . isDocumentationButtonVisible ( ) ) . resolves . toBe ( true ) ;
58- await sidebar . clickDocumentation ( ) ;
59+ await expect ( sidebar . isInformationButtonVisible ( ) ) . resolves . toBe ( true ) ;
60+ await sidebar . clickInformation ( ) ;
61+ } ) ;
62+
63+ test ( 'Information popup contains documentation and keyboard shortcuts' , async ( { page} ) => {
64+ const sidebar = new Sidebar ( page ) ;
65+ await sidebar . waitForSidebarToLoad ( ) ;
66+
67+ // Click the Information button to open the popup
68+ await sidebar . clickInformation ( ) ;
69+ await page . waitForTimeout ( 500 ) ; // Wait for animation
70+
71+ // Check if the popup is visible
72+ await expect ( sidebar . isPopupVisible ( ) ) . resolves . toBe ( true ) ;
73+
74+ // Check if the popup contains Documentation
75+ await expect ( sidebar . hasDocumentationInPopup ( ) ) . resolves . toBe ( true ) ;
76+
77+ // Check if the popup contains Keyboard shortcuts button
78+ await expect ( sidebar . hasHotkeysButtonInPopup ( ) ) . resolves . toBe ( true ) ;
79+ } ) ;
80+
81+ test ( 'Clicking hotkeys button in information popup opens hotkeys panel with title' , async ( {
82+ page,
83+ } ) => {
84+ const sidebar = new Sidebar ( page ) ;
85+ await sidebar . waitForSidebarToLoad ( ) ;
86+
87+ // Click the Information button to open the popup
88+ await sidebar . clickInformation ( ) ;
89+ await page . waitForTimeout ( 500 ) ; // Wait for animation
90+
91+ // Check if the popup is visible
92+ await expect ( sidebar . isPopupVisible ( ) ) . resolves . toBe ( true ) ;
93+
94+ // Check if hotkeys button is visible and click it
95+ await expect ( sidebar . hasHotkeysButtonInPopup ( ) ) . resolves . toBe ( true ) ;
96+ await sidebar . clickHotkeysButton ( ) ;
97+ await page . waitForTimeout ( 500 ) ; // Wait for animation
98+
99+ // Check if hotkeys panel is visible and has the title
100+ await expect ( sidebar . isHotkeysPanelVisible ( ) ) . resolves . toBe ( true ) ;
101+ await expect ( sidebar . hasHotkeysPanelTitle ( ) ) . resolves . toBe ( true ) ;
59102 } ) ;
60103
61104 test ( 'Account button is visible and clickable' , async ( { page} ) => {
@@ -65,6 +108,33 @@ test.describe('Test Sidebar', async () => {
65108 await sidebar . clickAccount ( ) ;
66109 } ) ;
67110
111+ test ( 'Pressing Ctrl+K in editor page opens hotkeys panel' , async ( { page} ) => {
112+ // Open editor page
113+ const pageQueryParams = {
114+ schema : tenantName ,
115+ database : tenantName ,
116+ general : 'query' ,
117+ } ;
118+
119+ const tenantPage = new TenantPage ( page ) ;
120+ await tenantPage . goto ( pageQueryParams ) ;
121+ await page . waitForTimeout ( 1000 ) ; // Wait for page to load fully
122+
123+ // Create sidebar instance to check for hotkeys panel
124+ const sidebar = new Sidebar ( page ) ;
125+
126+ // Initially hotkeys panel should not be visible
127+ await expect ( sidebar . isHotkeysPanelVisible ( ) ) . resolves . toBe ( false ) ;
128+
129+ // Press Ctrl+K to open hotkeys panel
130+ await page . keyboard . press ( 'Control+k' ) ;
131+ await page . waitForTimeout ( 500 ) ; // Wait for animation
132+
133+ // Check if hotkeys panel is visible and has the title
134+ await expect ( sidebar . isHotkeysPanelVisible ( ) ) . resolves . toBe ( true ) ;
135+ await expect ( sidebar . hasHotkeysPanelTitle ( ) ) . resolves . toBe ( true ) ;
136+ } ) ;
137+
68138 test ( 'Sidebar can be collapsed and expanded' , async ( { page} ) => {
69139 const sidebar = new Sidebar ( page ) ;
70140 await sidebar . waitForSidebarToLoad ( ) ;
0 commit comments