Feature: Glossary Objects
As admin
I can manage Glossary and related objects

@auth @logout
Scenario: Creation of Glossary with Sequence
	Given I create a new Sequence
		| Name         | Seed | Increment | Pattern               | RolloverType |
		| TestSequence | 1    | 1         | ID:[000000] Date:{DD} | Day          |
	When I create a CustomField
		| Name   | FieldType | DefaultValue | Sequence     | Glossary |
		| TestCF | Sequence  |              | sequenceName |          |
	And I create a Glossary
		| Name         | Add         |
		| TestGlossary | customField |
	Then I create a Glossary Item
		| Name             | CustomField                        |
		| TestGlossaryItem | customFieldNameFromScenarioContext |

@auth @deleteform @logout
Scenario: Creation of Glossary with Form
	Given I create a new Sequence
		| Name         | Seed | Increment | Pattern               | RolloverType |
		| TestSequence | 1    | 1         | ID:[000000] Date:{DD} | Day          |
	When I create a CustomField
		| Name   | FieldType | DefaultValue | Sequence     | Glossary |
		| TestCF | Sequence  |              | sequenceName |          |
	And I create a FormTemplate
		| Name     | NeedTable | TotalNumberOfColumns | TotalNumberOfRows | CustomFields                       | Text          | RowNumber | ColumnNumber |
		| TestForm | true      | 2                    | 2                 | customFieldNameFromScenarioContext |               | 1         | 2            |
		|          |           |                      |                   |                                    | Field for E2E | 1         | 1            |
	Then I check if version of FormTemplate version is correct
		| Version |
		| 1       |
	And I check Forms Audit logs
		| Timing | UserName | Comment | EntityDisplayName | Type   | DisplayName          | Changes |
		|        |          |         |                   | Create | scenarioDataInstance |         |
	When I create a CustomField
		| Name        | FieldType     | DefaultValue | Sequence | Glossary |
		| TestCF-Form | Form Template |              |          |          |
	And I create a Glossary
		| Name         | Add  |
		| TestGlossary | form |
	Then I check Glossaries Audit logs
		| Timing | UserName | Comment | EntityDisplayName | Type   | DisplayName          | Changes |
		|        |          |         |                   | Create | scenarioDataInstance |         |
	And I create a Glossary Item
		| Name             | CustomField                        |
		| TestGlossaryItem | customFieldNameFromScenarioContext |
	And I check Glossary Item Audit logs
		| Timing | UserName | Comment | EntityDisplayName | Type   | DisplayName          | Changes |
		|        |          |         |                   | Create | scenarioDataInstance |         |
	And I check Glossary Custom Field Value Audit logs
		| Timing | UserName | Comment | EntityDisplayName | Type   | DisplayName          | Changes |
		|        |          |         |                   | Create | scenarioDataInstance |         |

@auth @logout
Scenario: Editing Form and check of Audit log
	Given I create a new Sequence
		| Name          | Seed | Increment | Pattern               | RolloverType |
		| TestSequence3 | 1    | 1         | ID:[000000] Date:{DD} | Day          |
	When I create a CustomField
		| Name    | FieldType | DefaultValue | Sequence     | Glossary |
		| TestCF3 | Sequence  |              | sequenceName |          |
	And I create a FormTemplate
		| Name      | NeedTable | TotalNumberOfColumns | TotalNumberOfRows | CustomFields                       | Text          | Version | RowNumber | ColumnNumber |
		| TestForm3 | true      | 2                    | 2                 | customFieldNameFromScenarioContext |               | 1       | 1         | 2            |
		|           |           |                      |                   |                                    | Field for E2E | 1       | 1         | 1            |
	And I edit a FormTemplate
		| Name | NeedTable | TotalNumberOfColumns | TotalNumberOfRows | CustomFields | Text                | Version | RowNumber | ColumnNumber |
		|      |           | 2                    |                   |              | - Edited text here! | 2       | 1         | 1            |
	Then I check if version of FormTemplate was changed
		| Version |
		| 2       |
	And I check Forms Audit logs
		| Timing | UserName | Comment | EntityDisplayName | Type   | DisplayName          | Changes |
		|        |          |         |                   | Update | scenarioDataInstance |         |
	When I delete existing Form Template
	Then I check Form Template Audit logs
		| Timing | UserName | Comment | EntityDisplayName | Type   | DisplayName          | Changes |
		|        |          |         |                   | Delete | scenarioDataInstance |         |