Feature: Domain creation
As admin
I can create and edit domain

@auth @createssoprovider @deletessoprovider @deletedomain @logout
Scenario Outline: Creating new domain and changing Mail Template 'Confirm Email Address'
	Given I create a new domain
		| Name         | SSOProvider   |
		| <DomainName> | <SSOProvider> |
	When I edit created domain
	Then I change Mail Template
		| TemplateName          | Subject                 | Definition   |
		| Confirm Email Address | E2E e-mail confirmation | Confirmation |
	When I edit created domain
	And I check Mail Template changes
Examples:
	| DomainName | SSOProvider |
	| TestDomain | Google SSO  |
	| TestDomain |             |
	
@auth @createssoprovider @deletessoprovider @deletedomain @logout
Scenario Outline: Creating new domain and changing Mail Template 'Password reset'
	Given I create a new domain
		| Name         | SSOProvider   |
		| <DomainName> | <SSOProvider> |
	When I edit created domain
	Then I change Mail Template
		| TemplateName   | Subject                   | Definition     |
		| Password Reset | E2E e-mail Password reset | Password reset |
	When I edit created domain
	And I check Mail Template changes
Examples:
	| DomainName | SSOProvider |
	| TestDomain | Google SSO  |
	| TestDomain |             |
	
@auth @createssoprovider @deletessoprovider @deletedomain @logout
Scenario Outline: Creating new domain and Security Role with custom permissions and User
	Given I create a new domain
		| Name         | SSOProvider   |
		| <DomainName> | <SSOProvider> |
	When I edit created domain
	Then I add a new Security Role
		| RoleName |
		| QA Admin |
	And I check new Security Role created
	When I click on newly created Security Role
	Then I choose Role Access permission options
		| Allowed | Name      | Group | Description |
		|         | Add User  |       |             |
		|         | Edit User |       |             |
	When I enter into Users tab
	Then I add User to Security Role
		| UserName   |
		| Test1 User |
	And I check new Security Role created
	When I click on newly created Security Role
	And I enter into Users tab
	Then I check if user is added to Security Role
Examples:
	| DomainName | SSOProvider |
	| TestDomain | Google SSO  |
	| TestDomain |             |

@auth @createssoprovider @createdomain @deletessoprovider @logout
Scenario: Creating new domain via api update and delete audit log
	Then I check Client Domains Audit logs
		| Timing | UserName | Comment | EntityDisplayName    | Type   | DisplayName          | Changes |
		|        |          |         | scenarioDataInstance | Create | scenarioDataInstance |         |
	When I edit created domain
	And I edit domains details
		| Name               | SSOProvider |
		| EditTestDomainName | SSOProvider |
	Then I check Client Domains Audit logs
		| Timing | UserName | Comment | EntityDisplayName    | Type   | DisplayName          | Changes |
		|        |          |         | scenarioDataInstance | Update | scenarioDataInstance |         |
	When I delete existing Domain
	Then I check Client Domains Audit logs
		| Timing | UserName | Comment | EntityDisplayName    | Type   | DisplayName          | Changes |
		|        |          |         | scenarioDataInstance | Delete | scenarioDataInstance |         |