Skip to content

Inconsistency between testing with normal frontend server and cypress test-default mode #2574

@FisherSkyi

Description

@FisherSkyi

Please include the steps to reproduce the bug.

  1. testing with normal frontend server

    1. cd into frontend/, run npm run serve to boot up the local server
    2. click and run chartView_scrollButton.cy.js (note this is not specific to this testcase, but just as an example)
    3. observe that test fails
  2. cypress test-default mode

    1. go back to root directory of reposense, run ./gradlew testFrontend -Pci or any command that invlude serveTestReportDefault
    2. observe that test pass

What was expected to happen?

Both runs should either both pass or both fails

What actually happened? Please include a screenshot of the output.

One pass one fail for same test case.

The issue is in frontend/vite.config.mts.

  let publicDir = 'public';

  if (mode === 'test-default') {
    publicDir = '../build/serveTestReport/default/reposense-report';
  } else if (mode === 'test-portfolio') {
    publicDir = '../build/serveTestReport/portfolio/reposense-report';
  }

The variable mode comes from the Vite command line, usually via the npm script that launches Vite. For example, in frontend/serve.json

  - frontend/package.json:7 serve: runs vite
  - frontend/package.json:14 serveTestDefault: runs vite --mode test-default --port 9000 --open
  - frontend/package.json:15 serveTestPortfolio: runs vite --mode test-portfolio --port 9001 --open

In case 1 the publicDir is 'public' and we use the config in frontend/public/summary.json. In case 2 we use config in /build/serveTestReport/portfolio/reposense-report/summary.json. So essentially we are analying different reports

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions