https://cypress.io logo
#help
Title
# help
b

brash-cpu-33893

09/26/2022, 6:02 PM
I did like this.... is there any possibility to keep this xml data some where or I can read it?
f

fancy-mechanic-10638

09/26/2022, 6:04 PM
You'd create
/cypress/fixtures/file.xml
and put it there. Then you read it via
cy.fixture('file')
and then do a string replacement to populate the values you want.
b

brash-cpu-33893

09/26/2022, 6:14 PM
okay i have moved the code in xml, and read it . now how to do string replacement to populate value , i didn't got you
static buildImportPACS008File = ( fileRef: number, timestamp: string, bankingDate: string, TxId: string, iban: string): Cypress.Chainable => { return cy.fixture('importPacs008File.xml') }
f

fancy-mechanic-10638

09/26/2022, 6:16 PM
That's a static method in your code, not your test file, right?
b

brash-cpu-33893

09/26/2022, 6:17 PM
Yeah this is static method.. I will call this in my test file, or may be i think i can do directly in test file
f

fancy-mechanic-10638

09/26/2022, 6:17 PM
So you wouldn't do it that way. You'd call the
cy.fixture('file.xml').then(contents => contents.replace("FILE_REF", fileRef)
Just chain each
replace
call