-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2310 from gouyang/update_selector
update selectors for e2e tests
- Loading branch information
Showing
3 changed files
with
151 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,118 +1,140 @@ | ||
export enum vmTabs { | ||
Configuration = 'horizontal-link-Configuration', | ||
Console = 'horizontal-link-Console', | ||
Diagnostics = 'horizontal-link-Diagnostics', | ||
Disks = 'horizontal-link-Disks', | ||
Environment = 'horizontal-link-Environment', | ||
Events = 'horizontal-link-Events', | ||
Metadata = 'horizontal-link-Metadata', | ||
Metrics = 'horizontal-link-Metrics', | ||
NetworkInterfaces = 'horizontal-link-Network interfaces', | ||
Overview = 'horizontal-link-Overview', | ||
Parameters = 'horizontal-link-Parameters', | ||
Scheduling = 'horizontal-link-Scheduling', | ||
Scripts = 'horizontal-link-Scripts', | ||
Snapshots = 'horizontal-link-Snapshots', | ||
YAML = 'horizontal-link-YAML', | ||
export const configurationSubTab = (tabName: string) => | ||
`[data-test-id="vm-configuration-${tabName}"]`; | ||
export const diagnosticsSubTab = (tabName: string) => `[data-test-id="vm-diagnostics-${tabName}"]`; | ||
export const horizontalLink = (tabName: string) => `[data-test-id="horizontal-link-${tabName}"]`; | ||
|
||
export enum tabName { | ||
Configuration = 'Configuration', | ||
Console = 'Console', | ||
Diagnostics = 'Diagnostics', | ||
Disks = 'Disks', | ||
Environment = 'Environment', | ||
Events = 'Events', | ||
Metadata = 'Metadata', | ||
Metrics = 'Metrics', | ||
Migrations = 'Migrations', | ||
NetworkInterfaces = 'Network interfaces', | ||
Overview = 'Overview', | ||
Parameters = 'Parameters', | ||
Scheduling = 'Scheduling', | ||
Scripts = 'Scripts', | ||
Settings = 'Settings', | ||
Snapshots = 'Snapshots', | ||
TopConsumers = 'Top consumers', | ||
YAML = 'YAML', | ||
} | ||
|
||
export enum overviewTabs { | ||
Migrations = 'horizontal-link-Migrations', | ||
Settings = 'horizontal-link-Settings', | ||
// virt overview tabs | ||
TopConsumers = 'horizontal-link-Top consumers', | ||
export enum subTabName { | ||
Details = 'details', | ||
GuestSystemLog = 'guest-system-log', | ||
InitialRun = 'initial', | ||
Metadata = 'metadata', | ||
Network = 'network', | ||
Scheduling = 'scheduling', | ||
SSH = 'ssh', | ||
StatusConditions = 'status-conditions', | ||
Storage = 'storage', | ||
} | ||
|
||
export const navigateToTab = (tab: string) => { | ||
cy.byLegacyTestID(tab).should('be.visible'); | ||
cy.byLegacyTestID(tab).click(); | ||
export const navigateToTab = (name: string) => { | ||
cy.get(horizontalLink(name)).should('be.visible'); | ||
cy.get(horizontalLink(name)).click(); | ||
}; | ||
|
||
export const navigateToConfigurationSubTab = (name: string) => { | ||
navigateToTab(tabName.Configuration); | ||
cy.get(configurationSubTab(name)).should('be.visible'); | ||
cy.get(configurationSubTab(name)).click(); | ||
}; | ||
|
||
export const navigateToDiagnosticsSubTab = (name: string) => { | ||
navigateToTab(tabName.Diagnostics); | ||
cy.get(diagnosticsSubTab(name)).should('be.visible'); | ||
cy.get(diagnosticsSubTab(name)).click(); | ||
}; | ||
|
||
export const tab = { | ||
navigateToConfiguration: () => { | ||
navigateToTab(vmTabs.Configuration); | ||
}, | ||
navigateToConsole: () => { | ||
navigateToTab(vmTabs.Console); | ||
navigateToTab(tabName.Configuration); | ||
}, | ||
// VM configuration sub-tabs | ||
navigateToDetails: () => { | ||
navigateToTab(vmTabs.Configuration); | ||
cy.byButtonText('Details').click(); | ||
navigateToConfigurationDetails: () => { | ||
navigateToConfigurationSubTab(subTabName.Details); | ||
}, | ||
navigateToDiagnostics: () => { | ||
navigateToTab(vmTabs.Diagnostics); | ||
navigateToConfigurationInitialRun: () => { | ||
navigateToConfigurationSubTab(subTabName.InitialRun); | ||
}, | ||
navigateToEvents: () => { | ||
navigateToTab(vmTabs.Events); | ||
navigateToConfigurationMetadata: () => { | ||
navigateToConfigurationSubTab(subTabName.Metadata); | ||
}, | ||
navigateToInitialRun: () => { | ||
navigateToTab(vmTabs.Configuration); | ||
cy.byButtonText('Initial run').click(); | ||
navigateToConfigurationNetwork: () => { | ||
navigateToConfigurationSubTab(subTabName.Network); | ||
}, | ||
navigateToMetadata: () => { | ||
navigateToTab(vmTabs.Configuration); | ||
cy.byButtonText('Metadata').click(); | ||
navigateToConfigurationScheduling: () => { | ||
navigateToConfigurationSubTab(subTabName.Scheduling); | ||
}, | ||
navigateToMetrics: () => { | ||
navigateToTab(vmTabs.Metrics); | ||
navigateToConfigurationSSH: () => { | ||
navigateToConfigurationSubTab(subTabName.SSH); | ||
}, | ||
navigateToMigrations: () => { | ||
navigateToTab(overviewTabs.Migrations); | ||
navigateToConfigurationStorage: () => { | ||
navigateToConfigurationSubTab(subTabName.Storage); | ||
}, | ||
navigateToNetwork: () => { | ||
navigateToTab(vmTabs.Configuration); | ||
cy.contains('.pf-v5-c-tabs__item-text', 'Network').click(); | ||
navigateToConsole: () => { | ||
navigateToTab(tabName.Console); | ||
}, | ||
// VM tabs | ||
navigateToOverview: () => { | ||
navigateToTab(vmTabs.Overview); | ||
navigateToDiagnostics: () => { | ||
navigateToTab(tabName.Diagnostics); | ||
}, | ||
navigateToScheduling: () => { | ||
navigateToTab(vmTabs.Configuration); | ||
cy.byButtonText('Scheduling').click(); | ||
// VM diagnostics sub-tabs | ||
navigateToDiagnosticsGuestSystemLog: () => { | ||
navigateToDiagnosticsSubTab(subTabName.GuestSystemLog); | ||
}, | ||
navigateToSettings: () => { | ||
navigateToTab(overviewTabs.Settings); | ||
navigateToDiagnosticsStatusConditions: () => { | ||
navigateToDiagnosticsSubTab(subTabName.StatusConditions); | ||
}, | ||
navigateToSnapshots: () => { | ||
navigateToTab(vmTabs.Snapshots); | ||
navigateToDisks: () => { | ||
navigateToTab(tabName.Disks); | ||
}, | ||
navigateToSSH: () => { | ||
navigateToTab(vmTabs.Configuration); | ||
cy.byButtonText('SSH').click(); | ||
navigateToEnvironment: () => { | ||
navigateToTab(tabName.Environment); | ||
}, | ||
navigateToStorage: () => { | ||
navigateToTab(vmTabs.Configuration); | ||
cy.contains('.pf-v5-c-tabs__item-text', 'Storage').click(); | ||
navigateToEvents: () => { | ||
navigateToTab(tabName.Events); | ||
}, | ||
// template's tabs and vm creation tabs | ||
navigateToTDisks: () => { | ||
navigateToTab(vmTabs.Disks); | ||
navigateToMetadata: () => { | ||
navigateToTab(tabName.Metadata); | ||
}, | ||
navigateToTEnvironment: () => { | ||
navigateToTab(vmTabs.Environment); | ||
navigateToMetrics: () => { | ||
navigateToTab(tabName.Metrics); | ||
}, | ||
navigateToTMetadata: () => { | ||
navigateToTab(vmTabs.Metadata); | ||
navigateToMigrations: () => { | ||
navigateToTab(tabName.Migrations); | ||
}, | ||
navigateToTNetworks: () => { | ||
navigateToTab(vmTabs.NetworkInterfaces); | ||
navigateToNetworks: () => { | ||
navigateToTab(tabName.NetworkInterfaces); | ||
}, | ||
// virt overview tabs | ||
navigateToTopConsumers: () => { | ||
navigateToTab(overviewTabs.TopConsumers); | ||
navigateToOverview: () => { | ||
navigateToTab(tabName.Overview); | ||
}, | ||
navigateToTParameters: () => { | ||
navigateToTab(vmTabs.Parameters); | ||
navigateToParameters: () => { | ||
navigateToTab(tabName.Parameters); | ||
}, | ||
navigateToTScheduling: () => { | ||
navigateToTab(vmTabs.Scheduling); | ||
navigateToScheduling: () => { | ||
navigateToTab(tabName.Scheduling); | ||
}, | ||
navigateToScripts: () => { | ||
navigateToTab(tabName.Scripts); | ||
}, | ||
navigateToSettings: () => { | ||
navigateToTab(tabName.Settings); | ||
}, | ||
navigateToTScripts: () => { | ||
navigateToTab(vmTabs.Scripts); | ||
navigateToSnapshots: () => { | ||
navigateToTab(tabName.Snapshots); | ||
}, | ||
navigateToTopConsumers: () => { | ||
navigateToTab(tabName.TopConsumers); | ||
}, | ||
navigateToYAML: () => { | ||
navigateToTab(vmTabs.YAML); | ||
navigateToTab(tabName.YAML); | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters