From 38b8d51f2c22b41e32a74388b7007990f2986acc Mon Sep 17 00:00:00 2001 From: Olivia Guyot Date: Tue, 30 Jul 2024 17:07:37 +0200 Subject: [PATCH 1/4] e2e: make no-link-block test more reliable The record soes not require a login anymore, and no http interception either --- .../src/e2e/datasetDetailPage.cy.ts | 27 +++++++------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/apps/datahub-e2e/src/e2e/datasetDetailPage.cy.ts b/apps/datahub-e2e/src/e2e/datasetDetailPage.cy.ts index 1a1a9626b2..0fa64a3f0b 100644 --- a/apps/datahub-e2e/src/e2e/datasetDetailPage.cy.ts +++ b/apps/datahub-e2e/src/e2e/datasetDetailPage.cy.ts @@ -94,7 +94,7 @@ describe('dataset pages', () => { describe('GENERAL : display & functions', () => { describe('no-link-error block', () => { - it("shouldn't be there until metadata is fully loaded", () => { + it("shouldn't be there if there are links", () => { cy.visit('/dataset/a3774ef6-809d-4dd1-984f-9254f49cbd0a') cy.get('[data-test=dataset-has-no-link-block]').should('not.exist') }) @@ -597,24 +597,15 @@ describe('dataset pages', () => { }) describe('When there is no link', () => { - it('display the error datasetHasNoLink error block', () => { - cy.login() - - cy.intercept( - 'GET', - '/geonetwork/srv/api/userfeedback?metadataUuid=a3774ef6-809d-4dd1-984f-9254f49cbd0a', - (req) => { - // Test if the error block is not shown before the metadata is fully loaded - cy.get('[data-test="dataset-has-no-link-block"]').should( - 'not.exist' - ) - } - ).as('getData') - + beforeEach(() => { cy.visit('/dataset/a3774ef6-809d-4dd1-984f-9254f49cbd0a') - - cy.wait('@getData') - + }) + it('do not display the no-link-error warning initially, only after loading', () => { + // wait for metadata info to show up + cy.get('gn-ui-metadata-info').should('exist') + // first, the block is not visible + cy.get('[data-test="dataset-has-no-link-block"]').should('not.exist') + // then the block shows up cy.get('[data-test="dataset-has-no-link-block"]').should('exist') }) }) From 6533a55613d494980c4bac446173ac84d65ec12f Mon Sep 17 00:00:00 2001 From: Olivia Guyot Date: Tue, 30 Jul 2024 17:10:45 +0200 Subject: [PATCH 2/4] chore: update db dump The "record with no link" record is now public --- .../docker-entrypoint-initdb.d/dump | Bin 460017 -> 460029 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/support-services/docker-entrypoint-initdb.d/dump b/support-services/docker-entrypoint-initdb.d/dump index 55bf76ca5eed2c3e04405d78e96c6f7c7012b1ee..a8db47c2717ff32c53aa84be43d0f8c1caa5c048 100644 GIT binary patch delta 2139 zcmY*ZYgAKL7QQ>YL@7~ug@U}4f)5Bu2uVQERxA#PfV8m`6+tjXC`u_Ll0w8s5g8vC z@lts%bxONNY&$8QiaccL0$Efj=u}6mh>s$a7NUa&5ty@+{^(?#bMM;ce0%S2e|z8P zi(RLRT|HyM!=hrqmNB0N01W+E<6|~HxcG1@^;|3vdH9BV8VVrL?H}3(W+LV-ZK185Zff`g0I^O! z;sF$?{M{Qkfihk7ACZV09*qDH>BRa_FcULN*ty%mL09r@BbZ5;0JNNS)6bP)E|xJt zY*Gr?X~!z9b!Fo$m6_9IU|ambneqhwT-ZwMlF5k2JjlXK z$LE8bQYS-pa14=o4#+@4E;>RoZ~|mx0S{0nlICopw1oYp792?Hn?My3Gl6KjkU&=` zLbs*`=q8}?-A$DwdVsMJzS_C1_T)dFfSn-1g%F5v#UfY@9HESy^9Fy+a`!EWMLK@I zKy?xm)na^0$dx6KiR~q#Whj||WcWce0-OAy6oKmlkdK6sVMFZMZ-rn(t_k3C>@Djv>&nUvuh3za8O3q)*U3Y|u~&F~Mr^20GFJzJmw2hQI#7nNIK z057F~=|gQYv|vo?eIDho-40jK?o(h?DalQPdbAg%o9=I9z&*6T%Y=VoEU{J);7ZiH z;1ZrnK7mu{)t3zi(N4&LFVG&(HF6|hsHhjU*W^)}^!_)sDav0NUCf6Lyerf|7h29uIkC#W-(%cSe2lSb|=4e3C3l;bG>DYC;UU=d$mVX7*&%BYp8 z1GY8B%%r{+t|2J*G?pwX@;VE2bLcjs+njC-;&s+CEnE{!|8G^5D{e*}e-vP2-rJ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yot Date: Tue, 30 Jul 2024 20:00:41 +0200 Subject: [PATCH 3/4] e2e(dh): adapt tests for new record order --- apps/datahub-e2e/src/e2e/datasets.cy.ts | 26 ++++++++++++------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/apps/datahub-e2e/src/e2e/datasets.cy.ts b/apps/datahub-e2e/src/e2e/datasets.cy.ts index ae4fcd8811..f2f7518c9d 100644 --- a/apps/datahub-e2e/src/e2e/datasets.cy.ts +++ b/apps/datahub-e2e/src/e2e/datasets.cy.ts @@ -6,7 +6,7 @@ describe('datasets', () => { // aliases cy.get('gn-ui-results-list-item').find('a').as('results') - cy.get('@results').first().as('firstResult') + cy.get('@results').eq(1).as('sampleResult') cy.get('@results') .then(($results) => $results.length) .as('resultsCount') @@ -54,12 +54,12 @@ describe('datasets', () => { describe('display of dataset previews', () => { it('should display a logo for first and a placeholder for second result', () => { cy.get('@sortBy').selectDropdownOption('desc,createDate') // this makes the order reliable - cy.get('@firstResult') + cy.get('@sampleResult') .find('gn-ui-thumbnail') .children('div') .invoke('attr', 'data-cy-is-placeholder') .should('equal', 'false') - cy.get('@firstResult') + cy.get('@sampleResult') .find('gn-ui-thumbnail') .find('img') .invoke('attr', 'src') @@ -68,45 +68,45 @@ describe('datasets', () => { 'https://geocat-dev.dev.bgdi.ch/geonetwork/srv/api/records/9e1ea778-d0ce-4b49-90b7-37bc0e448300/attachments/test.png' ) cy.get('@results') - .eq(1) + .first() .find('gn-ui-thumbnail') .children('div') .invoke('attr', 'data-cy-is-placeholder') .should('equal', 'true') }) it('should display the title', () => { - cy.get('@firstResult') + cy.get('@sampleResult') .find('[data-cy="recordTitle"]') .should('be.visible') }) it('should display the summary', () => { - cy.get('@firstResult') + cy.get('@sampleResult') .find('[data-cy="recordAbstract"]') .should('be.visible') }) it('should display the organization', () => { - cy.get('@firstResult').find('[data-cy="recordOrg"]').should('be.visible') + cy.get('@sampleResult').find('[data-cy="recordOrg"]').should('be.visible') }) it('should display the star and like count', () => { - cy.get('@firstResult').find('[data-cy="recordFav"]').should('be.visible') + cy.get('@sampleResult').find('[data-cy="recordFav"]').should('be.visible') }) }) describe('interactions with dataset', () => { beforeEach(() => { - cy.get('@firstResult') + cy.get('@sampleResult') .find('gn-ui-favorite-star') .eq(0) .as('favoriteStar') }) it('should open the dataset page in the same application on click', () => { - cy.get('@firstResult').click() + cy.get('@sampleResult').click() cy.url().should('match', /^http:\/\/localhost:[0-9]+\/dataset\/.+/) }) describe('not logged in', () => { it('should show a popover with login link when hovering the favorite star', () => { cy.get('@favoriteStar').trigger('mouseenter') - cy.get('[id="tippy-1"]') + cy.get('[id="tippy-2"]') .find('a') .invoke('attr', 'href') .should('include', 'catalog.signin') @@ -437,8 +437,6 @@ describe('datasets', () => { describe('multiple filters', () => { beforeEach(() => { - cy.get('datahub-search-filters').scrollIntoView() - // filter by org cy.get('@filters').eq(0).click() getFilterOptions() @@ -559,7 +557,7 @@ describe('datasets', () => { it('should display quality widget', () => { cy.get('@sortBy').selectDropdownOption('desc,createDate') cy.get('gn-ui-progress-bar') - .eq(0) + .eq(1) .should('have.attr', 'ng-reflect-value', 87) }) From e8989096b656cfe12232bd99bc2ce73618b3a676 Mon Sep 17 00:00:00 2001 From: Olivia Guyot Date: Tue, 30 Jul 2024 20:52:28 +0200 Subject: [PATCH 4/4] ci: show thesauri loaded in docker compose init --- .../docker-entrypoint.d/04-upload-thesauri.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/support-services/docker-entrypoint.d/04-upload-thesauri.sh b/support-services/docker-entrypoint.d/04-upload-thesauri.sh index ae898293be..a288bbb530 100755 --- a/support-services/docker-entrypoint.d/04-upload-thesauri.sh +++ b/support-services/docker-entrypoint.d/04-upload-thesauri.sh @@ -18,3 +18,12 @@ do echo "" done +curl "http://$host/geonetwork/srv/fre/thesaurus?_content_type=json" \ + -H 'Accept: application/json, text/plain, */*' \ + -H 'Content-Type: multipart/form-data' \ + -H 'Accept: application/json, text/plain, */*' \ + -H "Cookie: JSESSIONID=$jsessionid; XSRF-TOKEN=$xsrf_token" \ + -H "X-XSRF-TOKEN: $xsrf_token" + +echo "" +echo "Thesauri uploaded to GeoNetwork."