@@ -284,6 +284,25 @@ Cypress.Commands.add("removeAllTags", () => {
284284 cy . get ( "[data-testid='save-edit-tags']" ) . click ( ) ;
285285} ) ;
286286
287+ /* FIXTURES */
288+
289+ Cypress . Commands . add ( "generateFixture" , ( name ) => {
290+ cy . writeFile ( Cypress . config ( "textFileLocation" ) + name + ".txt" , {
291+ hits : Cypress . _ . times ( 10 , ( ) => {
292+ return faker . lorem . paragraphs ( 50 ) ;
293+ } ) ,
294+ } ) ;
295+ } ) ;
296+
297+ Cypress . Commands . add ( "deleteFixtures" , ( ) => {
298+ //add command because config allows assets to be trashed with "cypress run"
299+ //but not "cypress open"
300+ const downloaded = Cypress . config ( "downloadsFolder" ) ;
301+ const generated = Cypress . config ( "textFileLocation" ) ;
302+ cy . task ( "deleteFolder" , downloaded ) ;
303+ cy . task ( "deleteFolder" , generated ) ;
304+ } )
305+
287306/*OTHER */
288307
289308Cypress . Commands . add ( "getFileContentFromOPFS" , async ( fileName ) => {
@@ -294,14 +313,6 @@ Cypress.Commands.add("getFileContentFromOPFS", async (fileName) => {
294313 return file . text ( ) ;
295314} )
296315
297- Cypress . Commands . add ( "generateFixture" , ( name ) => {
298- cy . writeFile ( Cypress . config ( "textFileLocation" ) + name + ".txt" , {
299- hits : Cypress . _ . times ( 10 , ( ) => {
300- return faker . lorem . paragraphs ( 50 ) ;
301- } ) ,
302- } ) ;
303- } ) ;
304-
305316Cypress . Commands . add ( "deleteDB" , ( ) => {
306317 indexedDB . deleteDatabase ( "sd-connect" ) ;
307318} ) ;
0 commit comments