@@ -6,34 +6,36 @@ test.use({ autoGoto: false });
6
6
test . describe ( 'UI Test' , ( ) => {
7
7
const fileList = [ 'test.jcad' , '3M_CONNECTOR.STEP' , 'fan.stl' ] ;
8
8
9
- // test.describe('Extension activation test', () => {
10
- // test('should emit an activation console message', async ({
11
- // page
12
- // }) => {
13
- // const logs: string[] = [];
9
+ test . describe ( 'Extension activation test' , ( ) => {
10
+ test ( 'should emit an activation console message' , async ( {
11
+ page
12
+ } ) => {
13
+ const logs : string [ ] = [ ] ;
14
14
15
- // page.on('console', message => {
16
- // console.log('CONSOLE MSG:', message.text());
17
- // logs.push(message.text());
18
- // console.log(`Total logs captured: ${logs.length}`);
19
- // });
15
+ page . on ( 'console' , message => {
16
+ console . log ( 'CONSOLE MSG:' , message . text ( ) ) ;
17
+ logs . push ( message . text ( ) ) ;
18
+ console . log ( `Total logs captured: ${ logs . length } ` ) ;
19
+ } ) ;
20
+
21
+ console . log ( 'pagey' , page ) ;
20
22
21
- // await page.goto();
23
+ await page . goto ( '?path=pad.jcad' ) ;
22
24
23
- // expect(logs.filter(s => s === 'Initializing OCC...')).toHaveLength(1);
24
- // expect(logs.filter(s => s === 'Done!')).toHaveLength(1);
25
- // });
26
- // });
25
+ expect ( logs . filter ( s => s === 'Initializing OCC...' ) ) . toHaveLength ( 1 ) ;
26
+ expect ( logs . filter ( s => s === 'Done!' ) ) . toHaveLength ( 1 ) ;
27
+ } ) ;
28
+ } ) ;
27
29
28
30
test . describe ( 'File operations' , ( ) => {
29
- // test.beforeAll(async ({ request }) => {
30
- // const content = galata.newContentsHelper(request);
31
- // await content.deleteDirectory('/examples');
32
- // await content.uploadDirectory(
33
- // path.resolve(__dirname, '../../examples'),
34
- // '/examples'
35
- // );
36
- // });
31
+ test . beforeAll ( async ( { request } ) => {
32
+ const content = galata . newContentsHelper ( request ) ;
33
+ await content . deleteDirectory ( '/examples' ) ;
34
+ await content . uploadDirectory (
35
+ path . resolve ( __dirname , '../../examples' ) ,
36
+ '/examples'
37
+ ) ;
38
+ } ) ;
37
39
let errors = 0 ;
38
40
test . beforeEach ( async ( { page } ) => {
39
41
page . setViewportSize ( { width : 1920 , height : 1080 } ) ;
@@ -50,28 +52,24 @@ test.describe('UI Test', () => {
50
52
} ) ;
51
53
52
54
for ( const file of fileList ) {
53
- test ( `Should be able to render ${ file } without error` , async ( { browser } ) => {
54
- const context = await browser . newContext ( ) ;
55
- const page = await context . newPage ( ) ;
56
-
57
- await page . goto ( `lab/index.html?path= ${ file } `, { waitUntil : 'domcontentloaded' } ) ;
58
- console . log ( 'FILE LOADED' ) ;
59
-
55
+ test ( `Should be able to render ${ file } without error` , async ( {
56
+ page
57
+ } ) => {
58
+ await page . goto ( ) ;
59
+ const fullPath = `examples/ ${ file } `;
60
+ await page . notebook . openByPath ( fullPath ) ;
61
+ await page . notebook . activate ( fullPath ) ;
60
62
await page . locator ( 'div.jpcad-Spinner' ) . waitFor ( { state : 'hidden' } ) ;
61
63
await page . waitForTimeout ( 1000 ) ;
62
64
63
65
if ( await page . getByRole ( 'button' , { name : 'Ok' } ) . isVisible ( ) ) {
64
66
await page . getByRole ( 'button' , { name : 'Ok' } ) . click ( ) ;
65
67
}
66
68
67
- // await page.sidebar.close('left');
68
- // await page.sidebar.close('right');
69
+ await page . sidebar . close ( 'left' ) ;
70
+ await page . sidebar . close ( 'right' ) ;
69
71
await page . waitForTimeout ( 1000 ) ;
70
-
71
- const main = await page . waitForSelector ( '#jp-main-split-panel' , { state : 'visible' , timeout : 10000 } ) ;
72
-
73
- console . log ( 'hurrayyyy' , main ) ;
74
-
72
+ const main = await page . $ ( '#jp-main-split-panel' ) ;
75
73
expect ( errors ) . toBe ( 0 ) ;
76
74
if ( main ) {
77
75
expect ( await main . screenshot ( ) ) . toMatchSnapshot ( {
0 commit comments