Skip to content

Commit

Permalink
feat: improve form example (#341)
Browse files Browse the repository at this point in the history
* refactor: rename form example folder to nested

* refactor: replace example with car rental company

* test: update e2e for nested form
  • Loading branch information
ingeridhellen committed Jul 6, 2023
1 parent 2876881 commit 9b37cbb
Show file tree
Hide file tree
Showing 14 changed files with 174 additions and 243 deletions.
21 changes: 21 additions & 0 deletions e2e/tests/plugin-form-Nested.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { expect, test } from '@playwright/test'

test('Nested Form', async ({ page }) => {
//Open form
await page.goto('http://localhost:3000/')
await page.getByText('plugins', { exact: true }).click()
await page.getByText('form').click()
await page.getByText('nested', { exact: true }).click()
await page.getByText('DemoDataSource/$Nested').click()

//A nested object
await expect(page.getByText('Owner', { exact: true })).toBeVisible
await page.getByRole('button', { name: 'Open' }).first().click()
await page.getByLabel('Name').fill('Jacob')
await page.getByLabel('Phone Number (optional)').fill('1234')
await page.getByRole('button', { name: 'Submit' }).click()
await page.getByText('self').first().click()
await page.getByRole('button', { name: 'Open' }).first().click()
await expect(page.getByLabel('Name')).toHaveValue('Jacob')
await expect(page.getByLabel('Phone Number (optional)')).toHaveValue('1234')
})
30 changes: 0 additions & 30 deletions e2e/tests/plugin-form-NestedExample.spec.ts

This file was deleted.

38 changes: 0 additions & 38 deletions e2e/tests/plugin-form-formExample.spec.ts

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "Car",
"type": "CORE:Blueprint",
"extends": ["CORE:NamedEntity"],
"attributes": [
{
"name": "plateNumber",
"type": "CORE:BlueprintAttribute",
"attributeType": "number",
"label": "Plate Number",
"optional": false
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"name": "CarRentalCompany",
"type": "CORE:Blueprint",
"attributes": [
{
"name": "type",
"type": "CORE:BlueprintAttribute",
"attributeType": "string",
"optional": false
},
{
"name": "owner",
"type": "CORE:BlueprintAttribute",
"attributeType": "./Person",
"label": "Owner"
},
{
"name": "ceo",
"type": "CORE:BlueprintAttribute",
"attributeType": "./Person",
"label": "CEO",
"optional": true
},
{
"name": "accountant",
"type": "CORE:BlueprintAttribute",
"attributeType": "./Person",
"label": "Accountant"
},
{
"name": "bestCustomer",
"type": "CORE:BlueprintAttribute",
"attributeType": "./Person",
"contained": false,
"optional": true
},
{
"name": "cars",
"type": "CORE:BlueprintAttribute",
"attributeType": "./Car",
"dimensions": "*",
"label": "Cars"
},
{
"name": "customers",
"type": "CORE:BlueprintAttribute",
"attributeType": "./Customer",
"dimensions": "*",
"label": "Customers"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "Customer",
"type": "CORE:Blueprint",
"extends": ["./Person"],
"attributes": [
{
"name": "car",
"type": "CORE:BlueprintAttribute",
"attributeType": "./Car",
"label": "Rented Car",
"contained": false,
"optional": true
}
]
}
Original file line number Diff line number Diff line change
@@ -1,31 +1,25 @@
{
"name": "NestedExample",
"name": "Person",
"type": "CORE:Blueprint",
"attributes": [
{
"attributeType": "string",
"type": "dmss://system/SIMOS/BlueprintAttribute",
"name": "type"
},
{
"name": "foo",
"name": "type",
"type": "CORE:BlueprintAttribute",
"attributeType": "number",
"label": "Foo",
"optional": true
"attributeType": "string",
"optional": false
},
{
"name": "bar",
"name": "name",
"type": "CORE:BlueprintAttribute",
"attributeType": "string",
"label": "Bar",
"label": "Name",
"optional": false
},
{
"name": "baz",
"name": "phoneNumber",
"type": "CORE:BlueprintAttribute",
"attributeType": "string",
"label": "Baz",
"attributeType": "number",
"label": "Phone Number",
"optional": true
}
]
Expand Down
Loading

0 comments on commit 9b37cbb

Please sign in to comment.