Skip to content

Code Editor #38

Open
Open
@DavertMik

Description

@DavertMik

We need a code editor that could do small updates in tests from a web interface.

Use Scenario

  • I open a test in UI
  • I click "Source" tab
  • I have a text editor with a source code, so I could edit the code
  • When I save the updated code it will be transferred to backend
  • A backend will open a corresponding file, and update the test function with my changes
  • (implemented) File update will trigger UI to refresh the test source

Technical Implementation

  • Monaco Editor is used for as code editor
  • a test contains information of line and file where the source is
  • frontend sends line & file information to backend (alternatively, this info is taken from backend)
  • test file is opened
  • source code is analyzed with acron or babel parser (AST parsers)
  • inside AST we search for a function starting on a line we received
  • we find the line where this function ends
  • replace a function in a source code by lines with the one received from a frontend
  • we save a file

Implementation Details

  • This parsing things should happen in lib/model/editor_repository.js
  • See acron / babel-parser for more info on parsing

Important notes

Each test starts with Scenario() prefix. We should not lose it while we update a file:

Scenario('name of a test', (I) => {
  // this function MUST BE REPLACED
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions