Skip to content

Commit

Permalink
Merge pull request #480 from ditrit/bugfix/allow_folder_root_name
Browse files Browse the repository at this point in the history
Bugfix: allow folder root name
  • Loading branch information
Zorin95670 authored Jan 16, 2024
2 parents 5400490 + 329f3e3 commit 7500f28
Show file tree
Hide file tree
Showing 53 changed files with 747 additions and 580 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ jobs:
- name: Run check dependencies
run: echo '```bash' > dependencies.txt && npx ncu -x "leto-modelizer*" >> dependencies.txt && echo '```' >> dependencies.txt
- name: Post comment
uses: machine-learning-apps/pr-comment@master
uses: luukkemp/pr-comment@2024.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
Expand Down Expand Up @@ -159,7 +159,7 @@ jobs:
run: |
npm install -g [email protected] && \
npm ci && \
npm run plugin:install -- repository-name="githubator-plugin" repository-url="https://github.com/ditrit/githubator-plugin.git#0.3.1" && \
npm run plugin:install -- repository-name="githubator-plugin" repository-url="https://github.com/ditrit/githubator-plugin.git#0.3.2" && \
npm run plugin:install -- repository-name="terrator-plugin" repository-url="https://github.com/ditrit/terrator-plugin.git#0.8.0" && \
npm run plugin:init && \
docker build -t leto-modelizer -f DockerfileE2E .
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ To run all the e2e tests, you need to run the application with ALL official plug
```bash
npm ci
npm run plugin:install -- repository-name="terrator-plugin" repository-url="https://github.com/ditrit/terrator-plugin.git#0.8.0"
npm run plugin:install -- repository-name="githubator-plugin" repository-url="https://github.com/ditrit/githubator-plugin.git#0.3.1"
npm run plugin:install -- repository-name="githubator-plugin" repository-url="https://github.com/ditrit/githubator-plugin.git#0.3.2"
npm run plugin:init
TEMPLATE_LIBRARY_BASE_URL="https://raw.githubusercontent.com/ditrit/leto-modelizer-templates-library/leto-modelizer/e2e_test" npm run dev
```
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ FROM develop-stage as build-stage
ARG proxy_url
WORKDIR /app
RUN npm run plugin:install -- repository-name="terrator-plugin" repository-url="https://github.com/ditrit/terrator-plugin.git#0.8.0"
RUN npm run plugin:install -- repository-name="githubator-plugin" repository-url="https://github.com/ditrit/githubator-plugin.git#0.3.1"
RUN npm run plugin:install -- repository-name="githubator-plugin" repository-url="https://github.com/ditrit/githubator-plugin.git#0.3.2"
RUN npm run plugin:init
RUN npm run build

Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Plugin to manage terraform files, by default it comes with aws provider definiti

Plugin to manage github action files.

[GitHub url](https://github.com/ditrit/githubator-plugin#0.3.1)
[GitHub url](https://github.com/ditrit/githubator-plugin#0.3.2)

## Compatibility versions table

Expand Down Expand Up @@ -101,7 +101,7 @@ Plugin to manage github action files.
<td>next version</td>
<td>= 0.23.0</td>
<td>= 0.8.0</td>
<td>= 0.3.1</td>
<td>= 0.3.3</td>
</tr>
</tbody>
</table>
Expand Down Expand Up @@ -137,7 +137,7 @@ Examples with official plugins:
- git repository url: `https://github.com/ditrit/terrator-plugin.git#0.8.0`
- githubator-plugin:
- plugin name: `githubator-plugin`
- git repository url: `https://github.com/ditrit/githubator-plugin.git#0.3.1`
- git repository url: `https://github.com/ditrit/githubator-plugin.git#0.3.2`

### Install custom plugin in command line

Expand All @@ -148,7 +148,7 @@ Options `repository-name` and `repository-url` can be added with the `npm run pl
npm run plugin:install -- repository-name="terrator-plugin" repository-url="https://github.com/ditrit/terrator-plugin.git#0.8.0"

# Example with github action plugin
npm run plugin:install -- repository-name="githubator-plugin" repository-url="https://github.com/ditrit/githubator-plugin.git#0.3.1"
npm run plugin:install -- repository-name="githubator-plugin" repository-url="https://github.com/ditrit/githubator-plugin.git#0.3.2"
```

Now that your plugin is installed, you can continue to install other plugins with the same command if you want.
Expand Down
3 changes: 3 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* Fix bug about (Link|Reference)Input options update, see [this issue](https://github.com/ditrit/leto-modelizer/issues/390).
* Fix bug about adding ellipsis on long file name in file explorer, see [this issue](https://github.com/ditrit/leto-modelizer/issues/383).
* Fix Dockerfile by adding git in order to install plugins.
* Fix bug on creating folder with same name as root folder, see [this issue](https://github.com/ditrit/leto-modelizer/issues/393).
* Fix bug on missing file name in config file when using githubator-plugin, see [this issue](https://github.com/ditrit/leto-modelizer/issues/465).
* Fix bug on deleting last component of model file, the file is deleted and model is no longer displayed in the list, see [this issue](https://github.com/ditrit/leto-modelizer/issues/474).

### Removed

Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/Bugfix/Issue370.feature
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ Feature: Fix issue #370: Wrong files opened when I switch to text view if multip
And I wait 1 second
Then I expect '[data-cy="file-tabs-container"] [data-cy="active-tab"]' appear 1 time on screen
And I expect '[data-cy="file-tabs-container"] [data-cy="inactive-tab"]' appear 0 time on screen
And I expect '[data-cy="file-tabs-container"] [data-cy="file_infra/new_file.tf"]' appear 1 time on screen
And I expect '[data-cy="file-tabs-container"] [data-cy="file_projectName/infra/new_file.tf"]' appear 1 time on screen
4 changes: 2 additions & 2 deletions cypress/e2e/Bugfix/Issue377.feature
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Feature: Fix issue #370: Unable to create and use diagram on root folder.
And I wait 2 seconds
Then I expect current url is 'projectName/modelizer/text\?plugin=terrator-plugin&path='
And I expect '[data-cy="file-explorer"] [data-cy="folder_projectName"]' is 'projectName'
And I expect '[data-cy="file-explorer"] [data-cy="file_new_file.tf"]' exists
And I expect '[data-cy="file-explorer"] [data-cy="file_projectName/new_file.tf"]' exists
And I expect '[data-cy="file-tabs-container"] [data-cy="active-tab"]' is 'new_file.tf'
And I expect active file content to contain 'provider.*"aws".*{}'

Expand All @@ -57,5 +57,5 @@ Feature: Fix issue #370: Unable to create and use diagram on root folder.
Then I expect current url is 'projectName/modelizer/text\?plugin=terrator-plugin&path=infra'

# verify we can switch to root diagram
When I double click on '[data-cy="file-explorer"] [data-cy="file_new_file.tf"]'
When I double click on '[data-cy="file-explorer"] [data-cy="file_projectName/new_file.tf"]'
Then I expect current url is 'projectName/modelizer/text\?plugin=terrator-plugin&path='
4 changes: 2 additions & 2 deletions cypress/e2e/Bugfix/Issue390.feature
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Feature: Fix issue #390: (Link|Reference)Input options are not updated

# Create second link option
When I click on '[data-cy="component-definition_aws_route53_record"]'
Then I expect '[id^="id_2"]' appear 1 times on screen
Then I expect '[id^="id_2"]' appear 1 time on screen

# Check two link options exist
When I click on '[data-cy="link-input_records"]'
Expand All @@ -56,7 +56,7 @@ Feature: Fix issue #390: (Link|Reference)Input options are not updated

# Create second link option
When I click on '[data-cy="component-definition_aws_route53_zone"]'
Then I expect '[id^="id_1"]' appear 1 times on screen
Then I expect '[id^="id_1"]' appear 1 time on screen

# Check two link options exist
When I click on '[data-cy="ref-input_zone_id"]'
Expand Down
24 changes: 12 additions & 12 deletions cypress/e2e/Bugfix/Issue392.feature
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,19 @@ Feature: Fix issue #392: Delete diagram should only remove parsable files of dia
And I wait 1 second
Then I expect current url is '{{ projectName }}/modelizer/text\?plugin=terrator-plugin&path=diag1/diag2'
And I expect '[data-cy="file-explorer"] [data-cy="folder_{{ projectName }}"]' exists
And I expect '[data-cy="file-explorer"] [data-cy="folder_diag1"]' exists
And I expect '[data-cy="file-explorer"] [data-cy="file_diag1/new_file.tf"]' exists
And I expect '[data-cy="file-explorer"] [data-cy="folder_diag1/diag2"]' exists
And I expect '[data-cy="file-explorer"] [data-cy="file_diag1/diag2/new_file.tf"]' exists
And I expect '[data-cy="file-explorer"] [data-cy="folder_{{ projectName }}/diag1"]' exists
And I expect '[data-cy="file-explorer"] [data-cy="file_{{ projectName }}/diag1/new_file.tf"]' exists
And I expect '[data-cy="file-explorer"] [data-cy="folder_{{ projectName }}/diag1/diag2"]' exists
And I expect '[data-cy="file-explorer"] [data-cy="file_{{ projectName }}/diag1/diag2/new_file.tf"]' exists

# Create non parsable file inside diag1 folder
When I hover '[data-cy="file-explorer"] [data-cy="folder-button_diag1"]' to make it visible
And I click on '[data-cy="file-explorer"] [data-cy="folder-button_diag1"]'
When I hover '[data-cy="file-explorer"] [data-cy="folder-button_{{ projectName }}/diag1"]' to make it visible
And I click on '[data-cy="file-explorer"] [data-cy="folder-button_{{ projectName }}/diag1"]'
And I click on '[data-cy="create-file-action-item"]'
And I set on '[data-cy="create-file-form"] [data-cy="name-input"]' text 'file1.txt'
And I click on '[data-cy="create-file-form"] [data-cy="submit-button"]'
And I wait 1 second
Then I expect '[data-cy="file-explorer"] [data-cy="file_diag1/file1.txt"]' exists
Then I expect '[data-cy="file-explorer"] [data-cy="file_{{ projectName }}/diag1/file1.txt"]' exists

# Go to models pages and check diagrams are displayed
When I click on '[data-cy="models-page-link-button"]'
Expand All @@ -72,8 +72,8 @@ Feature: Fix issue #392: Delete diagram should only remove parsable files of dia
When I click on '[data-cy="navigation-bar"] [data-cy="modelizer-switch-button"] [aria-pressed="false"]'
And I wait 1 second
Then I expect current url is '{{ projectName }}/modelizer/text\?plugin=terrator-plugin&path=diag1/diag2'
And I expect '[data-cy="file-explorer"] [data-cy="folder_diag1"]' exists
But I expect '[data-cy="file-explorer"] [data-cy="file_diag1/new_file.tf"]' not exists
And I expect '[data-cy="file-explorer"] [data-cy="file_diag1/file1.txt"]' exists
And I expect '[data-cy="file-explorer"] [data-cy="folder_diag1/diag2"]' exists
And I expect '[data-cy="file-explorer"] [data-cy="file_diag1/diag2/new_file.tf"]' exists
And I expect '[data-cy="file-explorer"] [data-cy="folder_{{ projectName }}/diag1"]' exists
But I expect '[data-cy="file-explorer"] [data-cy="file_{{ projectName }}/diag1/new_file.tf"]' not exists
And I expect '[data-cy="file-explorer"] [data-cy="file_{{ projectName }}/diag1/file1.txt"]' exists
And I expect '[data-cy="file-explorer"] [data-cy="folder_{{ projectName }}/diag1/diag2"]' exists
And I expect '[data-cy="file-explorer"] [data-cy="file_{{ projectName }}/diag1/diag2/new_file.tf"]' exists
40 changes: 40 additions & 0 deletions cypress/e2e/Bugfix/Issue393.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
Feature: Fix issue #393: File explorer is broken when creating a folder with the same name as the root folder

Scenario: File explorer can display a folder with the same name as the root folder
Given I clear cache
And I set viewport size to '1920' px for width and '1080' px for height
And I visit the '/'
And I wait until the application is loaded

# Project creation
When I click on '[data-cy="create-project-button"]'
And I set on '[data-cy="create-project-form"] [data-cy="name-input"]' text 'projectName'
And I click on '[data-cy="create-project-form"] [data-cy="submit-button"]'
Then I expect current url is 'projectName/models'

# Diagram creation
When I click on '[data-cy="create-diagram-button"]'
And I click on '[data-cy="create-diagram-from-scratch-button"]'
Then I expect '[data-cy="create-model-form"] [data-cy="plugin-select"]' is 'terrator-plugin'

When I click on '[data-cy="create-model-form"] [data-cy="submit-button"]'
Then I expect current url is 'projectName/modelizer/draw\?plugin=terrator-plugin&path='

# Check project folders and files are created in Text view
When I click on '[data-cy="navigation-bar"] [data-cy="modelizer-switch-button"] [aria-pressed="false"]'
And I wait 1 second
Then I expect current url is 'projectName/modelizer/text\?plugin=terrator-plugin&path='
And I expect '[data-cy="file-explorer"] [data-cy="folder_projectName"]' exists
And I expect '[data-cy="file-explorer"] [data-cy="file_projectName/new_file.tf"]' exists
And I expect '[data-cy="file-explorer"] [data-cy="file_projectName/README.md"]' exists

# Create "projectName" sub-folder in Text view and check folders and files still exist
When I hover '[data-cy="file-explorer"] [data-cy="folder-button_projectName"]' to make it visible
And I click on '[data-cy="file-explorer"] [data-cy="folder-button_projectName"]'
And I click on '[data-cy="create-folder-action-item"]'
And I set on '[data-cy="create-file-form"] [data-cy="name-input"]' text 'projectName'
And I click on '[data-cy="create-file-form"] [data-cy="submit-button"]'
And I wait 1 second
Then I expect '[data-cy="file-explorer"] [data-cy="folder_projectName/projectName"]' exists
And I expect '[data-cy="file-explorer"] [data-cy="file_projectName/new_file.tf"]' exists
And I expect '[data-cy="file-explorer"] [data-cy="file_projectName/README.md"]' exists
66 changes: 66 additions & 0 deletions cypress/e2e/Bugfix/Issue474.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
Feature: Fix issue #474: Delete last component of model file, the file is deleted and model is no longer displayed in the list

Scenario: Delete last component of model file should not delete the model
Given I clear cache
And I set viewport size to '1920' px for width and '1080' px for height
And I visit the '/'
And I wait until the application is loaded

# Project creation
When I click on '[data-cy="create-project-button"]'
And I set on '[data-cy="create-project-form"] [data-cy="name-input"]' text 'projectName'
And I click on '[data-cy="create-project-form"] [data-cy="submit-button"]'
Then I expect current url is 'projectName/models'

# Model creation
When I click on '[data-cy="create-diagram-button"]'
And I click on '[data-cy="create-diagram-from-scratch-button"]'
Then I expect '[data-cy="create-model-form"] [data-cy="plugin-select"]' is 'terrator-plugin'

When I click on '[data-cy="create-model-form"] [data-cy="submit-button"]'
Then I expect current url is 'projectName/modelizer/draw\?plugin=terrator-plugin&path='

# Click on component
When I click on '[data-cy="component-definitions-item_terrator-plugin"]'
And I wait 1 second
And I click on '[data-cy="component-definition_server"]'
And I wait 2 seconds
Then I expect '[data-cy="draw-container"]' exists
And I wait 1 second
And I expect '[id^="id_1"]' exists

# Check project folders and files are created in Text view
When I click on '[data-cy="navigation-bar"] [data-cy="modelizer-switch-button"] [aria-pressed="false"]'
And I wait 1 second
Then I expect current url is 'projectName/modelizer/text\?plugin=terrator-plugin&path='
And I expect '[data-cy="file-explorer"] [data-cy="folder_projectName"]' exists
And I expect '[data-cy="file-explorer"] [data-cy="file_projectName/new_file.tf"]' exists
And I expect '[data-cy="file-explorer"] [data-cy="file_projectName/README.md"]' exists
And I expect '[data-cy="file-tabs-container"] [data-cy="active-tab"]' appear 1 time on screen
And I expect '[data-cy="file-tabs-container"] [data-cy="active-tab"]' is 'new_file.tf'

# Go to Draw view and delete component
When I click on '[data-cy="navigation-bar"] [data-cy="modelizer-switch-button"] [aria-pressed="false"]'
And I wait 1 second
Then I expect current url is 'projectName/modelizer/draw\?plugin=terrator-plugin&path='

When I click on '[data-cy="draw-container"] [id^="id_1"]'
And I wait 1 second
Then I expect '[id^="remove-component"]' exists

When I force click on '[id^="remove-component"]'
And I wait 1 second
Then I expect '[data-cy="draw-container"] [id^="id_1"]' not exists

# Go to Text view and check default file exists
When I click on '[data-cy="navigation-bar"] [data-cy="modelizer-switch-button"] [aria-pressed="false"]'
And I wait 1 second
Then I expect current url is 'projectName/modelizer/text\?plugin=terrator-plugin&path='
And I expect '[data-cy="file-explorer"] [data-cy="folder_projectName"]' exists
And I expect '[data-cy="file-explorer"] [data-cy="file_projectName/new_file.tf"]' exists

# Check model is still displayed in the list
When I click on '[data-cy="models-page-link-button"]'
Then I expect current url is '{{ projectName }}/models'
And I expect '[data-cy="diagram-table"]' exists
And I expect '[data-cy="diagram-path_"]' exists
4 changes: 2 additions & 2 deletions cypress/e2e/DiagramsPage/CreateDiagram.feature
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@ Feature: Test diagrams page: diagram creation
And I wait 1 second
Then I expect current url is '{{ projectName }}/modelizer/text\?plugin=terrator-plugin&path={{ modelFolder }}'
And I expect '[data-cy="file-explorer"] [data-cy="folder_{{ projectName }}"]' is '{{ projectName }}'
And I expect '[data-cy="file-explorer"] [data-cy="folder_{{ modelFolder }}"]' exists
And I expect '[data-cy="file-explorer"] [data-cy="file_{{ modelFolder }}/new_file.tf"]' exists
And I expect '[data-cy="file-explorer"] [data-cy="folder_{{ projectName }}/{{ modelFolder }}"]' exists
And I expect '[data-cy="file-explorer"] [data-cy="file_{{ projectName }}/{{ modelFolder }}/new_file.tf"]' exists
Loading

0 comments on commit 7500f28

Please sign in to comment.