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-6608] - Add Linode power off, power on and reboot tests #9980

Merged
merged 2 commits into from
Jan 2, 2024
Merged
Show file tree
Hide file tree
Changes from all 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-9980-added-1701986820847.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@linode/manager": Added
Copy link
Contributor

Choose a reason for hiding this comment

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

I had a similar PR where I only added new tests and was unsure of which identifier to use for the changeset. In my case I ended up going with Tests. My decision was based on the descriptions found under the Commit Types in the Pull Request Template:

test: New tests or changes to existing tests. Does not change the production code.

Copy link
Contributor

Choose a reason for hiding this comment

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

+1 to using tests for the changeset category

---

Tests to power on/off and reboot Linodes ([#9980](https://github.com/linode/manager/pull/9980))
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
import { createLinode } from 'support/api/linodes';
import { containsVisible, fbtVisible, fbltVisible } from 'support/helpers';
import { apiMatcher } from 'support/util/intercepts';
import { ui } from 'support/ui';
import { cleanUp } from 'support/util/cleanup';
import { authenticate } from 'support/api/authentication';

authenticate();
describe('switch linode state', () => {
beforeEach(() => {
cleanUp(['linodes']);
});

it('powers off a linode from landing page', () => {
createLinode().then((linode) => {
cy.visitWithLogin('/linodes');
cy.get(`[data-qa-linode="${linode.label}"]`)
.should('be.visible')
.within(() => {
containsVisible('Running');
});

ui.actionMenu
.findByTitle(`Action menu for Linode ${linode.label}`)
.should('be.visible')
.click();

ui.actionMenuItem.findByTitle('Power Off').should('be.visible').click();

ui.dialog
.findByTitle(`Power Off Linode ${linode.label}?`)
.should('be.visible')
.within(() => {
ui.button
.findByTitle('Power Off Linode')
.should('be.visible')
.should('be.enabled')
.click();
});

cy.get(`[data-qa-linode="${linode.label}"]`)
.should('be.visible')
.within(() => {
containsVisible('Shutting Down');
cy.contains('Offline', { timeout: 300000 }).should('be.visible');
Copy link
Contributor

Choose a reason for hiding this comment

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

is 5 minutes too long? Not sure what our standards are.

});
});
});

it('powers off a linode from details page', () => {
createLinode().then((linode) => {
cy.visitWithLogin(`/linodes/${linode.id}`);
containsVisible('RUNNING');
fbtVisible(linode.label);

cy.findByText('Power Off').should('be.visible').click();
ui.dialog
.findByTitle(`Power Off Linode ${linode.label}?`)
.should('be.visible')
.within(() => {
ui.button
.findByTitle('Power Off Linode')
.should('be.visible')
.should('be.enabled')
.click();
});
containsVisible('SHUTTING DOWN');
cy.contains('OFFLINE', { timeout: 300000 }).should('be.visible');
});
});

it('powers on a linode from landing page', () => {
createLinode({ booted: false }).then((linode) => {
cy.visitWithLogin('/linodes');
cy.get(`[data-qa-linode="${linode.label}"]`)
.should('be.visible')
.within(() => {
containsVisible('Offline');
});

ui.actionMenu
.findByTitle(`Action menu for Linode ${linode.label}`)
.should('be.visible')
.click();

ui.actionMenuItem.findByTitle('Power On').should('be.visible').click();

ui.dialog
.findByTitle(`Power On Linode ${linode.label}?`)
.should('be.visible')
.within(() => {
ui.button
.findByTitle('Power On Linode')
.should('be.visible')
.should('be.enabled')
.click();
});

cy.get(`[data-qa-linode="${linode.label}"]`)
.should('be.visible')
.within(() => {
containsVisible('Booting');
cy.contains('Running', { timeout: 300000 }).should('be.visible');
});
});
});

it('powers on a linode from details page', () => {
createLinode({ booted: false }).then((linode) => {
cy.visitWithLogin(`/linodes/${linode.id}`);
containsVisible('OFFLINE');
fbtVisible(linode.label);

cy.findByText('Power On').should('be.visible').click();
ui.dialog
.findByTitle(`Power On Linode ${linode.label}?`)
.should('be.visible')
.within(() => {
ui.button
.findByTitle('Power On Linode')
.should('be.visible')
.should('be.enabled')
.click();
});
containsVisible('BOOTING');
cy.contains('RUNNING', { timeout: 300000 }).should('be.visible');
});
});

it('reboots a linode from landing page', () => {
createLinode().then((linode) => {
cy.visitWithLogin('/linodes');
cy.get(`[data-qa-linode="${linode.label}"]`)
.should('be.visible')
.within(() => {
containsVisible('Running');
});

ui.actionMenu
.findByTitle(`Action menu for Linode ${linode.label}`)
.should('be.visible')
.click();

ui.actionMenuItem.findByTitle('Reboot').should('be.visible').click();

ui.dialog
.findByTitle(`Reboot Linode ${linode.label}?`)
.should('be.visible')
.within(() => {
ui.button
.findByTitle('Reboot Linode')
.should('be.visible')
.should('be.enabled')
.click();
});

cy.get(`[data-qa-linode="${linode.label}"]`)
.should('be.visible')
.within(() => {
containsVisible('Rebooting');
cy.contains('Running', { timeout: 300000 }).should('be.visible');
});
});
});

it('reboots a linode from details page', () => {
createLinode().then((linode) => {
cy.visitWithLogin(`/linodes/${linode.id}`);
containsVisible('RUNNING');
fbtVisible(linode.label);

cy.findByText('Reboot').should('be.visible').click();
ui.dialog
.findByTitle(`Reboot Linode ${linode.label}?`)
.should('be.visible')
.within(() => {
ui.button
.findByTitle('Reboot Linode')
.should('be.visible')
.should('be.enabled')
.click();
});
containsVisible('REBOOTING');
cy.contains('RUNNING', { timeout: 300000 }).should('be.visible');
});
});
});