mirror of https://github.com/rancher/dashboard.git
Merge pull request #12727 from izaac/container_limits
[Automation] - Check default limit values in UI while creating a Pod with the Form
This commit is contained in:
commit
25c5cac1ab
|
|
@ -2,12 +2,18 @@ import CreateEditViewPo from '@/cypress/e2e/po/components/create-edit-view.po';
|
|||
import Kubectl from '@/cypress/e2e/po/components/kubectl.po';
|
||||
import Shell from '@/cypress/e2e/po/components/shell.po';
|
||||
import NameNsDescription from '@/cypress/e2e/po/components/name-ns-description.po';
|
||||
import { PodContainer } from '@/cypress/e2e/po/components/workloads/pods/pod-container.po';
|
||||
import ResourceDetailPo from '~/cypress/e2e/po/edit/resource-detail.po';
|
||||
|
||||
export default class PodPo extends CreateEditViewPo {
|
||||
constructor(selector = '.dashboard-root') {
|
||||
super(selector);
|
||||
}
|
||||
|
||||
resourceTitle() {
|
||||
return this.self().find('masthead-resource-title');
|
||||
}
|
||||
|
||||
nameNsDescription() {
|
||||
return new NameNsDescription(this.self());
|
||||
}
|
||||
|
|
@ -26,4 +32,12 @@ export default class PodPo extends CreateEditViewPo {
|
|||
|
||||
shell.openTerminal();
|
||||
}
|
||||
|
||||
containerButton() {
|
||||
return new PodContainer();
|
||||
}
|
||||
|
||||
saveCreateForm(): ResourceDetailPo {
|
||||
return new ResourceDetailPo(this.self());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,16 @@
|
|||
import LabeledInputPo from '@/cypress/e2e/po/components/labeled-input.po';
|
||||
import ComponentPo from '@/cypress/e2e/po/components/component.po';
|
||||
|
||||
export class PodContainerGeneral extends ComponentPo {
|
||||
constructor(selector = '.dashboard-root') {
|
||||
super(selector);
|
||||
}
|
||||
|
||||
inputImageName() {
|
||||
return new LabeledInputPo(cy.get('[placeholder="e.g. nginx:latest"]'));
|
||||
}
|
||||
|
||||
createButton() {
|
||||
return this.self().find('[data-testid="form-save"]');
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
import LabeledInputPo from '@/cypress/e2e/po/components/labeled-input.po';
|
||||
import ComponentPo from '@/cypress/e2e/po/components/component.po';
|
||||
|
||||
export class PodContainerResources extends ComponentPo {
|
||||
constructor(selector = '.dashboard-root') {
|
||||
super(selector);
|
||||
}
|
||||
|
||||
clickResources() {
|
||||
return this.self().get('[data-testid="btn-resources"]').first()
|
||||
.scrollIntoView()
|
||||
.click();
|
||||
}
|
||||
|
||||
inputCpuReservation() {
|
||||
return new LabeledInputPo(cy.get('[data-testid="cpu-reservation"]'));
|
||||
}
|
||||
|
||||
inputMemoryReservation() {
|
||||
return new LabeledInputPo(cy.get('[data-testid="memory-reservation"]'));
|
||||
}
|
||||
|
||||
inputCpuLimit() {
|
||||
return new LabeledInputPo(cy.get('[data-testid="cpu-limit"]'));
|
||||
}
|
||||
|
||||
inputMemoryLimit() {
|
||||
return new LabeledInputPo(cy.get('[data-testid="memory-limit"]'));
|
||||
}
|
||||
|
||||
inputGpuLimit() {
|
||||
return new LabeledInputPo(cy.get('[data-testid="gpu-limit"]'));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
import { PodContainerGeneral } from '@/cypress/e2e/po/components/workloads/pods/pod-container-general.po';
|
||||
import { PodContainerResources } from '@/cypress/e2e/po/components/workloads/pods/pod-container-resources.po';
|
||||
|
||||
export class PodContainer {
|
||||
resources() {
|
||||
return new PodContainerResources('[data-testid="btn-resources"]');
|
||||
}
|
||||
|
||||
general() {
|
||||
return new PodContainerGeneral('[data-testid="btn-general"]');
|
||||
}
|
||||
}
|
||||
|
|
@ -281,6 +281,41 @@ describe('Pods', { testIsolation: 'off', tags: ['@explorer2', '@adminUser'] }, (
|
|||
});
|
||||
});
|
||||
|
||||
describe('When creating a pod using the web Form', () => {
|
||||
const singlePodName = Cypress._.uniqueId(Date.now().toString());
|
||||
|
||||
it(`should have the default input units displayed`, () => {
|
||||
workloadsPodPage.goTo();
|
||||
workloadsPodPage.createPod();
|
||||
|
||||
const podDetails = new PodPo();
|
||||
|
||||
podDetails.nameNsDescription().name().set(singlePodName);
|
||||
|
||||
const podDetailsGeneral = podDetails.containerButton().general();
|
||||
|
||||
podDetailsGeneral.inputImageName().set('nginx:alpine');
|
||||
const podDetailsResources = podDetails.containerButton().resources();
|
||||
|
||||
podDetailsResources.clickResources();
|
||||
podDetailsResources.inputCpuLimit().getAttributeValue('placeholder').should('contain', 'e.g. 1000');
|
||||
podDetailsResources.inputCpuReservation().getAttributeValue('placeholder').should('contain', 'e.g. 1000');
|
||||
podDetailsResources.inputMemoryReservation().getAttributeValue('placeholder').should('contain', 'e.g. 128');
|
||||
podDetailsResources.inputMemoryLimit().getAttributeValue('placeholder').should('contain', 'e.g. 128');
|
||||
podDetailsResources.inputGpuLimit().getAttributeValue('placeholder').should('contain', 'e.g. 1');
|
||||
|
||||
podDetailsResources.inputCpuLimit().set('100');
|
||||
podDetailsResources.inputCpuReservation().set('100');
|
||||
podDetailsResources.inputMemoryLimit().set('128');
|
||||
podDetailsResources.inputMemoryLimit().set('128');
|
||||
podDetailsResources.inputGpuLimit().set('0');
|
||||
|
||||
podDetails.saveCreateForm().cruResource().saveOrCreate().click();
|
||||
workloadsPodPage.waitForPage();
|
||||
workloadsPodPage.sortableTable().rowElementWithName(singlePodName).scrollIntoView().should('be.visible');
|
||||
});
|
||||
});
|
||||
|
||||
// describe.skip('[Vue3 Skip]: should delete pod', () => {
|
||||
// const podName = `pod-${ Date.now() }`;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue