This repository has been archived by the owner on Oct 20, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 276
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added blue team tests to verify that comments cannot be favorited, that presentation mode navigation works, and that the redacted toggle works. Added another test to hide-show-beacon test to check hiding beacon from kebab menu. * Add blue and red team tests to verify redacted mode. Add blue team test to verify fields in Meta tab are disabled. Add associated data selectors and commands. * Update blue team Meta tab test. * Update timeline and mult-command comment tests to address GitHub test failures. * Add new test to check raw logs in blue team mode. * Update hide-show-beacon test to separate different functionality being tested. * Update "hide-last-server" red team test to streamline.
- Loading branch information
1 parent
559010e
commit 7572187
Showing
11 changed files
with
374 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
applications/redeye-e2e/src/integration/e2e/blueteam/favorite-comments.cy.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/// <reference types="cypress" /> | ||
|
||
describe('Cannot add comments to Favorites', () => { | ||
const camp = 'favcomments'; | ||
const fileName = 'gt.redeye'; | ||
|
||
it('Favorite comment button should be disabled', () => { | ||
cy.uploadCampaignBlue(camp, fileName); | ||
|
||
cy.selectCampaign(camp); | ||
|
||
cy.clickCommentsTab(); | ||
|
||
cy.get('[cy-test=fav-comment]').should('be.disabled'); | ||
}); | ||
|
||
after(() => { | ||
cy.deleteCampaignGraphQL(camp); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
applications/redeye-e2e/src/integration/e2e/blueteam/meta-tab.cy.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/// <reference types="cypress" /> | ||
|
||
describe('Meta tab fields disabled', () => { | ||
const camp = 'metatab'; | ||
const fileName = 'gt.redeye'; | ||
|
||
it('Cannot update beacon info via Meta tab', () => { | ||
// Upload campaign and open | ||
cy.uploadCampaignBlue(camp, fileName); | ||
|
||
cy.selectCampaign(camp); | ||
|
||
// Go to Beacons tab | ||
cy.clickBeaconsTab(); | ||
|
||
// Select beacon and go to Meta tab | ||
cy.get('[cy-test=beacons-row]').eq(0).click(); | ||
cy.clickMetaTab(); | ||
|
||
// Verify Display Name, TOD, and Type fields are disabled | ||
cy.get('[cy-test=beacon-display-name]').should('be.disabled'); | ||
cy.get('[cy-test=save-beacon-time-of-death]').should('be.disabled'); | ||
cy.get('[cy-test=type-dropdown]').should('be.disabled'); | ||
}); | ||
|
||
after(() => { | ||
cy.deleteCampaignGraphQL(camp); | ||
}); | ||
}); |
133 changes: 133 additions & 0 deletions
133
applications/redeye-e2e/src/integration/e2e/blueteam/presentation-mode-navigation.cy.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
/// <reference types="cypress" /> | ||
|
||
describe('Presentation Mode Navigation', () => { | ||
const camp = 'presentationmode'; | ||
const fileName = 'gt.redeye'; | ||
|
||
it('Can navigate forward and backward in Presentation Mode', () => { | ||
// Upload and open campaign | ||
cy.uploadCampaignBlue(camp, fileName); | ||
cy.selectCampaign(camp); | ||
|
||
// Go to Presentation Mode | ||
cy.clickPresentationMode(); | ||
|
||
// Click "All Comments" to open presentation | ||
cy.get('[cy-test=all]').click(); | ||
|
||
// Verify back button is disabled, Next button is enabled | ||
cy.get('[cy-test=previous-slide]').should('be.disabled'); | ||
cy.get('[cy-test=next-slide]').should('be.enabled'); | ||
|
||
// Verify slide count starts at 1; log comment text | ||
cy.get('[cy-test=slide-selector]').invoke('text').should('equal', '1'); | ||
cy.get('[cy-test=presentation-item]') | ||
.invoke('text') | ||
.then((slide1) => { | ||
// Click "Next" three times | ||
cy.get('[cy-test=next-slide]').click().click().click(); | ||
|
||
// Verify now on slide 4; previous/next buttons are enabled; verify comment text changed | ||
cy.get('[cy-test=slide-selector]').invoke('text').should('equal', '4'); | ||
cy.get('[cy-test=previous-slide]').should('be.enabled'); | ||
cy.get('[cy-test=next-slide]').should('be.enabled'); | ||
cy.get('[cy-test=presentation-item]') | ||
.invoke('text') | ||
.then((slide4) => { | ||
expect(slide4).to.not.equal(slide1); | ||
|
||
// Click back button twice | ||
cy.get('[cy-test=previous-slide]').click().click(); | ||
|
||
// Verify now on slide 2; previous/next buttons are enabled; verify comment text changed | ||
cy.get('[cy-test=slide-selector]').invoke('text').should('equal', '2'); | ||
cy.get('[cy-test=previous-slide]').should('be.enabled'); | ||
cy.get('[cy-test=next-slide]').should('be.enabled'); | ||
cy.get('[cy-test=presentation-item]') | ||
.invoke('text') | ||
.then((slide2) => { | ||
expect(slide2).to.not.equal(slide4); | ||
}); | ||
}); | ||
}); | ||
}); | ||
|
||
it('Last slide takes user back to Presentation list', () => { | ||
// Open campaign | ||
cy.selectCampaign(camp); | ||
|
||
// Go to Presentation Mode | ||
cy.clickPresentationMode(); | ||
|
||
// Click "All Comments" to open presentation | ||
cy.get('[cy-test=all]').click(); | ||
|
||
// Get total number of slides; go to last slide | ||
cy.get('[cy-test=total-slides]') | ||
.invoke('text') | ||
.then((text) => { | ||
const totalSlides = text.split(' ')[1]; | ||
cy.get('[cy-test=slide-selector]').click(); | ||
cy.get('[cy-test=slide-number-selector]') | ||
.eq(totalSlides - 1) | ||
.click(); | ||
}); | ||
|
||
// Verify "Next" button now says "Finish"; click button | ||
cy.get('[cy-test=next-slide]').should('contain', 'Finish'); | ||
cy.get('[cy-test=next-slide]').click(); | ||
|
||
// Verify you are taken back to Presentation list | ||
cy.get('[cy-test=presentation-header-bar]').should('contain', 'Select a comment topic to present'); | ||
}); | ||
|
||
it('Can navigate to a specific slide using dropdown', () => { | ||
// Open campaign | ||
cy.selectCampaign(camp); | ||
|
||
// Go to Presentation Mode | ||
cy.clickPresentationMode(); | ||
|
||
// Click "All Comments" to open presentation | ||
cy.get('[cy-test=all]').click(); | ||
|
||
// Select slide #3 from the dropdown options | ||
cy.get('[cy-test=slide-selector]').click(); | ||
cy.get('[cy-test=slide-number-selector]').eq(2).click(); | ||
|
||
// Verify you are on slide #3 | ||
cy.get('[cy-test=slide-selector]').invoke('text').should('equal', '3'); | ||
}); | ||
|
||
it('Can switch between presentations using the back arrow', () => { | ||
// Open campaign | ||
cy.selectCampaign(camp); | ||
|
||
// Go to Presentation Mode | ||
cy.clickPresentationMode(); | ||
|
||
// Click "All Comments" to open presentation | ||
cy.get('[cy-test=all]').click(); | ||
|
||
// Navigate through a few slides | ||
cy.get('[cy-test=next-slide]').click().click().click(); | ||
|
||
// Click Back button to exit presentation | ||
cy.get('[cy-test=back-to-presentations]').click(); | ||
|
||
// Open #PrivilegeEscalation presentation | ||
cy.get('[cy-test=PrivilegeEscalation]').click(); | ||
|
||
// Verify correct presentation opened, starts at slide 1, and can navigate through slides | ||
cy.get('[cy-test=presentation-name]').should('contain', '#PrivilegeEscalation'); | ||
cy.get('[cy-test=slide-selector]').invoke('text').should('equal', '1'); | ||
cy.get('[cy-test=next-slide]').click(); | ||
cy.get('[cy-test=slide-selector]').invoke('text').should('equal', '2'); | ||
cy.get('[cy-test=next-slide]').click(); | ||
cy.get('[cy-test=slide-selector]').invoke('text').should('equal', '3'); | ||
}); | ||
|
||
after(() => { | ||
cy.deleteCampaignGraphQL(camp); | ||
}); | ||
}); |
42 changes: 42 additions & 0 deletions
42
applications/redeye-e2e/src/integration/e2e/blueteam/toggle-redacted.cy.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/// <reference types="cypress" /> | ||
|
||
describe('Redacted mode toggle', () => { | ||
const camp = 'toggleredactedmode'; | ||
const fileName = 'gt.redeye'; | ||
|
||
it('Toggle Redacted mode within a campaign', () => { | ||
cy.uploadCampaignBlue(camp, fileName); | ||
|
||
cy.selectCampaign(camp); | ||
|
||
cy.toggleRedacted(); | ||
|
||
cy.get('#root').should('have.css', 'font', '14px / 18.2px "Redacted Script"'); | ||
|
||
cy.toggleUnredacted(); | ||
|
||
cy.get('#root').should( | ||
'have.css', | ||
'font', | ||
'14px / 18.2px "IBM Plex Sans", "Helvetica Neue", -apple-system, "Segoe UI", Arial, sans-serif' | ||
); | ||
}); | ||
|
||
it('Toggle Redacted mode from campaign menu', () => { | ||
cy.toggleRedacted(); | ||
|
||
cy.get('#root').should('have.css', 'font', '14px / 18.2px "Redacted Script"'); | ||
|
||
cy.toggleUnredacted(); | ||
|
||
cy.get('#root').should( | ||
'have.css', | ||
'font', | ||
'14px / 18.2px "IBM Plex Sans", "Helvetica Neue", -apple-system, "Segoe UI", Arial, sans-serif' | ||
); | ||
}); | ||
|
||
after(() => { | ||
cy.deleteCampaignGraphQL(camp); | ||
}); | ||
}); |
51 changes: 51 additions & 0 deletions
51
applications/redeye-e2e/src/integration/e2e/blueteam/view-raw-logs.cy.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/// <reference types="cypress" /> | ||
|
||
function verifyRawLogs() { | ||
cy.get('[cy-test=log-title]').should('be.visible'); | ||
cy.get('[cy-test=scroll-to-top]').should('be.visible'); | ||
cy.get('[cy-test=copyLogs]').should('be.visible'); | ||
cy.get('[cy-test=log]').should('be.visible'); | ||
cy.get('[cy-test=close-log]').should('be.visible'); | ||
} | ||
|
||
describe('View Raw Logs', () => { | ||
const camp = 'viewrawlogs'; | ||
const fileName = 'gt.redeye'; | ||
|
||
it('Can open/view raw logs from Commands', () => { | ||
cy.uploadCampaignBlue(camp, fileName); | ||
|
||
// Open campaign, go to Commands, select command | ||
cy.selectCampaign(camp); | ||
cy.clickCommandTypesTab(); | ||
cy.selectCommandType('ps'); | ||
|
||
// Expand first command | ||
cy.get('[cy-test=info-row]').eq(0).click(); | ||
cy.wait(500); | ||
cy.get('[cy-test=openRawLogs]').should('be.visible'); | ||
|
||
// Click "Show Raw Logs" link; verify log appears | ||
cy.get('[cy-test=openRawLogs]').click(); | ||
verifyRawLogs(); | ||
}); | ||
|
||
it('Can open/view raw logs from Comments', () => { | ||
// Open campaign; go to Comments | ||
cy.selectCampaign(camp); | ||
cy.clickCommentsTab(); | ||
|
||
// Click expandable row under first comment | ||
cy.get('[cy-test=command-info]').eq(0).click(); | ||
cy.wait(500); | ||
cy.get('[cy-test=openRawLogs]').should('be.visible'); | ||
|
||
// Click "Show Raw Logs" link; verify log appears | ||
cy.get('[cy-test=openRawLogs]').click(); | ||
verifyRawLogs(); | ||
}); | ||
|
||
after(() => { | ||
cy.deleteCampaignGraphQL(camp); | ||
}); | ||
}); |
Oops, something went wrong.