From 8c48f153633afb66ae25d753accfe1f27592befd Mon Sep 17 00:00:00 2001 From: wesleybl Date: Thu, 14 Mar 2024 10:37:37 -0300 Subject: [PATCH] Test core basic with prefixed site --- .github/workflows/acceptance.yml | 6 ++-- .../volto/cypress/tests/core/basic/actions.js | 8 ++++-- .../tests/core/basic/deleteItemModal.js | 28 +++++++++++-------- 3 files changed, 25 insertions(+), 17 deletions(-) diff --git a/.github/workflows/acceptance.yml b/.github/workflows/acceptance.yml index 24ee0d3d212..97063f5b00d 100644 --- a/.github/workflows/acceptance.yml +++ b/.github/workflows/acceptance.yml @@ -1227,9 +1227,9 @@ jobs: name: cypress-videos path: packages/volto/cypress/videos - prefix: + prefix-core: if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name - name: Prefixed site + name: Core Basic Prefixed Site runs-on: ubuntu-latest timeout-minutes: 35 strategy: @@ -1290,7 +1290,7 @@ jobs: install: false working-directory: packages/volto browser: chrome - spec: cypress/tests/minimal/**/*.js + spec: cypress/tests/core/basic/**/*.js config: baseUrl=http://localhost/foo env: prefixPath=/foo start: | diff --git a/packages/volto/cypress/tests/core/basic/actions.js b/packages/volto/cypress/tests/core/basic/actions.js index 58c87c0a3d6..c319fb05399 100644 --- a/packages/volto/cypress/tests/core/basic/actions.js +++ b/packages/volto/cypress/tests/core/basic/actions.js @@ -1,4 +1,5 @@ describe('actions Tests', () => { + let prefixPath; beforeEach(() => { cy.autologin(); cy.createContent({ @@ -8,6 +9,7 @@ describe('actions Tests', () => { allow_discussion: true, }); cy.visit('/contents'); + prefixPath = Cypress.env('prefixPath') || ''; }); it('copy', function () { cy.get('tr[aria-label="/my-page-1"]').within(() => { @@ -20,7 +22,7 @@ describe('actions Tests', () => { cy.get('a[class="icon-align-name"]').should( 'have.attr', 'href', - '/copy_of_my-page-1/contents', + `${prefixPath}/copy_of_my-page-1/contents`, ); }); }); @@ -44,7 +46,7 @@ describe('actions Tests', () => { cy.get('a[class="icon-align-name"]').should( 'have.attr', 'href', - '/my-page-1/contents', + `${prefixPath}/my-page-1/contents`, ); }); }); @@ -62,7 +64,7 @@ describe('actions Tests', () => { cy.get('a[class="icon-align-name"]').should( 'have.attr', 'href', - '/my-page-rename/contents', + `${prefixPath}/my-page-rename/contents`, ); }); }); diff --git a/packages/volto/cypress/tests/core/basic/deleteItemModal.js b/packages/volto/cypress/tests/core/basic/deleteItemModal.js index 3a1cbcd9291..131a22c56f9 100644 --- a/packages/volto/cypress/tests/core/basic/deleteItemModal.js +++ b/packages/volto/cypress/tests/core/basic/deleteItemModal.js @@ -1,4 +1,5 @@ describe('Modal View for different content types', () => { + let prefixPath; const simpleSlateLink = (target) => { return { '@type': 'slate', @@ -32,6 +33,7 @@ describe('Modal View for different content types', () => { beforeEach(() => { cy.autologin(); cy.visit('/'); + prefixPath = Cypress.env('prefixPath') || ''; }); it('As editor I get a warning on deleting my page when my page is referenced in the richtext', () => { cy.createContent({ @@ -53,7 +55,7 @@ describe('Modal View for different content types', () => { cy.get('[aria-label="/document-linked"] > :nth-child(2)').click(); cy.get('[aria-label="Delete"]').click(); cy.get('.medium > .header').should('be.visible'); - cy.get('li > [href="/document-linked"]'); + cy.get(`li > [href="${prefixPath}/document-linked"]`); }); it('As editor I get a warning on deleting my page when my News-Item is referenced in the richtext', () => { cy.createContent({ @@ -76,7 +78,7 @@ describe('Modal View for different content types', () => { cy.get('[aria-label="/news-item-linked"] > :nth-child(2)').click(); cy.get('[aria-label="Delete"]').click(); cy.get('.medium > .header').should('be.visible'); - cy.get('li > [href="/news-item-linked"]'); + cy.get(`li > [href="${prefixPath}/news-item-linked"]`); }); it('As editor I get a warning on deleting my page when my Event is referenced in the richtext', () => { cy.createContent({ @@ -99,7 +101,7 @@ describe('Modal View for different content types', () => { cy.get('[aria-label="/event-linked"] > :nth-child(2)').click(); cy.get('[aria-label="Delete"]').click(); cy.get('.medium > .header').should('be.visible'); - cy.get('li > [href="/event-linked"]'); + cy.get(`li > [href="${prefixPath}/event-linked"]`); }); it('As editor I get a warning on deleting my page when my File is referenced in the richtext', () => { cy.createContent({ @@ -145,7 +147,7 @@ describe('Modal View for different content types', () => { cy.get('[aria-label="/image-linked"] > :nth-child(2)').click(); cy.get('[aria-label="Delete"]').click(); cy.get('.medium > .header').should('be.visible'); - cy.get('li > [href="/image-linked"]'); + cy.get(`li > [href="${prefixPath}/image-linked"]`); }); it('As editor I get a warning on deleting my page when my Link is referenced in the richtext', () => { //Test Setup @@ -173,13 +175,15 @@ describe('Modal View for different content types', () => { cy.get('[aria-label="/link-linked"] > :nth-child(2)').click(); cy.get('[aria-label="Delete"]').click(); cy.get('.medium > .header').should('be.visible'); - cy.get('li > [href="/link-linked"]'); + cy.get(`li > [href="${prefixPath}/link-linked"]`); }); }); describe('Test if different forms of Linking content appear in Delete Modal View', () => { + let prefixPath; beforeEach(() => { cy.autologin(); cy.visit('/'); + prefixPath = Cypress.env('prefixPath') || ''; }); it('As editor I get a warning on deleting my page when my Document is referenced in the Teaser Block', () => { cy.createContent({ @@ -220,7 +224,7 @@ describe('Test if different forms of Linking content appear in Delete Modal View cy.get('[aria-label="/document-linked"] > :nth-child(2)').click(); cy.get('[aria-label="Delete"]').click(); cy.get('.medium > .header').should('be.visible'); - cy.get('li > [href="/document-linked"]'); + cy.get(`li > [href="${prefixPath}/document-linked"]`); }); it('As editor I get a warning on deleting my page when my Image is referenced in the Teaser Block', () => { cy.createContent({ @@ -281,10 +285,12 @@ describe('Test if different forms of Linking content appear in Delete Modal View cy.get('[aria-label="Select Image that is linked"]').click(); cy.get('#toolbar-save').click(); cy.visit('/contents'); - cy.get('[aria-label="/document-linked"] > :nth-child(2)').click(); + cy.get( + `[aria-label="${prefixPath}/document-linked"] > :nth-child(2)`, + ).click(); cy.get('[aria-label="Delete"]').click(); cy.get('.medium > .header').should('be.visible'); - cy.get('li > [href="/document-linked"]'); + cy.get(`li > [href="${prefixPath}/document-linked"]`); }); it('As editor I get a warning on deleting my Document when my Image is referenced via Image Block', () => { cy.createContent({ @@ -311,7 +317,7 @@ describe('Test if different forms of Linking content appear in Delete Modal View cy.get('[aria-label="/image-linked"] > :nth-child(2)').click(); cy.get('[aria-label="Delete"]').click(); cy.get('.medium > .header').should('be.visible'); - cy.get('li > [href="/image-linked"]'); + cy.get(`li > [href="${prefixPath}/image-linked"]`); }); it('As editor I get a warning on deleting my Image when my Image is referenced in the Image Block', () => { cy.createContent({ @@ -349,7 +355,7 @@ describe('Test if different forms of Linking content appear in Delete Modal View cy.get('[aria-label="/document-linked"] > :nth-child(2)').click(); cy.get('[aria-label="Delete"]').click(); cy.get('.medium > .header').should('be.visible'); - cy.get('li > [href="/document-linked"]'); + cy.get(`li > [href="${prefixPath}/document-linked"]`); }); it('As an Editor I get a warning on deleting my document when it is linked somewhere via teaser block inside a grid block', () => { cy.createContent({ @@ -401,6 +407,6 @@ describe('Test if different forms of Linking content appear in Delete Modal View cy.get('[aria-label="/document-linked"] > :nth-child(2)').click(); cy.get('[aria-label="Delete"]').click(); cy.get('.medium > .header').should('be.visible'); - cy.get('li > [href="/document-linked"]'); + cy.get(`li > [href="${prefixPath}/document-linked"]`); }); });