Skip to content

Commit

Permalink
fix(me): adapt get uuid command
Browse files Browse the repository at this point in the history
  • Loading branch information
cmoinier committed Oct 30, 2024
1 parent abf5e09 commit dde2d71
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions tools/e2e/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,20 +158,25 @@ Cypress.Commands.add('clearRecordDrafts', () => {
Cypress.Commands.add('editor_readFormUniqueIdentifier', () => {
cy.intercept({
method: 'GET',
url: '/geonetwork/srv/api/records/**',
url: '/geonetwork/srv/api/records/**/formatters/xml?',
}).as('getRecord')

cy.wait('@getRecord').then((interception) => {
console.log('interception', interception)
const url = interception.request.url
const regex = /\/geonetwork\/srv\/api\/records\/([^\/]+)\//
const match = url.match(regex)
if (match && match[1]) {
const identifier = match[1]
return identifier
} else {
console.error('IDENTIFIER not found in URL')
}
cy.url().then((url) => {
if (url.includes('/edit/')) {
return url.split('edit/').pop()
} else {
const url = interception.request.url
const regex = /\/geonetwork\/srv\/api\/records\/([^\/]+)\//
const match = url.match(regex)
if (match && match[1]) {
const identifier = match[1]
return identifier
} else {
console.error('IDENTIFIER not found in URL')
}
}
})
})
})

Expand Down

0 comments on commit dde2d71

Please sign in to comment.