@@ -16,6 +16,7 @@ import {
1616 ClientsideDeletionFailsafeError ,
1717 ServersideAdditionFailsafeError , ServersideDeletionFailsafeError
1818} from '../errors/Error'
19+ import Logger from '../lib/Logger'
1920
2021chai . use ( chaiAsPromised )
2122const expect = chai . expect
@@ -72,7 +73,7 @@ describe('Floccus', function() {
7273 this . slow ( 20000 ) // 20s is slow
7374
7475 const params = ( new URL ( window . location . href ) ) . searchParams
75- let SERVER , CREDENTIALS , ACCOUNTS , APP_VERSION , SEED , BROWSER , RANDOM_MANIPULATION_ITERATIONS , TEST_URL
76+ let SERVER , CREDENTIALS , ACCOUNTS , APP_VERSION , SEED , BROWSER , RANDOM_MANIPULATION_ITERATIONS , TEST_URL , IS_CI
7677 SERVER =
7778 params . get ( 'server' ) ||
7879 'http://localhost'
@@ -83,6 +84,7 @@ describe('Floccus', function() {
8384 }
8485 APP_VERSION = params . get ( 'app_version' ) || 'stable'
8586 BROWSER = params . get ( 'browser' ) || 'firefox'
87+ IS_CI = params . get ( 'ci' ) === 'true'
8688
8789 SEED = ( new URL ( window . location . href ) ) . searchParams . get ( 'seed' ) || Math . random ( ) + ''
8890 console . log ( 'RANDOMNESS SEED' , SEED )
@@ -235,6 +237,13 @@ describe('Floccus', function() {
235237 if ( account ) {
236238 let localRoot = account . getData ( ) . localRoot
237239 if ( localRoot ) await browser . bookmarks . removeTree ( localRoot )
240+ // Dump logs if test failed
241+ if ( IS_CI && this . currentTest . isFailed ( ) ) {
242+ const logs = await Logger . getLogs ( )
243+ for ( const log of logs ) {
244+ console . log ( log )
245+ }
246+ }
238247 await account . delete ( )
239248 }
240249 } )
@@ -7458,6 +7467,13 @@ describe('Floccus', function() {
74587467 await account1 . delete ( )
74597468 await browser . bookmarks . removeTree ( account2 . getData ( ) . localRoot )
74607469 await account2 . delete ( )
7470+ // Dump logs if test failed
7471+ if ( IS_CI && this . currentTest . isFailed ( ) ) {
7472+ const logs = await Logger . getLogs ( )
7473+ for ( const log of logs ) {
7474+ console . log ( log )
7475+ }
7476+ }
74617477 } )
74627478
74637479 it ( 'should handle deep hierarchies with lots of bookmarks' , async function ( ) {
0 commit comments