@@ -6,7 +6,6 @@ import { expect, galata, test } from '@jupyterlab/galata';
66import { Locator } from '@playwright/test' ;
77
88import * as path from 'path' ;
9- import { filterContent } from '../documentation/utils' ;
109
1110const sidebarIds : galata . SidebarTabId [ ] = [
1211 'filebrowser' ,
@@ -49,28 +48,6 @@ test.use({
4948} ) ;
5049
5150test . describe ( 'Sidebars' , ( ) => {
52- test . beforeAll ( async ( { request, tmpPath } ) => {
53- const contents = galata . newContentsHelper ( request ) ;
54-
55- // Create some dummy content
56- await contents . uploadFile (
57- path . resolve ( __dirname , `./notebooks/${ testNotebook } ` ) ,
58- `${ tmpPath } /${ testNotebook } `
59- ) ;
60- await contents . uploadFile (
61- path . resolve ( __dirname , `./notebooks/${ testFileName } ` ) ,
62- `${ tmpPath } /${ testFileName } `
63- ) ;
64- // Create a dummy folder
65- await contents . createDirectory ( `${ tmpPath } /${ testFolderName } ` ) ;
66- } ) ;
67-
68- test . afterAll ( async ( { request, tmpPath } ) => {
69- // Clean up the test files
70- const contents = galata . newContentsHelper ( request ) ;
71- await contents . deleteDirectory ( tmpPath ) ;
72- } ) ;
73-
7451 sidebarIds . forEach ( sidebarId => {
7552 test ( `Open Sidebar tab ${ sidebarId } ` , async ( { page } ) => {
7653 await page . sidebar . openTab ( sidebarId ) ;
@@ -87,26 +64,6 @@ test.describe('Sidebars', () => {
8764 } ) ;
8865 } ) ;
8966
90- // Additional test cases for resized widths of the file browser
91- for ( const [ sizeName , size ] of Object . entries ( sidebarWidths ) ) {
92- test ( `Open Sidebar tab filebrowser ${ sizeName } ` , async ( { page } ) => {
93- // Freeze all items' last modified dates as one day ago.
94- await galata . Mock . freezeContentLastModified ( page , filterContent ) ;
95-
96- await page . sidebar . openTab ( 'filebrowser' ) ;
97- // Resize the sidebar to the desired width.
98- await page . sidebar . setWidth ( size , 'left' ) ;
99- const imageName = `opened-sidebar-filebrowser-${ sizeName } .png` ;
100- const position = await page . sidebar . getTabPosition ( 'filebrowser' ) ;
101- const sidebar = page . sidebar . getContentPanelLocator (
102- position ?? undefined
103- ) ;
104- expect ( await sidebar . screenshot ( ) ) . toMatchSnapshot (
105- imageName . toLowerCase ( )
106- ) ;
107- } ) ;
108- }
109-
11067 test ( 'File Browser has no unused rules' , async ( { page } ) => {
11168 await page . sidebar . openTab ( 'filebrowser' ) ;
11269 const clickMenuItem = async ( command ) : Promise < void > => {
@@ -264,3 +221,46 @@ test.describe('Sidebars', () => {
264221 expect ( tableOfContentsElementRole ) . toEqual ( 'region' ) ;
265222 } ) ;
266223} ) ;
224+
225+ test . describe ( 'Sidebar filebrowser' , ( ) => {
226+ test . beforeEach ( async ( { page, request, tmpPath } ) => {
227+ const contents = galata . newContentsHelper ( request ) ;
228+ // Make each of these files a day old, so they show as 1 day old in the browser.
229+ await galata . Mock . freezeContentLastModified ( page ) ;
230+
231+ // Create some dummy content
232+ await contents . uploadFile (
233+ path . resolve ( __dirname , `./notebooks/${ testNotebook } ` ) ,
234+ `${ tmpPath } /${ testNotebook } `
235+ ) ;
236+ await contents . uploadFile (
237+ path . resolve ( __dirname , `./notebooks/${ testFileName } ` ) ,
238+ `${ tmpPath } /${ testFileName } `
239+ ) ;
240+ // Create a dummy folder
241+ await contents . createDirectory ( `${ tmpPath } /${ testFolderName } ` ) ;
242+ } ) ;
243+
244+ test . afterEach ( async ( { request, tmpPath } ) => {
245+ // Clean up the test files
246+ const contents = galata . newContentsHelper ( request ) ;
247+ await contents . deleteDirectory ( tmpPath ) ;
248+ } ) ;
249+
250+ // Additional test cases for resized widths of the file browser
251+ for ( const [ sizeName , size ] of Object . entries ( sidebarWidths ) ) {
252+ test ( `size ${ sizeName } ` , async ( { page } ) => {
253+ await page . sidebar . openTab ( 'filebrowser' ) ;
254+ // Resize the sidebar to the desired width.
255+ await page . sidebar . setWidth ( size , 'left' ) ;
256+ const imageName = `opened-sidebar-filebrowser-${ sizeName } .png` ;
257+ const position = await page . sidebar . getTabPosition ( 'filebrowser' ) ;
258+ const sidebar = page . sidebar . getContentPanelLocator (
259+ position ?? undefined
260+ ) ;
261+ expect ( await sidebar . screenshot ( ) ) . toMatchSnapshot (
262+ imageName . toLowerCase ( )
263+ ) ;
264+ } ) ;
265+ }
266+ } ) ;
0 commit comments