1
1
/**********************************************************************
2
- * Copyright (C) 2023 Red Hat, Inc.
2
+ * Copyright (C) 2024 Red Hat, Inc.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
@@ -25,9 +25,7 @@ import { ResourcesPage } from './resources-page';
25
25
export class CreateMachinePage extends BasePage {
26
26
readonly heading : Locator ;
27
27
readonly machineNameBox : Locator ;
28
- readonly cpuSlider : Locator ;
29
- readonly memorySlider : Locator ;
30
- readonly diskSlider : Locator ;
28
+ readonly podmanMachineConfiguration : Locator ;
31
29
readonly imagePathBox : Locator ;
32
30
readonly browseImagesButton : Locator ;
33
31
readonly rootPriviledgesCheckbox : Locator ;
@@ -39,35 +37,39 @@ export class CreateMachinePage extends BasePage {
39
37
constructor ( page : Page ) {
40
38
super ( page ) ;
41
39
this . heading = this . page . getByRole ( 'heading' , { name : 'Create Podman Machine' } ) ;
42
- this . machineNameBox = this . page . getByRole ( 'textbox' , { name : 'Name' } ) ;
43
- this . cpuSlider = this . page . getByRole ( 'slider' , { name : 'CPU(s)' } ) ;
44
- this . memorySlider = this . page . getByRole ( 'slider' , { name : 'Memory' } ) ;
45
- this . diskSlider = this . page . getByRole ( 'slider' , { name : 'Disk size' } ) ;
40
+ this . podmanMachineConfiguration = this . page . getByRole ( 'form' , { name : 'Properties Information' } ) ;
41
+
42
+ this . machineNameBox = this . podmanMachineConfiguration . getByRole ( 'textbox' , { name : 'Name' } ) ;
46
43
this . imagePathBox = this . page . getByRole ( 'textbox' , { name : 'Image Path (Optional) ' } ) ;
47
44
this . browseImagesButton = this . page . getByRole ( 'button' , { name : 'button-Image Path (Optional)' } ) ;
48
- this . rootPriviledgesCheckbox = this . page . getByRole ( 'checkbox' , { name : 'Machine with root priviledges' } ) ;
45
+ this . rootPriviledgesCheckbox = this . podmanMachineConfiguration
46
+ . getByRole ( 'checkbox' , { name : 'Machine with root privileges' } )
47
+ . locator ( '..' ) ;
49
48
this . userModeNetworkingCheckbox = this . page . getByRole ( 'checkbox' , {
50
49
name : 'User mode networking (traffic relayed by a user process). See [documentation](https://docs.podman.io/en/latest/markdown/podman-machine-init.1.html#user-mode-networking).' ,
51
50
} ) ;
52
51
this . startNowCheckbox = this . page . getByRole ( 'checkbox' , { name : 'Start the machine now' } ) ;
53
- this . closeButton = this . page . getByRole ( 'button' , { name : 'Close page ' } ) ;
54
- this . createMachineButton = this . page . getByRole ( 'button' , { name : 'Create Pod ' } ) ;
52
+ this . closeButton = this . page . getByRole ( 'button' , { name : 'Close' } ) ;
53
+ this . createMachineButton = this . page . getByRole ( 'button' , { name : 'Create' } ) ;
55
54
}
56
55
57
56
async createMachine ( machineName : string , isRootless : boolean ) : Promise < ResourcesPage > {
58
- //can be extended
57
+ await playExpect ( this . podmanMachineConfiguration ) . toBeVisible ( ) ;
59
58
await this . machineNameBox . fill ( machineName ) ;
59
+
60
60
if ( ! isRootless ) {
61
- await this . rootPriviledgesCheckbox . uncheck ( ) ;
62
- playExpect ( this . rootPriviledgesCheckbox . isChecked ( ) ) . toBeFalsy ( ) ;
61
+ await playExpect ( this . rootPriviledgesCheckbox ) . toBeVisible ( ) ;
62
+ const upperElement = this . rootPriviledgesCheckbox . locator ( '..' ) ;
63
+ const clickableCheckbox = upperElement . getByText ( 'Enable' ) ;
64
+ await clickableCheckbox . click ( ) ;
63
65
}
64
66
65
67
await this . createMachineButton . click ( ) ;
66
68
67
- const successfulCreationMessage = this . page . getByLabel ( 'Successful operation' ) ;
69
+ const successfulCreationMessage = this . page . getByText ( 'Successful operation' ) ;
68
70
const goBackToResourcesButton = this . page . getByRole ( 'button' , { name : 'Go back to resources' } ) ;
69
71
70
- await playExpect ( successfulCreationMessage ) . toBeVisible ( { timeout : 50000 } ) ;
72
+ await playExpect ( successfulCreationMessage ) . toBeVisible ( { timeout : 100000 } ) ;
71
73
await playExpect ( goBackToResourcesButton ) . toBeVisible ( ) ;
72
74
await goBackToResourcesButton . click ( ) ;
73
75
0 commit comments