From 2a54dc9664d38d4282b30c16e1ba459d7c53ac56 Mon Sep 17 00:00:00 2001 From: Max Date: Wed, 25 Jun 2025 13:24:46 +0200 Subject: [PATCH] Build source maps (#8695) Builds source maps, so we can debug our frontend code on stage and production. --- .github/workflows/test-e2e.yml | 23 +++++++++++++++---- ...rted_posts_including_the_one_from_above.js | 13 +++-------- .../common/I_click_on_{string}.js | 12 ++++++++++ webapp/nuxt.config.js | 4 ++++ 4 files changed, 38 insertions(+), 14 deletions(-) diff --git a/.github/workflows/test-e2e.yml b/.github/workflows/test-e2e.yml index bbf321a47..a0f9488cd 100644 --- a/.github/workflows/test-e2e.yml +++ b/.github/workflows/test-e2e.yml @@ -8,7 +8,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.1.7 + uses: actions/checkout@09d2acae674a48949e3602304ab46fd20ae0c42f # v4.2.2 - name: Copy backend env file run: | @@ -46,7 +46,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.1.7 + uses: actions/checkout@09d2acae674a48949e3602304ab46fd20ae0c42f # v4.2.2 - name: Copy backend env file run: | @@ -69,7 +69,13 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.1.7 + uses: actions/checkout@09d2acae674a48949e3602304ab46fd20ae0c42f # v4.2.2 + + - name: Setup Node.js + uses: actions/setup-node@08f58d1471bff7f3a07d167b4ad7df25d5fcfcb6 # v4.4.0 + with: + node-version-file: 'backend/.tool-versions' + cache: 'yarn' - name: Copy env files run: | @@ -107,6 +113,15 @@ jobs: # run copies of the current job in parallel job: [1, 2, 3, 4, 5, 6, 7, 8] steps: + - name: Checkout code + uses: actions/checkout@09d2acae674a48949e3602304ab46fd20ae0c42f # v4.2.2 + + - name: Setup Node.js + uses: actions/setup-node@08f58d1471bff7f3a07d167b4ad7df25d5fcfcb6 # v4.4.0 + with: + node-version-file: 'backend/.tool-versions' + cache: 'yarn' + - name: Restore cypress cache uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.0.2 with: @@ -172,7 +187,7 @@ jobs: continue-on-error: true steps: - name: Checkout code - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.1.7 + uses: actions/checkout@09d2acae674a48949e3602304ab46fd20ae0c42f # v4.2.2 - name: Full stack tests | cleanup cache run: | diff --git a/cypress/support/step_definitions/Moderation.ReportContent/I_see_all_the_reported_posts_including_the_one_from_above.js b/cypress/support/step_definitions/Moderation.ReportContent/I_see_all_the_reported_posts_including_the_one_from_above.js index 40d018f6a..ea7abf3a1 100644 --- a/cypress/support/step_definitions/Moderation.ReportContent/I_see_all_the_reported_posts_including_the_one_from_above.js +++ b/cypress/support/step_definitions/Moderation.ReportContent/I_see_all_the_reported_posts_including_the_one_from_above.js @@ -1,14 +1,7 @@ import { defineStep } from '@badeball/cypress-cucumber-preprocessor' defineStep('I see all the reported posts including the one from above', () => { - cy.intercept({ - method: 'POST', - url: '/api', - hostname: 'localhost', - }).as('getReports') - - cy.wait(['@getReports'],{ timeout: 30000 }).then((interception) => { - console.log('Cypress interception:', interception) + cy.wait('@reportsQuery', { timeout: 30000 }).then((interception) => { cy.wrap(interception.response.statusCode).should('eq', 200) cy.wrap(interception.request.body) .should('have.property', 'query', `query ($orderBy: ReportOrdering, $first: Int, $offset: Int, $reviewed: Boolean, $closed: Boolean) { @@ -104,6 +97,6 @@ defineStep('I see all the reported posts including the one from above', () => { }) cy.get('table tbody').within(() => { - cy.contains('tr', 'The Truth about the Holocaust') + cy.contains('tr', 'The Truth about the Holocaust').should('be.visible') }) -}) +}) \ No newline at end of file diff --git a/cypress/support/step_definitions/common/I_click_on_{string}.js b/cypress/support/step_definitions/common/I_click_on_{string}.js index 3df19246d..78a1ad8da 100644 --- a/cypress/support/step_definitions/common/I_click_on_{string}.js +++ b/cypress/support/step_definitions/common/I_click_on_{string}.js @@ -14,6 +14,18 @@ defineStep('I click on {string}', element => { 'Moderation': 'a[href="/moderation"]', } + if (element === 'Moderation') { + cy.intercept({ + method: 'POST', + url: '/api', + hostname: 'localhost', + }, (req) => { + if (req.body && req.body.query && req.body.query.includes('query ($orderBy: ReportOrdering')) { + req.alias = 'reportsQuery' + } + }) + } + cy.get(elementSelectors[element]) .click() .wait(750) diff --git a/webapp/nuxt.config.js b/webapp/nuxt.config.js index 263c3f149..206272642 100644 --- a/webapp/nuxt.config.js +++ b/webapp/nuxt.config.js @@ -261,6 +261,10 @@ export default { }, } + if (ctx.isClient) { + config.devtool = 'source-map' + } + config.resolve.alias['~@'] = path.resolve(__dirname, '/') config.resolve.alias['@@'] = path.resolve(__dirname, '/')