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

feat: manual tests for annotation related lsp #541

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/warm-boxes-shave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@ui5-language-assistant/vscode-ui5-language-assistant-bas-ext": patch
"vscode-ui5-language-assistant": patch
---

Manual test cases for annotation related LSP features
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Visual Studio Code - FPM: macros elements metaPath completion and diagnostics (annotation path)

Associated user stories:

[#505](https://github.com/SAP/ui5-language-assistant/issues/505) Provide code completion and diagnostics for contentPath and metaPath values

## **Setup**: Clone test project

In case you haven't done it yet:

1. Clone the CAP test project located [here](./project/flight/cap).
2. Install project dependencies using command `npm install`.
3. Launch VSCode and open project root folder

### **Step 1**: Code completion for metaPath

1. Open annotations file `app\manage_travels\annotations.cds` and append following snippet to the end of file and save it:

```cpp
annotate service.Travel with @(
UI.Chart #sample1: {
type: '',
},
UI.LineItem: []
);
```

2. Open custom view template file `app\manage_travels\webapp\Main.view.xml`. Wait a short while until UI5 Language assistant server gets ready.
3. Find element `<f:content>` in the file and place the following snippet as its child element :

```XML
<macros:Chart metaPath="" id="chart1" />
```

4. Place the cursor at the position of the value of `metaPath` attribute and trigger code completion.
5. Observe the list of suggestions for the first path segment. Make sure the chart annotation term with qualifier `sample1` is listed first, then follow possible navigation segments. Choose annotation term name and press `Enter`. Observe no error messages are shown for the attribute value.
6. Place cursor at value's first position and trigger code completion. Choose option `to_Booking` and press `/` to confirm. Observe the segment is added, and completion for next segment is triggered. Choose navigation property `to_Travel` and press `/` to confirm. Observe only term is suggested as final path segment and further navigation segment `to_Booking` is not available to avoid cyclic routes. Press `Enter` to insert the term into the document. Observe no error messages are shown for the attribute value.
7. Remove entire current element and place following snippet instead:

```XML
<macros:Chart contextPath="/Travel" metaPath="" id="chart1" />
```

8. Place the cursor at the `metaPath` value and trigger code completion. Observe only term and no other navigation segments are suggested. Press `Enter` to insert the term into the document. Observe no error messages are shown for the attribute value.

### **Step 2**: Validation of metaPath attribute

1. Remove `contextPath` attribute and its value from the current `macros:Chart` element and clear `metaPath` value.
2. Observe diagnostics warning: `Annotation path value cannot be empty`.
3. Set the metaPath attribute value as `@com.sap.vocabularies.UI.v1.Chart#sample`. Observe warning message `Unknown annotation path: "/Travel/@com.sap.vocabularies.UI.v1.Chart#sample"`.
4. Set the metaPath attribute value as `to_Booking`. Observe warning message `Path value must end with annotation term. Use code completion to select annotation path`.
5. Set the metaPath attribute value as `/Travel/@com.sap.vocabularies.UI.v1.Chart#sample1`. Observe warning message `Absolute annotation paths not allowed in metaPath. Use contextPath attribute to change path context`
6. Set the metaPath attribute value as `@com.sap.vocabularies.UI.v1.LineItem`. Observe warning message `Invalid annotation term: "@com.sap.vocabularies.UI.v1.LineItem". Trigger code completion to choose one of allowed annotations`.
7. Go to app manifest file, find `routing\targets\TravelMain` settings entry and rename `entitySet` property in the nested object structure to `entitySet_`. Save the file.
8. Set the metaPath attribute value as `@com.sap.vocabularies.UI.v1.Chart#sample1`. Observe info message `EntitySet for the current view is missing in application manifest. Attribute value completion and diagnostics are disabled`.
9. Revert manifest change that is done at previous step 7. Change property `entitySet` value to `Travel_`. Save the file.
10. Set the metaPath attribute value as `@com.sap.vocabularies.UI.v1.Chart#sample`. Observe info message `Entity Set "Travel_" specified in manifest for the current view is not found. Attribute value completion and diagnostics are disabled`.
11. Reset property `entitySet` value to `Travel` in app manifest. Save the file.
12. Replace current macros element with the snippet:

```XML
<macros:Chart contextPath="/TravelService.EntityContainer/Travel" metaPath="" id="chart1" />
```

13. Set the metaPath attribute value as `@com.sap.vocabularies.UI.v1.Chart#sample`. Observe warning message `Unknown annotation path: "/TravelService.EntityContainer/Travel/@com.sap.vocabularies.UI.v1.Chart#sample`.
14. Set the metaPath attribute value as `to_Booking/@com.sap.vocabularies.UI.v1.Chart#sample`. Observe warning message `Navigation segments not allowed when contextPath is provided`.
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Visual Studio Code - FPM: macros elements contextPath completion and diagnostics

Associated user stories:
[#505](https://github.com/SAP/ui5-language-assistant/issues/505) Provide code completion and diagnostics for contentPath and metaPath values

## **Setup**: Clone test project

In case you haven't done it yet:

1. Clone the CAP test project located [here](./project/flight/cap).
2. Install project dependencies using command `npm install`.
3. Launch VSCode and open project root folder

### **Step 1**: Code completion for contextPath

1. Open annotations file `app\manage_travels\annotations.cds` and append following snippet to the end of file and save it:

```c++
annotate service.Travel with @(
UI.Chart #sample1: {
type: '',
}
);
```

2. Open custom view template file `app\manage_travels\webapp\Main.view.xml`. Wait a short while until UI5 Language assistant server gets ready.
3. Find element `<f:content>` in the file and place the following snippet as its child element :

```XML
<macros:Chart contextPath="" id="chart1" />
```

4. Place the cursor at the position of the value of `contextPath` attribute and trigger code completion.
5. Observe the list of suggestions for the first absolute path segment (i.e. with all items having leading `­/` symbol). Check that all entity types with short names are listed first, then follow entity set names with container name as prefix, and the last item in the list is entity container itself.
6. Press `Esc`, then enter value `/` and trigger code completion again.
7. Observe the same list of options, but without leading slashes `/` in their names.
8. Choose option `Travel` and press Enter. Observe no diagnostics warnings are shown for the attribute.
9. Press `/` and observe suggestion list is shown for next path segment. The list should contain all available navigation segments.
10. Choose option `to_Booking` and press `/` to confirm. Observe the segment is added, and completion for next segment is triggered. Observe navigation property `to_Travel` is not included in the list to avoid cyclic routes.
11. Change current element name from `macros:Chart` to `macros:Table`. Observe info message is shown for the attribute value `Context path for Table is usually defined if binding for the object is different than that of the page`.
12. Place the cursor at the first position of the `contextPath` attribute value and trigger code completion. Observe no suggestions shown, because completion is suppressed where use of contextPath is not recommended.

### **Step 2**: Validation of contextPath attribute

1. Change current element name from `macros:Table` back to `macros:Chart`.
2. Set the contextPath attribute value as empty string. Hover the `contextPath` attribute value and observe diagnostics warning: `contextPath value cannot be empty. Enter value or remove contextPath property`.
3. Set the contextPath attribute value as `to_Booking`. Observe warning message `Invalid contextPath value: "to_Booking". Absolute path is expected`.
4. Set the contextPath attribute value as `/Travel/to_Booking1`. Observe warning message `Unknown context path: "/Travel/to_Booking1"` is shown for last path segment.
5. Set the contextPath attribute value as `/Travel/TravelID`. Observe warning message `Invalid contextPath value. It leads to entity property, but expected types are: Edm.EntitySet, Edm.EntityType, Edm.Singleton, Edm.NavigationProperty`.
6. Set the contextPath attribute value as `/Airport`. Observe warning message `Invalid contextPath value. It does not lead to any annotations of the expected type`.
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Visual Studio Code - FPM: macros:Table element's filterBar attribute value completion and diagnostics

Associated user stories:

[#505](https://github.com/SAP/ui5-language-assistant/issues/505) Provide code completion and diagnostics for contentPath and metaPath values

## **Setup**: Clone test project

In case you haven't done it yet:

1. Clone the CAP test project located [here](./project/flight/cap).
2. Install project dependencies using command `npm install`.
3. Launch VSCode and open project root folder

### **Step 1**: Code completion for filterBar attribute

1. Open custom view template file `app\manage_travels\webapp\Main.view.xml`. Wait a short while until UI5 Language assistant server gets ready.
2. Find element `<f:header>` in the file. Make sure there is nested `macros:FilterBar` element. Set its `id` attribute value to `FilterBar1`. If element doesn't exist, then create the following `f:header` content:

```XML
<f:header>
<f:DynamicPageHeader id="_IDGenDynamicPageHeader1" pinnable="true">
<VBox id="_IDGenVBox1">
<macros:FilterBar id="FilterBar1" />
</VBox>
</f:DynamicPageHeader>
</f:header>
```

3. Find element `<f:content>` in the file and place the following snippet as its child element:

```XML
<macros:Table filterBar="" />
```

4. Place the cursor at the position of the `filterBar` attribute value and trigger code completion.
5. Observe `FilterBar1` is offered. Choose it and press `Enter`. Observe no error messages are shown for the attribute value.

### **Step 2**: Validation of filterBar attribute

1. Clear `filterBar` attribute value. Observe diagnostics warning: `Trigger code completion to choose one of existing FilterBar ids`.
2. Set the filterBar attribute value as `test`. Observe warning message `FilterBar with id "test" does not exist. Trigger code completion to choose one of existing FilterBar ids`.
3. In the element `macros:FilterBar` rename the attribute `id` to `id_`.
4. Observe new warning message is displayed for `macros:Table filterBar` attribute: `FilterBar with id "test" does not exist`.
5. Clear `filterBar` attribute value. Observe no diagnostics warnings for `macros:Table filterBar`.
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# CAP sflight
_out
*.db
connection.properties
default-*.json
schema.sql
gen/
node_modules/
target/
.reloadtrigger

# Web IDE, App Studio
.che/
.gen/

# MTA
*_mta_build_tmp
*.mtar
mta_archives/
/Makefile_*.mta

# Other
.DS_Store
.npmrc
*.orig
*.log

srv/src/main/resources/edmx/**
dist/
/app/resources/
/app/router/package-lock.json


# IDEs
.idea
*.iml
.project
.settings
.classpath
# .vscode/*
# IMPORTANT: Do not exclude .vscode please!

# Local dev
.env
.values.yaml
.cdsrc-private.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# This is the resource bundle for travel_processor

Travel=Travel
Travels=Travels
TravelUUID=Travel UUID
TravelID=Travel
AgencyID=Agency
AgencyName=Agency Name
TravelAgency=Travel Agency
BeginDate=Starting Date
EndDate=End Date
Dates=Dates
TotalPrice=Total Price
TravelStatus=Travel Status
CustomerID=Customer
CustomerName=Customer Name
BookingFee=Booking Fee
Description=Description
Price=Price
Prices=Prices
ProductPrice=Product Price
ProductID=Product
OverallStatus=Overall Status
GoGreen=Trees-4-Tickets
GreenFee=Green Flight Fee
Sustainability=Sustainability

Booking=Booking
Bookings=Bookings
BookingDate=Booking Date
BookingID=Booking
BookingNumber=Booking Number
FlightPrice=Flight Price
ConnectionID=Flight Number
FlightDate=Flight Date
FlightNumber=Flight Number
FlightPrice=Flight Price
BookingStatus=Booking Status
Airline=Airline
AirlineID=Airline
Name=Name
AirlineNumber=Airline Number
Status=Status

BookingSupplement=Booking Supplement
BookingSupplements=Booking Supplements
BookingSupplementID=Booking. Supp. Number
SupplementDescription=Supplement Description
SupplementID=Supplement
Supplement=Supplement
SupplementType=Supplement Type

Passenger=Passenger
LastName=Last Name
PlaneType=Plane Type
MaximumSeats=Maximum Seats
OccupiedSeats=Occupied Seats

FirstName=First name
LastName=Last name
Title=Title
Street=Street
PostalCode=Postal Code
City=City
CountryCode=Country Code
CurrencyCode=Currency Code
PhoneNumber=Phone Number
EMailAddress=EMail Address
WebAddress=Web Address

Flight=Flight

CopyTravel=Copy Travel
AcceptTravel=Accept Travel
RejectTravel=Reject Travel
DeductDiscount=Deduct Discount

#XFLD,120: Label for a column title
CustomerVipStatus=Customer VIP Status
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# This is the resource bundle for travel_processor

Travel=Reise
Travels=Reisen
TravelUUID=Reise-UUID
TravelID=Reisenummer
AgencyID=Agency-ID
AgencyName=Agenturname
TravelAgency=Veranstalter
BeginDate=Startdatum
EndDate=Enddatum
Dates=Termine
TotalPrice=Gesamtpreis
TravelStatus=Reisestatus
CustomerID=Kundennummer
CustomerName=Name des Kunden
BookingFee=Reservierungsgebühr
Description=Beschreibung
Price=Preis
Prices=Preise
ProductPrice=Produktpreis
ProductID=Produktnummer
OverallStatus=Gesamtstatus

Booking=Buchung
Bookings=Buchungen
BookingDate=Buchungsdatum
BookingID=Buchungs-ID
BookingNumber=Buchungsnummer
FlightPrice=Flugpreis
ConnectionID=Flugnummer
FlightDate=Flugdatum
FlightNumber=Flugnummer
BookingStatus=Buchungsstatus
Airline=Fluggesellschaft
AirlineID=Fluggesellschafts-ID
Name=Name
AirlineNumber=Fluggesellschaftsnummer
Status=Status

BookingSupplement=Buchungszusatz
BookingSupplements=Buchungszusätze
BookingSupplementID=Buchungszusatznummer
SupplementDescription=Zusatzbeschreibung
SupplementID=Zusatz-ID
Supplement=Zusatz
SupplementType=Zusatzart

Passenger=Passagier
LastName=Nachname
PlaneType=Flugzeugtyp
MaximumSeats=Maximale Sitzplätze
OccupiedSeats=Belegte Plätze

FirstName=Vorname
LastName=Nachname
Title=Titel
Street=Straße
PostalCode=Postleitzahl
City=Ort
CountryCode=Ländercode
CurrencyCode=Währungscode
PhoneNumber=Telefonnummer
EMailAddress=E-Mail-Addresse
WebAddress=Web-Adresse

Flight=Flug

CopyTravel=Reise kopieren
AcceptTravel=Reise akzeptieren
RejectTravel=Reise ablehnen
DeductDiscount=Rabatt abziehen
Loading