Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code Editor #38

Open
DavertMik opened this issue Dec 9, 2019 · 0 comments
Open

Code Editor #38

DavertMik opened this issue Dec 9, 2019 · 0 comments
Labels
enhancement New feature or request frontend

Comments

@DavertMik
Copy link
Contributor

DavertMik commented Dec 9, 2019

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
});
@DavertMik DavertMik added enhancement New feature or request frontend labels Dec 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request frontend
Projects
None yet
Development

No branches or pull requests

1 participant