From dde2d71659b5416d30b7921f98544f51aa68815c Mon Sep 17 00:00:00 2001 From: cmoinier Date: Wed, 30 Oct 2024 12:14:17 +0100 Subject: [PATCH] fix(me): adapt get uuid command --- tools/e2e/commands.ts | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/tools/e2e/commands.ts b/tools/e2e/commands.ts index ceba79dde..00a67aef0 100644 --- a/tools/e2e/commands.ts +++ b/tools/e2e/commands.ts @@ -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') + } + } + }) }) })