From 3366668a693f6d211688fb361fe83f50906fa400 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vincent=20Moitti=C3=A9?= Date: Mon, 24 Apr 2023 15:03:04 +0200 Subject: [PATCH 1/3] Make list of components is open by default --- src/components/list/LibraryList.vue | 5 ++--- tests/unit/components/list/LibraryList.spec.js | 16 ++++++++-------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/components/list/LibraryList.vue b/src/components/list/LibraryList.vue index 1084b6ffb..0dd60d9c3 100644 --- a/src/components/list/LibraryList.vue +++ b/src/components/list/LibraryList.vue @@ -67,10 +67,9 @@ const props = defineProps({ default: () => [], }, }); - const definitionFilter = ref(''); -const selectedItemId = ref(null); -const isSelected = ref(false); +const selectedItemId = ref(props.plugin.data.name); +const isSelected = ref(true); // TODO : remove this const // when @quasar/quasar-app-extension-testing-unit-jest@3.0.0 is officially released const inputLabel = computed(() => t('page.modelizer.drawer.components.filterLabel')); diff --git a/tests/unit/components/list/LibraryList.spec.js b/tests/unit/components/list/LibraryList.spec.js index 3980197f5..f98afb84d 100644 --- a/tests/unit/components/list/LibraryList.spec.js +++ b/tests/unit/components/list/LibraryList.spec.js @@ -118,21 +118,21 @@ describe('Test component: LibraryList', () => { describe('Test function: onItemClick', () => { it('should invert isSelected value and set selectedItemId equals to the given parameter', () => { - expect(wrapper.vm.isSelected).toBeFalsy(); + expect(wrapper.vm.isSelected).toBeTruthy(); - wrapper.vm.onItemClick('pluginName'); + wrapper.vm.onItemClick(); - expect(wrapper.vm.isSelected).toBeTruthy(); - expect(wrapper.vm.selectedItemId).toEqual('pluginName'); + expect(wrapper.vm.isSelected).toBeFalsy(); + expect(wrapper.vm.selectedItemId).toBeNull(); }); it('should invert isSelected value and set selectedItemId to null', () => { - wrapper.vm.isSelected = true; + wrapper.vm.isSelected = false; - wrapper.vm.onItemClick(); + wrapper.vm.onItemClick('pluginName'); - expect(wrapper.vm.isSelected).toBeFalsy(); - expect(wrapper.vm.selectedItemId).toEqual(null); + expect(wrapper.vm.isSelected).toBeTruthy(); + expect(wrapper.vm.selectedItemId).toEqual('pluginName'); }); }); }); From 082f5c60bb5f1bbb716d12c2f54149edd8181eab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vincent=20Moitti=C3=A9?= Date: Wed, 26 Apr 2023 14:04:00 +0200 Subject: [PATCH 2/3] Update e2e tests --- .../DrawView/plugin/display.component.feature | 9 +++------ .../DrawView/plugin/filter.plugin.feature | 14 +++++--------- .../DrawView/plugin/init.plugin.feature | 4 ++-- .../DrawView/template/display.component.feature | 13 ++++++++----- .../DrawView/template/filter.template.feature | 8 ++++++-- .../DrawView/template/init.template.feature | 6 +++++- .../ModelizerPage/SwitchView/add.component.feature | 12 +++++------- .../e2e/ModelizerPage/SwitchView/delete.feature | 8 +++----- 8 files changed, 37 insertions(+), 37 deletions(-) diff --git a/cypress/e2e/ModelizerPage/DrawView/plugin/display.component.feature b/cypress/e2e/ModelizerPage/DrawView/plugin/display.component.feature index 560ba50fd..ed1c45ff8 100644 --- a/cypress/e2e/ModelizerPage/DrawView/plugin/display.component.feature +++ b/cypress/e2e/ModelizerPage/DrawView/plugin/display.component.feature @@ -19,13 +19,10 @@ Feature: Test modelizer draw view: add plugin component Then I expect current url is 'projectName/modelizer/draw\?path=terrator-plugin/modelName' And I expect '[data-cy="component-definitions-item_terrator-plugin"]' appear 1 time on screen And I expect '[data-cy="component-definitions-item_terrator-plugin"] [data-cy="title"]' is 'terrator-plugin' - - # Select 'terrator-plugin' library - When I click on '[data-cy="component-definitions-item_terrator-plugin"]' - And I wait 1 second - Then I expect '[data-cy="component-definitions-item_terrator-plugin"].selected' exists + And I expect '[data-cy="component-definitions-item_terrator-plugin"].selected' exists And I expect '[data-cy="component-definition-grid"]' exists And I expect '[data-cy="component-definition-grid"] [class*="component-definition-card"]' appear 18 times on screen + And I wait 1 second Scenario Outline: Click on the component should display it on the page Then I expect '[data-cy="modelizer-draw-view"] [data-cy="draw-container"] [id^=""]' not exists @@ -56,7 +53,7 @@ Feature: Test modelizer draw view: add plugin component | aws_key_pair | @skip - # TODO: update/fix test + # TODO: update/fix test Scenario Outline: Dragging the component should display it on the page Then I expect '[data-cy="modelizer-draw-view"] [data-cy="draw-container"] [id^="_"]' not exists diff --git a/cypress/e2e/ModelizerPage/DrawView/plugin/filter.plugin.feature b/cypress/e2e/ModelizerPage/DrawView/plugin/filter.plugin.feature index 433adfe56..1ff8b9e98 100644 --- a/cypress/e2e/ModelizerPage/DrawView/plugin/filter.plugin.feature +++ b/cypress/e2e/ModelizerPage/DrawView/plugin/filter.plugin.feature @@ -56,7 +56,7 @@ Feature: Test modelizer draw view: plugin filter | volume | | subnet | | route53 | - + Scenario Outline: Set text as '' should not display plugin. When I set on '[data-cy="definitions-filter-input"]' text '' Then I expect '[data-cy="component-definitions-item_terrator-plugin"]' appear 0 time on screen @@ -70,8 +70,7 @@ Feature: Test modelizer draw view: plugin filter Scenario Outline: Select plugin and set text as '' should display only one element # Select 'terrator-plugin' library - When I click on '[data-cy="component-definitions-item_terrator-plugin"]' - And I wait 1 second + When I wait 1 second Then I expect '[data-cy="component-definitions-item_terrator-plugin"].selected' exists And I expect '[data-cy="component-definition-grid"]' exists And I expect '[data-cy="component-definition-grid"] [class*="component-definition-card"]' appear 18 times on screen @@ -101,8 +100,7 @@ Feature: Test modelizer draw view: plugin filter Scenario Outline: Select plugin and set text as '' should display only two elements # Select 'terrator-plugin' library - When I click on '[data-cy="component-definitions-item_terrator-plugin"]' - And I wait 1 second + When I wait 1 second Then I expect '[data-cy="component-definitions-item_terrator-plugin"].selected' exists And I expect '[data-cy="component-definition-grid"]' exists And I expect '[data-cy="component-definition-grid"] [class*="component-definition-card"]' appear 18 times on screen @@ -125,8 +123,7 @@ Feature: Test modelizer draw view: plugin filter Scenario Outline: Select plugin and set text as '' should not display any elements. # Select 'terrator-plugin' library - When I click on '[data-cy="component-definitions-item_terrator-plugin"]' - And I wait 1 second + When I wait 1 second Then I expect '[data-cy="component-definitions-item_terrator-plugin"].selected' exists And I expect '[data-cy="component-definition-grid"]' exists And I expect '[data-cy="component-definition-grid"] [class*="component-definition-card"]' appear 18 times on screen @@ -147,8 +144,7 @@ Feature: Test modelizer draw view: plugin filter And I expect '[data-cy="component-definitions-item_terrator-plugin"] [data-cy="title"]' is 'terrator-plugin (1)' # Select 'terrator-plugin' library - When I click on '[data-cy="component-definitions-item_terrator-plugin"]' - And I wait 1 second + When I wait 1 second Then I expect '[data-cy="component-definitions-item_terrator-plugin"].selected' exists And I expect '[data-cy="component-definitions-item_terrator-plugin"].selected [data-cy="title"]' is 'terrator-plugin (1)' And I expect '[data-cy="component-definition-grid"]' exists diff --git a/cypress/e2e/ModelizerPage/DrawView/plugin/init.plugin.feature b/cypress/e2e/ModelizerPage/DrawView/plugin/init.plugin.feature index 88055824c..b4c0692ce 100644 --- a/cypress/e2e/ModelizerPage/DrawView/plugin/init.plugin.feature +++ b/cypress/e2e/ModelizerPage/DrawView/plugin/init.plugin.feature @@ -17,13 +17,13 @@ Feature: Test modelizer draw view: plugin initialization When I set on '[data-cy="create-model-form"] [data-cy="name-input"]' text 'modelName' And I click on '[data-cy="create-model-form"] [data-cy="submit-button"]' Then I expect current url is 'projectName/modelizer/draw\?path=terrator-plugin/modelName' + And I wait 1 second Scenario: Terrator plugin should appear in component definitions list Then I expect '[data-cy="component-definitions-item_terrator-plugin"]' exists And I expect '[data-cy="component-definitions-item_terrator-plugin"] [data-cy="title"]' is 'terrator-plugin' - Scenario: Should have only one plugin installed with all these definitions - When I click on '[data-cy="component-definitions-item_terrator-plugin"]' + Scenario Outline: Should have only one plugin installed with all these definitions Then I expect '[data-cy="component-definitions-item_terrator-plugin"].selected' exists And I expect '[data-cy="component-definitions-item_terrator-plugin"].selected [data-cy="title"]' is 'terrator-plugin (18)' And I expect '[data-cy="component-definition-grid"] [class*="component-definition-card"]' appear 18 times on screen diff --git a/cypress/e2e/ModelizerPage/DrawView/template/display.component.feature b/cypress/e2e/ModelizerPage/DrawView/template/display.component.feature index 1fa898f57..9524e146b 100644 --- a/cypress/e2e/ModelizerPage/DrawView/template/display.component.feature +++ b/cypress/e2e/ModelizerPage/DrawView/template/display.component.feature @@ -17,17 +17,20 @@ Feature: Test modelizer draw view: add template component When I set on '[data-cy="create-model-form"] [data-cy="name-input"]' text 'modelName' And I click on '[data-cy="create-model-form"] [data-cy="submit-button"]' Then I expect current url is 'projectName/modelizer/draw\?path=terrator-plugin/modelName' - And I expect '[data-cy="component-definitions-item_Templates"]' appear 1 time on screen - And I expect '[data-cy="component-definitions-item_Templates"] [data-cy="title"]' is 'Templates' # Select 'Templates' library + When I click on '[data-cy="component-definitions-item_terrator-plugin"]' + And I wait 1 second + Then I expect '[data-cy="component-definitions-item_Templates"]' appear 1 time on screen + And I expect '[data-cy="component-definitions-item_Templates"] [data-cy="title"]' is 'Templates' + When I click on '[data-cy="component-definitions-item_Templates"]' And I wait 1 second Then I expect '[data-cy="component-definitions-item_Templates"].selected' exists And I expect '[data-cy="component-definition-grid"]' exists And I expect '[data-cy="component-definition-grid"] [class*="component-definition-card"]' appear 2 times on screen - Scenario Outline: Click on the Test application component should display it on the page + Scenario: Click on the Test application component should display it on the page Then I expect '[data-cy="modelizer-draw-view"] [data-cy="draw-container"] [id^="SecurityGroup_"]' not exists And I expect '[data-cy="modelizer-draw-view"] [data-cy="draw-container"] [id^="InternetGateway_"]' not exists And I expect '[data-cy="modelizer-draw-view"] [data-cy="draw-container"] [id^="VPC_"]' not exists @@ -40,9 +43,9 @@ Feature: Test modelizer draw view: add template component And I expect '[data-cy="modelizer-draw-view"] [data-cy="draw-container"] [id^="VPC_"]' exists And I expect '[data-cy="modelizer-draw-view"] [data-cy="draw-container"] [id^="VPC_"]' exists And I expect '[class="link"]' exists - + @skip - # TODO: update/fix test + # TODO: update/fix test Scenario Outline: Dragging the component should display it on the page Then I expect '[data-cy="modelizer-draw-view"] [data-cy="draw-container"] [id^="_"]' not exists diff --git a/cypress/e2e/ModelizerPage/DrawView/template/filter.template.feature b/cypress/e2e/ModelizerPage/DrawView/template/filter.template.feature index 1513fc173..f770992c9 100644 --- a/cypress/e2e/ModelizerPage/DrawView/template/filter.template.feature +++ b/cypress/e2e/ModelizerPage/DrawView/template/filter.template.feature @@ -17,7 +17,11 @@ Feature: Test modelizer draw view: template filter When I set on '[data-cy="create-model-form"] [data-cy="name-input"]' text 'modelName' And I click on '[data-cy="create-model-form"] [data-cy="submit-button"]' Then I expect current url is 'projectName/modelizer/draw\?path=terrator-plugin/modelName' - And I expect '[data-cy="component-definitions-item_Templates"]' exists + + When I wait 1 second + And I click on '[data-cy="component-definitions-item_terrator-plugin"]' + And I wait 1 second + Then I expect '[data-cy="component-definitions-item_Templates"]' exists Scenario Outline: Set text as '' should display only one element inside template title When I set on '[data-cy="definitions-filter-input"]' text '' @@ -28,7 +32,7 @@ Feature: Test modelizer draw view: template filter | filter | | Aws provider | | Test application | - + Scenario Outline: Set text as '' should not display template When I set on '[data-cy="definitions-filter-input"]' text '' Then I expect '[data-cy="component-definitions-item_Templates"]' appear 0 time on screen diff --git a/cypress/e2e/ModelizerPage/DrawView/template/init.template.feature b/cypress/e2e/ModelizerPage/DrawView/template/init.template.feature index 4d50138f7..2bcfc40fb 100644 --- a/cypress/e2e/ModelizerPage/DrawView/template/init.template.feature +++ b/cypress/e2e/ModelizerPage/DrawView/template/init.template.feature @@ -18,11 +18,15 @@ Feature: Test modelizer draw view: template initialization And I click on '[data-cy="create-model-form"] [data-cy="submit-button"]' Then I expect current url is 'projectName/modelizer/draw\?path=terrator-plugin/modelName' + When I wait 1 second + And I click on '[data-cy="component-definitions-item_terrator-plugin"]' + And I wait 1 second + Scenario: Template should appear in component definitions list Then I expect '[data-cy="component-definitions-item_Templates"]' exists And I expect '[data-cy="component-definitions-item_Templates"] [data-cy="title"]' is 'Templates' - Scenario: Should have only one plugin installed with all these definitions + Scenario Outline: Should have only one plugin installed with all these definitions When I click on '[data-cy="component-definitions-item_Templates"]' Then I expect '[data-cy="component-definitions-item_Templates"].selected' exists And I expect '[data-cy="component-definitions-item_Templates"].selected [data-cy="title"]' is 'Templates (2)' diff --git a/cypress/e2e/ModelizerPage/SwitchView/add.component.feature b/cypress/e2e/ModelizerPage/SwitchView/add.component.feature index b122b82ec..7ed55466b 100644 --- a/cypress/e2e/ModelizerPage/SwitchView/add.component.feature +++ b/cypress/e2e/ModelizerPage/SwitchView/add.component.feature @@ -19,11 +19,7 @@ Feature: Test switch model to text view: add component/link Then I expect current url is 'projectName/modelizer/draw\?path=terrator-plugin/modelName' And I expect '[data-cy="component-definitions-item_terrator-plugin"]' appear 1 time on screen And I expect '[data-cy="component-definitions-item_terrator-plugin"] [data-cy="title"]' is 'terrator-plugin' - - # Select 'terrator-plugin' library - When I click on '[data-cy="component-definitions-item_terrator-plugin"]' - And I wait 1 second - Then I expect '[data-cy="component-definitions-item_terrator-plugin"].selected' exists + And I expect '[data-cy="component-definitions-item_terrator-plugin"].selected' exists And I expect '[data-cy="component-definition-grid"]' exists And I expect '[data-cy="component-definition-grid"] [class*="component-definition-card"]' appear 18 times on screen @@ -99,7 +95,8 @@ Feature: Test switch model to text view: add component/link But I expect '[id^="aws"]' not exists Scenario: Link two components (Draw view) should update plugin file content with new attributes properties (Text view) - When I click on '[data-cy="component-definition_aws_subnet"]' + When I wait 1 second + And I click on '[data-cy="component-definition_aws_subnet"]' And I wait 1 second And I click on '[data-cy="component-definition_aws_internet_gateway"]' And I wait 1 second @@ -133,7 +130,8 @@ Feature: Test switch model to text view: add component/link And I expect active file content to contain 'resource.*"aws_internet_gateway".*"aws_internet_gateway_1".*{}' Scenario: Add link attributes inside plugin file content (Text view) should display link between two components (Draw view) - When I click on '[data-cy="component-definition_aws_subnet"]' + When I wait 1 second + And I click on '[data-cy="component-definition_aws_subnet"]' And I wait 1 second And I click on '[data-cy="component-definition_aws_internet_gateway"]' diff --git a/cypress/e2e/ModelizerPage/SwitchView/delete.feature b/cypress/e2e/ModelizerPage/SwitchView/delete.feature index ddcdd80bc..7bbd31f64 100644 --- a/cypress/e2e/ModelizerPage/SwitchView/delete.feature +++ b/cypress/e2e/ModelizerPage/SwitchView/delete.feature @@ -19,12 +19,9 @@ Feature: Test switch model to text view: delete component/link Then I expect current url is 'projectName/modelizer/draw\?path=terrator-plugin/modelName' And I expect '[data-cy="component-definitions-item_terrator-plugin"]' appear 1 time on screen And I expect '[data-cy="component-definitions-item_terrator-plugin"] [data-cy="title"]' is 'terrator-plugin' - - # Select 'terrator-plugin' library - When I click on '[data-cy="component-definitions-item_terrator-plugin"]' + And I expect '[data-cy="component-definitions-item_terrator-plugin"].selected' exists + And I expect '[data-cy="component-definition-grid"] [class*="component-definition-card"]' appear 18 times on screen And I wait 1 second - Then I expect '[data-cy="component-definitions-item_terrator-plugin"].selected' exists - Then I expect '[data-cy="component-definition-grid"] [class*="component-definition-card"]' appear 18 times on screen Scenario: Delete a component (Draw view) should remove plugin file (Text view) When I click on '[data-cy="component-definition_aws"]' @@ -137,6 +134,7 @@ Feature: Test switch model to text view: delete component/link When I set active file content to '[]' And I click on '[data-cy="navigation-bar"] [data-cy="modelizer-switch-button"] [aria-pressed="false"]' + And I wait 1 second Then I expect '[data-cy="navigation-bar"] [data-cy="modelizer-switch-button"] [aria-pressed="true"] [class="block"]' is 'Draw' And I expect '[data-cy="modelizer-draw-view"] [data-cy="draw-container"]' exists But I expect '[id^="aws"]' not exists From 48bb1f7342d46d3aafd214fe4d4111ea5446cd91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vincent=20Moitti=C3=A9?= Date: Mon, 24 Apr 2023 15:13:41 +0200 Subject: [PATCH 3/3] Update changelog --- changelog.md | 1 + 1 file changed, 1 insertion(+) diff --git a/changelog.md b/changelog.md index 3d68d39c3..b917d8fac 100644 --- a/changelog.md +++ b/changelog.md @@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * Integrate syntax colorization. * Modelization feature: * Allow to use the mouse coordinates when placing new component on drag and drop feature. + * The components list is now open by default. * Add new environment variable `KEEP_CYPRESS_ATTRIBUTE` to keep all cypress attribute in html. ### Changed