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

[Defend Workflows][E2E]Endpoint e2e response console multipass #155519

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
2f884d5
avatar aria label
szwarckonrad Apr 4, 2023
704886c
isolate command e2e coverage
szwarckonrad Apr 5, 2023
feab480
Merge branch 'main' into endpoint-isolate-e2e-coverage
szwarckonrad Apr 5, 2023
5db6e07
typings
szwarckonrad Apr 6, 2023
51b63c3
Merge branch 'main' into endpoint-isolate-e2e-coverage
szwarckonrad Apr 6, 2023
4de9906
typings
szwarckonrad Apr 6, 2023
67eb92c
cleanup
szwarckonrad Apr 17, 2023
12874a1
Merge branch 'main' into endpoint-isolate-e2e-coverage
szwarckonrad Apr 17, 2023
fcc702f
use custom document generator
szwarckonrad Apr 17, 2023
25674ff
Merge branch 'main' into endpoint-isolate-e2e-coverage
szwarckonrad Apr 17, 2023
7c9043f
Merge branch 'main' into endpoint-isolate-e2e-coverage
szwarckonrad Apr 18, 2023
c54509b
manualy refresh result list
szwarckonrad Apr 18, 2023
d2fbb5d
Merge branch 'main' into endpoint-isolate-e2e-coverage
szwarckonrad Apr 18, 2023
9415935
remove artifacts after endpoints.cy.ts test
szwarckonrad Apr 18, 2023
ac9e110
Merge branch 'main' into endpoint-isolate-e2e-coverage
szwarckonrad Apr 18, 2023
193968b
backport isolate e2e tests to multipass
szwarckonrad Apr 20, 2023
f84233b
Merge branch 'main' into endpoint-isolate-e2e-coverage
szwarckonrad Apr 20, 2023
b3a7460
cleanup
szwarckonrad Apr 20, 2023
345c733
Merge branch 'endpoint-isolate-e2e-coverage' into endpoint-isolate-e2…
szwarckonrad Apr 20, 2023
b5b6941
tweaks
szwarckonrad Apr 21, 2023
62fa777
Merge branch 'main' into endpoint-isolate-e2e-coverage
szwarckonrad Apr 21, 2023
5157dda
Merge branch 'endpoint-isolate-e2e-coverage' into endpoint-isolate-e2…
szwarckonrad Apr 21, 2023
7c13a7e
cleanup
szwarckonrad Apr 21, 2023
890c52c
test isolate and processes commands
szwarckonrad Apr 21, 2023
678aaa7
Merge branch 'main' into endpoint-e2e-coverage-multipass
szwarckonrad Apr 24, 2023
7aea2b5
Merge branch 'main' into endpoint-isolate-e2e-coverage-multipass
szwarckonrad Apr 24, 2023
2b07574
type returns of helper functions
szwarckonrad Apr 24, 2023
7b8fe2a
Merge branch 'endpoint-isolate-e2e-coverage-multipass' into endpoint-…
szwarckonrad Apr 24, 2023
12b16d2
tweaks
szwarckonrad Apr 24, 2023
aef3b55
Merge branch 'main' into endpoint-e2e-coverage-multipass
szwarckonrad Apr 24, 2023
7d03f5c
Merge branch 'main' into endpoint-e2e-coverage-multipass
szwarckonrad Apr 25, 2023
f5ce24d
divide endpoint list checking function
szwarckonrad Apr 25, 2023
28e459e
Merge branch 'main' into endpoint-e2e-coverage-multipass
szwarckonrad Apr 25, 2023
2a2ed44
Merge branch 'main' into endpoint-e2e-coverage-multipass
szwarckonrad Apr 25, 2023
9f74e8f
Merge branch 'main' into endpoint-e2e-coverage-multipass
szwarckonrad Apr 26, 2023
dc61a76
cleanup
szwarckonrad Apr 26, 2023
c0f3f24
naming
szwarckonrad Apr 26, 2023
7f0526f
naming
szwarckonrad Apr 26, 2023
d826943
explicit types
szwarckonrad Apr 26, 2023
bdce83f
Merge branch 'main' into endpoint-e2e-coverage-multipass
szwarckonrad Apr 26, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ describe('Isolate command', () => {
initialAgentData = agentData;
});

getEndpointIntegrationVersion().then((version) => {
createAgentPolicyTask(version, (data) => {
getEndpointIntegrationVersion().then((version) =>
createAgentPolicyTask(version).then((data) => {
response = data;
});
});
})
);
});

after(() => {
Expand All @@ -67,8 +67,7 @@ describe('Isolate command', () => {
}
});

// flaky
it.skip('should allow filtering endpoint by Isolated status', () => {
it('should allow filtering endpoint by Isolated status', () => {
cy.visit(APP_ENDPOINTS_PATH);
closeAllToasts();
checkEndpointListForOnlyUnIsolatedHosts();
Expand Down Expand Up @@ -113,11 +112,11 @@ describe('Isolate command', () => {
initialAgentData = agentData;
});

getEndpointIntegrationVersion().then((version) => {
createAgentPolicyTask(version, (data) => {
getEndpointIntegrationVersion().then((version) =>
createAgentPolicyTask(version).then((data) => {
response = data;
});
});
})
);
loadRule(false).then((data) => {
ruleId = data.id;
ruleName = data.name;
Expand Down Expand Up @@ -186,11 +185,11 @@ describe('Isolate command', () => {
getAgentByHostName(endpointHostname).then((agentData) => {
initialAgentData = agentData;
});
getEndpointIntegrationVersion().then((version) => {
createAgentPolicyTask(version, (data) => {
getEndpointIntegrationVersion().then((version) =>
createAgentPolicyTask(version).then((data) => {
response = data;
});
});
})
);

loadRule(false).then((data) => {
ruleId = data.id;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ describe('Response console', () => {
initialAgentData = agentData;
});

getEndpointIntegrationVersion().then((version) => {
createAgentPolicyTask(version, (data) => {
getEndpointIntegrationVersion().then((version) =>
createAgentPolicyTask(version).then((data) => {
response = data;
});
});
})
);
});

after(() => {
Expand Down Expand Up @@ -93,11 +93,11 @@ describe('Response console', () => {
initialAgentData = agentData;
});

getEndpointIntegrationVersion().then((version) => {
createAgentPolicyTask(version, (data) => {
getEndpointIntegrationVersion().then((version) =>
createAgentPolicyTask(version).then((data) => {
response = data;
});
});
})
);
});

after(() => {
Expand All @@ -120,15 +120,16 @@ describe('Response console', () => {
cy.contains(header);
});

cy.get('tbody')
.find('tr')
.then((rows) => {
expect(rows.length).to.be.greaterThan(0);
})
.find('td')
cy.get('tbody > tr').should('have.length.greaterThan', 0);
cy.get('tbody > tr > td').should('contain', '/usr/sbin/cron');
cy.get('tbody > tr > td')
.contains('/usr/sbin/cron')
.then((td) => {
cronPID = td.parents('tr').find('td').eq(1).find('span').text();
.parents('td')
.siblings('td')
.eq(1)
.find('span')
.then((span) => {
cronPID = span.text();
});
});
});
Expand All @@ -144,14 +145,17 @@ describe('Response console', () => {
submitCommand();

cy.getByTestSubj('getProcessesSuccessCallout', { timeout: 120000 }).within(() => {
cy.get('tbody')
.find('td')
cy.get('tbody > tr > td')
.contains('/usr/sbin/cron')
.then((td) => {
newCronPID = td.parents('tr').find('td').eq(1).find('span').text();
expect(newCronPID).to.not.equal(cronPID);
.parents('td')
.siblings('td')
.eq(1)
.find('span')
.then((span) => {
newCronPID = span.text();
});
});
expect(newCronPID).to.not.equal(cronPID);
});

it('"suspend-process --pid" - should suspend a process', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,17 +111,14 @@ export const filterOutEndpoints = (endpointHostname: string): void => {
});
};

export const createAgentPolicyTask = (
version: string,
cb: (response: IndexedFleetEndpointPolicyResponse) => void
) => {
export const createAgentPolicyTask = (version: string) => {
const policyName = `Reassign ${Math.random().toString(36).substring(2, 7)}`;

cy.task<IndexedFleetEndpointPolicyResponse>('indexFleetEndpointPolicy', {
return cy.task<IndexedFleetEndpointPolicyResponse>('indexFleetEndpointPolicy', {
Copy link
Contributor

Choose a reason for hiding this comment

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

nice!

policyName,
endpointPackageVersion: version,
agentPolicyName: policyName,
}).then(cb);
});
};

export const filterOutIsolatedHosts = (): void => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ export const selectCommandFromHelpMenu = (command: string) => {
export const checkInputForCommandPresence = (command: string) => {
cy.getByTestSubj('endpointResponseActionsConsole-cmdInput-leftOfCursor')
.invoke('text')
.then((text) => text.trim())
.should('eq', command);
.should('eq', `${command} `); // command in the cli input is followed by a space
};

export const submitCommand = () => {
Expand Down