Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
e2e tests
Browse files Browse the repository at this point in the history
feloy committed Aug 30, 2023

Verified

This commit was signed with the committer’s verified signature.
1 parent a3ac3ec commit 0cd1c1c
Showing 5 changed files with 51 additions and 6 deletions.
49 changes: 47 additions & 2 deletions ui/cypress/e2e/spec.cy.ts
Original file line number Diff line number Diff line change
@@ -175,6 +175,24 @@ describe('devfile editor spec', () => {
.should('contain.text', 'an-image-name')
.should('contain.text', '/path/to/build/context')
.should('contain.text', '/path/to/dockerfile');

cy.getByDataCy('image-build-startup').first()
.should('contain.text', 'Yes, the image is not referenced by any command');
});

it('displays a created image with forced build', () => {
cy.init();

cy.selectTab(TAB_IMAGES);
cy.getByDataCy('image-name').type('created-image');
cy.getByDataCy('image-image-name').type('an-image-name');
cy.getByDataCy('image-build-context').type('/path/to/build/context');
cy.getByDataCy('image-dockerfile-uri').type('/path/to/dockerfile');
cy.getByDataCy('image-auto-build').click();
cy.getByDataCy('image-create').click();

cy.getByDataCy('image-build-startup').first()
.should('contain.text', 'Yes, forced');
});

it('displays a created resource, with manifest', () => {
@@ -189,7 +207,10 @@ describe('devfile editor spec', () => {
cy.getByDataCy('resource-info').first()
.should('contain.text', 'created-resource')
.should('contain.text', 'a-resource-manifest');
});

cy.getByDataCy('resource-deploy-startup').first()
.should('contain.text', 'Yes, the resource is not referenced by any command');
});

it('displays a created resource, with uri (default)', () => {
cy.init();
@@ -205,6 +226,24 @@ describe('devfile editor spec', () => {
.should('contain.text', '/my/manifest.yaml');
});

it('displays a created resource, with forced deploy', () => {
cy.init();

cy.selectTab(TAB_RESOURCES);
cy.getByDataCy('resource-name').type('created-resource');
cy.getByDataCy('resource-toggle-inlined').click();
cy.getByDataCy('resource-manifest').type('a-resource-manifest');
cy.getByDataCy('resource-deploy-by-default').click();
cy.getByDataCy('resource-create').click();

cy.getByDataCy('resource-info').first()
.should('contain.text', 'created-resource')
.should('contain.text', 'a-resource-manifest');

cy.getByDataCy('resource-deploy-startup').first()
.should('contain.text', 'Yes, forced');
});

it('displays a created volume', () => {
cy.init();

@@ -302,9 +341,12 @@ describe('devfile editor spec', () => {
.should('contain.text', 'an-image-name')
.should('contain.text', '/context/dir')
.should('contain.text', '/path/to/Dockerfile');

cy.getByDataCy('image-build-startup').first()
.should('contain.text', 'No');
});

it('creates an apply resource command with a new resource using manifest', () => {
it.only('creates an apply resource command with a new resource using manifest', () => {
cy.init();

cy.selectTab(TAB_COMMANDS);
@@ -328,6 +370,9 @@ describe('devfile editor spec', () => {
cy.getByDataCy('resource-info').first()
.should('contain.text', 'a-created-resource')
.should('contain.text', 'spec: {}');

cy.getByDataCy('resource-deploy-startup').first()
.should('contain.text', 'No');
});

it('creates an apply resource command with a new resource using uri (default)', () => {
2 changes: 1 addition & 1 deletion ui/src/app/forms/image/image.component.html
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@ <h2>Add a new image</h2>
<div class="description">An Image defines how to build a container image.</div>
<form [formGroup]="form">
<div>
<mat-checkbox matTooltip="Images referenced in commands won't be built at startup. You can force to build this image at startup, even if it is referenced in a command" formControlName="autoBuild">Force build at Startup</mat-checkbox>
<mat-checkbox data-cy="image-auto-build" matTooltip="Images referenced in commands won't be built at startup. You can force to build this image at startup, even if it is referenced in a command" formControlName="autoBuild">Force build at Startup</mat-checkbox>
</div>
<mat-form-field appearance="outline" class="mid-width">
<mat-label><span>Name</span></mat-label>
2 changes: 1 addition & 1 deletion ui/src/app/forms/resource/resource.component.html
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@ <h2>Add a new resource</h2>
<div class="description">A Resource defines a Kubernetes resource. Its definition can be given either by a URI pointing to a manifest file or by an inlined YAML manifest.</div>
<form [formGroup]="form">
<div>
<mat-checkbox matTooltip="Resources referenced in commands won't be deployed at startup. You can force to deploy this resource at startup, even if it is referenced in a command" formControlName="deployByDefault">Force Deployment at Startup</mat-checkbox>
<mat-checkbox data-cy="resource-deploy-by-default" matTooltip="Resources referenced in commands won't be deployed at startup. You can force to deploy this resource at startup, even if it is referenced in a command" formControlName="deployByDefault">Force Deployment at Startup</mat-checkbox>
</div>
<mat-form-field appearance="outline" class="mid-width">
<mat-label><span>Name</span></mat-label>
2 changes: 1 addition & 1 deletion ui/src/app/tabs/images/images.component.html
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@
</mat-card-header>
<mat-card-content>
<table class="aligned">
<tr>
<tr data-cy="image-build-startup">
<td>Build at Startup:</td>
<td *ngIf="image.autoBuild"><code>Yes, forced</code></td>
<td *ngIf="!image.autoBuild && image.orphan"><code>Yes, the image is not referenced by any command</code></td>
2 changes: 1 addition & 1 deletion ui/src/app/tabs/resources/resources.component.html
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@
</mat-card-header>
<mat-card-content>
<table class="aligned">
<tr>
<tr data-cy="resource-deploy-startup">
<td>Deploy at Startup:</td>
<td *ngIf="resource.deployByDefault"><code>Yes, forced</code></td>
<td *ngIf="!resource.deployByDefault && resource.orphan"><code>Yes, the resource is not referenced by any command</code></td>

0 comments on commit 0cd1c1c

Please sign in to comment.