17
17
***********************************************************************/
18
18
19
19
import type { Page , Locator } from '@playwright/test' ;
20
- import { BasePage , ResourcesPage , expect as playExpect } from '@podman-desktop/tests-playwright' ; ;
20
+ import { BasePage , ResourcesPage , expect as playExpect } from '@podman-desktop/tests-playwright' ;
21
21
22
22
export class CreateResourcePage extends BasePage {
23
- readonly heading : Locator ;
24
- readonly content : Locator ;
25
- readonly logIntoSandboxButton : Locator ;
26
- readonly contextName : Locator ;
27
- readonly setAsCurrentContext : Locator ;
28
- readonly loginCommand : Locator ;
29
- readonly closeButton : Locator ;
30
- readonly createButton : Locator ;
23
+ readonly heading : Locator ;
24
+ readonly content : Locator ;
25
+ readonly logIntoSandboxButton : Locator ;
26
+ readonly contextName : Locator ;
27
+ readonly setAsCurrentContext : Locator ;
28
+ readonly loginCommand : Locator ;
29
+ readonly closeButton : Locator ;
30
+ readonly createButton : Locator ;
31
31
32
- constructor ( page : Page ) {
33
- super ( page ) ;
34
- this . heading = this . page . getByRole ( 'heading' , { name : 'Create Developer Sandbox' } ) ;
35
- this . content = this . page . getByRole ( 'region' , { name : 'Tab Content' } ) ;
36
- this . logIntoSandboxButton = this . page . getByRole ( 'button' , { name : 'Log into Developer Sandbox' } ) ;
37
- this . contextName = this . page . getByRole ( 'textbox' , { name : 'Context name' } ) ;
38
- this . setAsCurrentContext = this . page . getByRole ( 'checkbox' , { name : 'Set as current context' } ) ;
39
- this . loginCommand = this . page . getByRole ( 'textbox' , { name : 'Login command from Developer Console' } ) ;
40
- this . closeButton = this . page . getByRole ( 'button' , { name : 'Close page' } ) ;
41
- this . createButton = this . page . getByRole ( 'button' , { name : 'Create' } ) ;
42
- }
32
+ constructor ( page : Page ) {
33
+ super ( page ) ;
34
+ this . heading = this . page . getByRole ( 'heading' , { name : 'Create Developer Sandbox' } ) ;
35
+ this . content = this . page . getByRole ( 'region' , { name : 'Tab Content' } ) ;
36
+ this . logIntoSandboxButton = this . page . getByRole ( 'button' , { name : 'Log into Developer Sandbox' } ) ;
37
+ this . contextName = this . page . getByRole ( 'textbox' , { name : 'Context name' } ) ;
38
+ this . setAsCurrentContext = this . page . getByRole ( 'checkbox' , { name : 'Set as current context' } ) ;
39
+ this . loginCommand = this . page . getByRole ( 'textbox' , { name : 'Login command from Developer Console' } ) ;
40
+ this . closeButton = this . page . getByRole ( 'button' , { name : 'Close page' } ) ;
41
+ this . createButton = this . page . getByRole ( 'button' , { name : 'Create' } ) ;
42
+ }
43
43
44
- async createResource ( loginCommandValue : string , contextNameValue ?: string , setAsCurrentContextValue = false ) : Promise < ResourcesPage > {
45
- await this . loginCommand . fill ( loginCommandValue ) ;
44
+ async createResource (
45
+ loginCommandValue : string ,
46
+ contextNameValue ?: string ,
47
+ setAsCurrentContextValue = false ,
48
+ ) : Promise < ResourcesPage > {
49
+ await this . loginCommand . fill ( loginCommandValue ) ;
46
50
47
- if ( contextNameValue ) {
48
- await this . contextName . fill ( contextNameValue ) ;
49
- }
51
+ if ( contextNameValue ) {
52
+ await this . contextName . fill ( contextNameValue ) ;
53
+ }
50
54
51
- if ( setAsCurrentContextValue !== ( await this . setAsCurrentContext . isChecked ( ) ) ) {
52
- await this . setAsCurrentContext . locator ( '..' ) . click ( ) ;
53
- playExpect ( await this . setAsCurrentContext . isChecked ( ) ) . toBe ( setAsCurrentContextValue ) ;
54
- }
55
+ if ( setAsCurrentContextValue !== ( await this . setAsCurrentContext . isChecked ( ) ) ) {
56
+ await this . setAsCurrentContext . locator ( '..' ) . click ( ) ;
57
+ playExpect ( await this . setAsCurrentContext . isChecked ( ) ) . toBe ( setAsCurrentContextValue ) ;
58
+ }
55
59
56
- const successMessage = this . page . getByText ( 'Successful operation' ) ;
57
- const goToResourcesButton = this . page . getByRole ( 'button' , { name : 'Go back to resources' } ) ;
58
- await playExpect ( successMessage ) . toBeVisible ( ) ;
59
- await playExpect ( goToResourcesButton ) . toBeVisible ( ) ;
60
+ const successMessage = this . page . getByText ( 'Successful operation' ) ;
61
+ const goToResourcesButton = this . page . getByRole ( 'button' , { name : 'Go back to resources' } ) ;
62
+ await playExpect ( successMessage ) . toBeVisible ( ) ;
63
+ await playExpect ( goToResourcesButton ) . toBeVisible ( ) ;
60
64
61
- await goToResourcesButton . click ( ) ;
62
- return new ResourcesPage ( this . page ) ;
63
- }
64
- }
65
+ await goToResourcesButton . click ( ) ;
66
+ return new ResourcesPage ( this . page ) ;
67
+ }
68
+ }
0 commit comments