Skip to content

Refactor the test cases to avoid hardcoded number #2535

@FisherSkyi

Description

@FisherSkyi

What feature(s) would you like to see in RepoSense

Test cases use percentile instead of number of pixel to represent the point to click.

Is the feature request related to a problem?

Right now in frontend cypress tests, many test cases related to the chartView has hard-coded coordinates. As an example, in testcase subzoom panel range should work correctly when timeline is optimised in file chartView_optimiseTimeline.cy.js

cy.get('body').type(zoomKey, { release: false })
  .get('#summary-charts .summary-chart__ramp .ramp')
  .first()
  .click(110, 20) // <- 110
  .click(120, 20); // <- 120

However, browser window size and screen resolution may influence the actual coordinates and may fail these test cases. (Not sure about this, will investigate)

If possible, describe the solution

Change to use the percentage, which is point's x coordinates divide by the whole length of the chart.

If applicable, describe alternatives you've considered

Additional context

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