Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: [M3-6609] - Add Linode details page assertion for LISH via SSH Info #10513

Merged
merged 8 commits into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions packages/manager/.changeset/pr-10513-tests-1716492994025.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@linode/manager": Tests
---

Add Linode details page assertion for LISH via SSH Info ([#10513](https://github.com/linode/manager/pull/10513))
21 changes: 21 additions & 0 deletions packages/manager/cypress/e2e/core/linodes/create-linode.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ import {
} from 'support/intercepts/feature-flags';
import { interceptCreateLinode } from 'support/intercepts/linodes';
import { makeFeatureFlagData } from 'support/util/feature-flags';
import { interceptGetProfile } from 'support/intercepts/profile';

let username: string;

authenticate();
describe('Create Linode', () => {
Expand Down Expand Up @@ -70,6 +73,8 @@ describe('Create Linode', () => {
});
const linodeLabel = randomLabel();

interceptGetProfile().as('getProfile');

interceptCreateLinode().as('createLinode');
cy.visitWithLogin('/linodes/create');

Expand Down Expand Up @@ -116,10 +121,26 @@ describe('Create Linode', () => {
cy.url().should('endWith', `/linodes/${responsePayload['id']}`);
});

cy.wait('@getProfile').then((xhr) => {
username = xhr.response?.body.username;
});

// TODO Confirm whether or not toast notification should appear here.
cy.findByText('RUNNING', { timeout: LINODE_CREATE_TIMEOUT }).should(
'be.visible'
);

// confirm that LISH Console via SSH section is correct
cy.contains('LISH Console via SSH')
.should('be.visible')
.next() // Navigate to the next element which should be the value
.invoke('text') // Get the text of the next element
.then((text) => {
// Example assertion (ssh -t <Linode account username>@lish-<Linode region>.linode.com <Linode label>)
expect(text).equal(
`ssh -t ${username}@lish-${linodeRegion.id}.linode.com ${linodeLabel}`
);
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
cy.contains('LISH Console via SSH')
.should('be.visible')
.next() // Navigate to the next element which should be the value
.invoke('text') // Get the text of the next element
.then((text) => {
// Example assertion (ssh -t <Linode account username>@lish-<Linode region>.linode.com <Linode label>)
expect(text).equal(
`ssh -t ${username}@lish-${linodeRegion.id}.linode.com ${linodeLabel}`
);
});
cy.contains('LISH Console via SSH')
.should('be.visible')
.closest('tr')
.within(() => {
cy.contains(`ssh -t ${username}@lish-${linodeRegion.id}.linode.com ${linodeLabel}`).should('be.visible');
});

Very minor suggestion: here's a slightly more straightforward way to assert the SSH command is shown, with two minor benefits: it's slightly less dependent on the DOM structure, and it confirms that the SSH command is visible in addition to being present in the DOM

});
});
});
Expand Down
Loading