Skip to content

Commit

Permalink
test: Fix machine-image-upload.spec.ts test failures (linode#11319)
Browse files Browse the repository at this point in the history
* fix test

* add changeset

---------

Co-authored-by: Banks Nussman <banks@nussman.us>
  • Loading branch information
bnussman-akamai and bnussman authored Nov 25, 2024
1 parent f3439da commit c580bfc
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 11 deletions.
5 changes: 5 additions & 0 deletions packages/manager/.changeset/pr-11319-tests-1732544365525.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@linode/manager": Tests
---

Fix `machine-image-upload.spec.ts` test failures ([#11319](https://github.com/linode/manager/pull/11319))
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import 'cypress-file-upload';
import { RecPartial } from 'factory.ts';
import { DateTime } from 'luxon';
import { authenticate } from 'support/api/authentication';
import { fbtVisible, getClick } from 'support/helpers';
import {
mockDeleteImage,
mockGetCustomImages,
Expand Down Expand Up @@ -84,9 +83,9 @@ const assertFailed = (label: string, id: string, message: string) => {
ui.toast.assertMessage(`Image ${label} could not be uploaded: ${message}`);

cy.get(`[data-qa-image-cell="${id}"]`).within(() => {
fbtVisible(label);
fbtVisible('Upload Failed');
fbtVisible('N/A');
cy.findByText(label).should('be.visible');
cy.findByText('Upload Failed').should('be.visible'); // The status should be "Upload Failed"
cy.findAllByText('N/A').should('be.visible'); // The size should be "N/A"
});
};

Expand All @@ -98,9 +97,9 @@ const assertFailed = (label: string, id: string, message: string) => {
*/
const assertProcessing = (label: string, id: string) => {
cy.get(`[data-qa-image-cell="${id}"]`).within(() => {
fbtVisible(label);
fbtVisible('Pending Upload');
fbtVisible('Pending');
cy.findByText(label).should('be.visible');
cy.findByText('Pending Upload').should('be.visible'); // The status should be "Pending Upload"
cy.findAllByText('Pending').should('be.visible'); // The size should be "Pending"
});
};

Expand All @@ -115,8 +114,12 @@ const uploadImage = (label: string) => {
const region = chooseRegion({ capabilities: ['Object Storage'] });
const upload = 'machine-images/test-image.gz';
cy.visitWithLogin('/images/create/upload');
getClick('[id="label"][data-testid="textfield-input"]').type(label);
getClick('[id="description"]').type('This is a machine image upload test');

cy.findByLabelText('Label').click().type(label);

cy.findByLabelText('Description')
.click()
.type('This is a machine image upload test');

ui.regionSelect.find().click();
ui.regionSelect.findItemByRegionId(region.id).click();
Expand Down Expand Up @@ -261,8 +264,8 @@ describe('machine image', () => {
cy.wait('@getImages');
ui.toast.assertMessage(availableMessage);
cy.get(`[data-qa-image-cell="${imageId}"]`).within(() => {
fbtVisible(label);
fbtVisible('Available');
cy.findByText(label).should('be.visible');
cy.findByText('Available').should('be.visible');
});
});
});
Expand Down

0 comments on commit c580bfc

Please sign in to comment.