mirror of https://github.com/rancher/dashboard.git
E2E - Add cypress grepTags for workloads. (#9364)
* Add cypress grepTags for workloads. * Add missing grepTag and fix ActionMenu button click.
This commit is contained in:
parent
6b4a327da0
commit
e6bce5acf8
|
|
@ -15,6 +15,10 @@ export default class LabeledSelectPo extends ComponentPo {
|
|||
});
|
||||
}
|
||||
|
||||
clickLabel(label: string) {
|
||||
return this.getOptions().contains('li', label).click();
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks selected option displays on dropdown
|
||||
* @param label
|
||||
|
|
|
|||
|
|
@ -4,4 +4,13 @@ export default class ListRowPo extends ComponentPo {
|
|||
column(index: number) {
|
||||
return this.self().find('td').eq(index);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the action button for a row
|
||||
* NB: Depending on the view flat-list or namespaced view,
|
||||
* the action button could be in a different column
|
||||
*/
|
||||
actionBtn() {
|
||||
return this.self().find('.btn.actions');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -136,9 +136,8 @@ export default class SortableTablePo extends ComponentPo {
|
|||
/**
|
||||
* For a row with the given name open it's action menu and return the drop down
|
||||
*/
|
||||
rowActionMenuOpen(name: string, actionMenuColumn: number) {
|
||||
this.rowWithName(name).column(actionMenuColumn)
|
||||
.find('.btn')
|
||||
rowActionMenuOpen(name: string) {
|
||||
this.rowWithName(name).actionBtn()
|
||||
.click();
|
||||
|
||||
return this.rowActionMenu();
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import BaseResourceList from '@/cypress/e2e/po/lists/base-resource-list.po';
|
|||
*/
|
||||
export default class ApiKeysListPo extends BaseResourceList {
|
||||
actionMenu(accessKey: string) {
|
||||
return this.resourceTable().sortableTable().rowActionMenuOpen(accessKey, 7);
|
||||
return this.resourceTable().sortableTable().rowActionMenuOpen(accessKey);
|
||||
}
|
||||
|
||||
details(accessKey: string, index: number) {
|
||||
|
|
|
|||
|
|
@ -5,6 +5,6 @@ import BaseResourceList from '@/cypress/e2e/po/lists/base-resource-list.po';
|
|||
*/
|
||||
export default class RepoListPo extends BaseResourceList {
|
||||
actionMenu(repoName: string) {
|
||||
return this.resourceTable().sortableTable().rowActionMenuOpen(repoName, 7);
|
||||
return this.resourceTable().sortableTable().rowActionMenuOpen(repoName);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,6 +26,6 @@ export default class ProvClusterListPo extends BaseResourceList {
|
|||
}
|
||||
|
||||
actionMenu(clusterName: string) {
|
||||
return this.resourceTable().sortableTable().rowActionMenuOpen(clusterName, 8);
|
||||
return this.resourceTable().sortableTable().rowActionMenuOpen(clusterName);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ export class WorkloadsListPageBasePo extends PagePo {
|
|||
}
|
||||
|
||||
deleteItemWithUI(name: string) {
|
||||
this.sortableTable().rowActionMenuOpen(name, 10).getMenuItem('Delete').click();
|
||||
this.sortableTable().rowActionMenuOpen(name).getMenuItem('Delete').click();
|
||||
|
||||
const promptRemove = new PromptRemove();
|
||||
|
||||
|
|
@ -133,11 +133,11 @@ export class WorkloadsCreatePageBasePo extends PagePo {
|
|||
super(WorkloadsCreatePageBasePo.createPath(clusterId, workloadType, queryParams));
|
||||
}
|
||||
|
||||
selectNamespaceOption(index: number) {
|
||||
selectNamespace(label: string) {
|
||||
const selectVerb = new LabeledSelectPo(`[data-testid="name-ns-description-namespace"]`, this.self());
|
||||
|
||||
selectVerb.toggle();
|
||||
selectVerb.clickOption(index);
|
||||
selectVerb.clickLabel(label);
|
||||
}
|
||||
|
||||
namespace(): LabeledInputPo {
|
||||
|
|
@ -156,9 +156,9 @@ export class WorkloadsCreatePageBasePo extends PagePo {
|
|||
return new AsyncButtonPo('[data-testid="form-save"]', this.self());
|
||||
}
|
||||
|
||||
createWithUI(name: string, containerImage: string, namespace = 'default', namespaceOption = 1) {
|
||||
this.selectNamespaceOption(namespaceOption);
|
||||
this.namespace().set(namespace);
|
||||
createWithUI(name: string, containerImage: string, namespace = 'default') {
|
||||
// NB: namespace is already selected by default
|
||||
this.selectNamespace(namespace);
|
||||
this.name().set(name);
|
||||
this.containerImage().set(containerImage);
|
||||
this.saveCreateForm().click();
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ describe('Cluster Explorer', () => {
|
|||
cy.login();
|
||||
});
|
||||
|
||||
describe('Workloads', () => {
|
||||
describe('Workloads', { tags: ['@standardUser', '@adminUser'] }, () => {
|
||||
let deploymentsListPage: WorkloadsDeploymentsListPagePo;
|
||||
let deploymentsCreatePage: WorkloadsDeploymentsCreatePagePo;
|
||||
|
||||
|
|
|
|||
|
|
@ -3442,7 +3442,7 @@ namespace:
|
|||
workloads: Workloads
|
||||
label: Namespace
|
||||
selectNamespace: Select Namespace
|
||||
createNamespace: Create a New Namespace
|
||||
createNamespace: Create a new Namespace
|
||||
selectOrCreate: Select or Create a Namespace
|
||||
resourceStates:
|
||||
success: 'Active'
|
||||
|
|
|
|||
Loading…
Reference in New Issue