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 275
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add tests for new Bulk Edit feature (incl. associated data selectors and commands). * test * retry * update hide host bulk test * Update bulk edit tests to streamline. * Minor update to hide-host-bulk test. --------- Co-authored-by: Sebastian Ang <dajian.ang@pnnl.gov>
- Loading branch information
1 parent
19f8bd2
commit ff6bce3
Showing
7 changed files
with
212 additions
and
3 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
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
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
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
94 changes: 94 additions & 0 deletions
94
applications/redeye-e2e/src/integration/e2e/redteam/hide-beacon-bulk.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,94 @@ | ||
/// <reference types="cypress" /> | ||
|
||
function selectMultipleBeacons() { | ||
cy.get('[type=checkbox]').eq(0).check({ force: true }); | ||
cy.get('[type=checkbox]').eq(1).check({ force: true }); | ||
cy.get('[type=checkbox]').eq(2).check({ force: true }); | ||
} | ||
|
||
describe('Bulk edit to hide beacons', () => { | ||
const camp = 'bulkEditHideBeacon'; | ||
const fileName = 'gt.redeye'; | ||
|
||
it('Can hide multiple beacons using Bulk Edit', () => { | ||
cy.uploadCampaign(camp, fileName); | ||
|
||
// Search for new campaign by name | ||
cy.selectCampaign(camp); | ||
|
||
// // Toggle switch to not show hidden items | ||
cy.doNotShowHiddenItems(); | ||
|
||
// Get beacon names and create array | ||
cy.clickBeaconsTab(); | ||
|
||
const beacons = []; | ||
cy.get('[cy-test=beacons-row]').each(($beac) => beacons.push($beac.text())); | ||
cy.wrap(beacons).as('fullList').should('have.length', 5); | ||
|
||
// Use Bulk Edit to hide 3 beacons | ||
cy.clickBulkEdit(); | ||
selectMultipleBeacons(); | ||
cy.clickBulkEdit(); | ||
cy.bulkEditHide(); | ||
|
||
// Verify beacons no longer show | ||
cy.get('[cy-test=beacons-row]') | ||
.invoke('text') | ||
.should(($in) => { | ||
expect($in).to.not.contain(beacons[0]).and.to.not.contain(beacons[1]).and.to.not.contain(beacons[2]); | ||
}); | ||
|
||
// Toggle switch back on | ||
cy.showHiddenItems(); | ||
|
||
// Verify beacons now show again with the hidden icon | ||
cy.clickBeaconsTab(); | ||
cy.get('[cy-test=beacons-row]').should('have.length', 5); | ||
cy.get('[cy-test=hidden]') | ||
.its('length') | ||
.then((hiddenCount) => { | ||
expect(hiddenCount).to.eq(3); | ||
}); | ||
|
||
// Use Bulk Edit to unhide the beacons | ||
cy.clickBulkEdit(); | ||
selectMultipleBeacons(); | ||
cy.clickBulkEdit(); | ||
cy.bulkEditShow(); | ||
|
||
// Toggle off switch for hidden beacons | ||
cy.doNotShowHiddenItems(); | ||
|
||
// // Verify beacons show | ||
cy.clickBeaconsTab(); | ||
cy.get('[cy-test=beacons-row]').should('have.length', 5); | ||
}); | ||
|
||
it('Verify Cancel button works for Bulk Edit', () => { | ||
// Search for new campaign by name | ||
cy.selectCampaign(camp); | ||
|
||
// Go to Beacons tab and log starting number of beacons | ||
cy.clickBeaconsTab(); | ||
cy.get('[cy-test=beacons-row]').its('length').as('beaconCount').should('eq', 5); | ||
|
||
// Use Bulk Edit to select the first three | ||
cy.clickBulkEdit(); | ||
selectMultipleBeacons(); | ||
|
||
// Click Cancel button above Bulk Edit to cancel action | ||
cy.get('[cy-test=cancel]').click(); | ||
|
||
// Toggle switch so that hidden items are not shown | ||
cy.doNotShowHiddenItems(); | ||
|
||
// Verify beacon numbers are still the same | ||
cy.clickBeaconsTab(); | ||
cy.get('@beaconCount').should('eq', 5); | ||
}); | ||
|
||
after(() => { | ||
cy.deleteCampaignGraphQL(camp); | ||
}); | ||
}); |
88 changes: 88 additions & 0 deletions
88
applications/redeye-e2e/src/integration/e2e/redteam/hide-host-bulk.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,88 @@ | ||
/// <reference types="cypress" /> | ||
|
||
function selectMultipleHosts() { | ||
cy.get('[type=checkbox]').eq(0).check({ force: true }); | ||
cy.get('[type=checkbox]').eq(1).check({ force: true }); | ||
cy.get('[type=checkbox]').eq(2).check({ force: true }); | ||
} | ||
|
||
describe('Bulk edit to hide hosts', () => { | ||
const camp = 'bulkEditHideHost'; | ||
const fileName = 'smalldata.redeye'; | ||
|
||
it('Can hide multiple hosts using Bulk Edit', () => { | ||
cy.uploadCampaign(camp, fileName); | ||
|
||
// Search for new campaign by name | ||
cy.selectCampaign(camp); | ||
|
||
// // Toggle switch to not show hidden items | ||
cy.doNotShowHiddenItems(); | ||
|
||
// Get host names and create array | ||
const hosts = []; | ||
cy.get('[cy-test=hostName]').each(($ho) => hosts.push($ho.text())); | ||
cy.wrap(hosts).as('fullList').should('have.length', 6); | ||
|
||
// Use Bulk Edit to hide 3 hosts | ||
cy.clickBulkEdit(); | ||
selectMultipleHosts(); | ||
cy.clickBulkEdit(); | ||
cy.bulkEditHide(); | ||
|
||
// Verify hosts no longer show | ||
cy.get('[cy-test=hostName]') | ||
.invoke('text') | ||
.should(($in) => { | ||
expect($in).to.not.contain(hosts[0]).and.to.not.contain(hosts[1]).and.to.not.contain(hosts[2]); | ||
}); | ||
|
||
// Toggle switch back on | ||
cy.showHiddenItems(); | ||
|
||
// Verify hosts show again with the hidden icon | ||
cy.get('[cy-test=hostName]').should('have.length', 6); | ||
cy.get('[cy-test=hidden]') | ||
.its('length') | ||
.then((hiddenCount) => { | ||
expect(hiddenCount).to.be.gte(3); | ||
}); | ||
|
||
// Use Bulk Edit to unhide the hosts | ||
cy.clickBulkEdit(); | ||
selectMultipleHosts(); | ||
cy.clickBulkEdit(); | ||
cy.bulkEditShow(); | ||
|
||
// Toggle off switch for hidden items | ||
cy.doNotShowHiddenItems(); | ||
|
||
// Verify hosts show | ||
cy.get('[cy-test=hostName]').should('have.length', 6); | ||
}); | ||
|
||
it('Verify Cancel button works for Bulk Edit', () => { | ||
// Search for new campaign by name | ||
cy.selectCampaign(camp); | ||
|
||
// Log starting number of hosts | ||
cy.get('[cy-test=info-row]').its('length').as('hostsCount').should('eq', 6); | ||
|
||
// Use Bulk Edit to select the first three | ||
cy.clickBulkEdit(); | ||
selectMultipleHosts(); | ||
|
||
// Click Cancel button above Bulk Edit to cancel action | ||
cy.get('[cy-test=cancel]').click(); | ||
|
||
// Toggle switch so that hidden items are not shown | ||
cy.doNotShowHiddenItems(); | ||
|
||
// Verify host numbers are still the same | ||
cy.get('@hostsCount').should('eq', 6); | ||
}); | ||
|
||
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