Skip to content

Commit

Permalink
[gui] Update run and run history test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
csordasmarton committed Oct 30, 2020
1 parent 41568ae commit 7afc78b
Show file tree
Hide file tree
Showing 9 changed files with 439 additions and 409 deletions.
7 changes: 4 additions & 3 deletions web/server/vue-cli/e2e/init.db.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,14 @@ const RUNS = [
url: `http://${host}:${port}/e2e`,
description: "This is my simple run."
},
{
// We store this run so many times to test the run history load more feature.
...[ ...Array(10).keys() ].map(idx => ({
name: "simple",
output: path.join(REPORTS_DIR, "simple"),
url: `http://${host}:${port}/e2e`,
tag: "v0.0.2",
tag: `v0.0.${idx}`,
description: "This is my updated run."
},
})),
{
name: "duplicated",
output: path.join(REPORTS_DIR, "simple"),
Expand Down
57 changes: 0 additions & 57 deletions web/server/vue-cli/e2e/pages/history.js

This file was deleted.

158 changes: 38 additions & 120 deletions web/server/vue-cli/e2e/pages/runs.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,4 @@
const commands = {
filterRuns(search, cb) {
this.clearAndSetValue("@searchInput", search)
.pause(500) // Wait some time to make sure progressbar appeared.
.waitForElementNotPresent("@progressBar")
.assert.urlContains(`name=${search}`)

this.getTableRows("@tableRows", cb);

return this;
},

backToRunsPage() {
this.api.back();

Expand All @@ -18,47 +7,6 @@ const commands = {
.waitForElementNotPresent("@progressBar");
},

openRun(name) {
return this
.click("@name")
.assert.urlContains(`run=${name}`)
.assert.urlContains("review-status=Unreviewed")
.assert.urlContains("review-status=Confirmed%20bug")
.assert.urlContains("detection-status=New")
.assert.urlContains("detection-status=Reopened")
.assert.urlContains("detection-status=Unresolved")
.waitForElementVisible("@page");
},

openRunHistory(name) {
return this
.click("@showHistoryBtn")
.assert.urlContains("/run-history")
.assert.urlContains(`run=${name}`)
.waitForElementVisible("@page");
},

openStatistics(name) {
return this
.click("@showStatisticsBtn")
.assert.urlContains("/statistics")
.assert.urlContains(`run=${name}`)
.assert.urlContains("is-unique=on")
.assert.urlContains("detection-status=New")
.assert.urlContains("detection-status=Reopened")
.assert.urlContains("detection-status=Unresolved")
.waitForElementVisible("@page");
},

openDetectionStatus(name) {
return this
.click("@openDetectionStatus")
.assert.urlContains("/reports")
.assert.urlContains(`run=${name}`)
.assert.urlContains("detection-status=")
.waitForElementVisible("@page");
},

sortRuns(column, isSorted) {
this
.click(`th:nth-child(${column})`)
Expand All @@ -71,68 +19,6 @@ const commands = {

return this;
},

showDescription() {
return this
.click("@showDescriptionBtn")
.waitForElementVisible("@descriptionMenu");
},

closeDescription() {
return this
.click("@showDescriptionBtn")
.waitForElementNotPresent("@descriptionMenu");
},

showCheckCommand() {
this.click("@showCheckCommandBtn", () => {
this.expect.section("@checkCommandDialog").to.be.visible;
});

return this;
},

closeCheckCommand() {
const section = this.section.checkCommandDialog;

section.click("@closeBtn", () => {
this.expect.section("@checkCommandDialog")
.to.not.be.present.before(5000);
});

return this;
},

removeFirstRun() {
this
.assert.cssClassPresent("@deleteSelectedRunsBtn", "v-btn--disabled")
.click("@removeRunCheckbox")
.assert.not.cssClassPresent("@deleteSelectedRunsBtn", "v-btn--disabled")
.click("@deleteSelectedRunsBtn");

this.expect.section("@removeRunDialog").to.be.visible.before(5000);

this.section.removeRunDialog.click("@confirmBtn");

this.expect.section("@removeRunDialog")
.to.not.be.present.before(5000);

return this;
},

diffFirstTwoRuns() {
this
.assert.cssClassPresent("@diffSelectedRunsBtn", "v-btn--disabled")
.click("@firstRunToDiff")
.click("@secondRunToDiff")
.assert.not.cssClassPresent("@diffSelectedRunsBtn", "v-btn--disabled")
.click("@diffSelectedRunsBtn")
.assert.urlContains("/reports")
.assert.urlContains("run=")
.assert.urlContains("newcheck=");

return this;
}
};

module.exports = {
Expand All @@ -143,7 +29,6 @@ module.exports = {
elements: {
page: ".v-data-table",
tableRows: "tbody tr",
searchInput: ".v-toolbar__content input[type='text']",
progressBar: ".v-data-table__progress",
name: "a.name",
showDescriptionBtn: "button.description",
Expand All @@ -153,15 +38,28 @@ module.exports = {
openDetectionStatus: "a.detection-status-count",
descriptionMenu:
".menuable__content__active.run-description-menu .v-card__text",
removeRunCheckbox: "tbody td:nth-child(1) .v-simple-checkbox",
deleteSelectedRunsBtn: ".delete-run-btn",
diffSelectedRunsBtn: ".diff-runs-btn",
firstRunToDiff:
"tbody tr:nth-child(1) td:last-child .v-input--checkbox:nth-child(1)",
secondRunToDiff:
"tbody tr:nth-child(2) td:last-child .v-input--checkbox:nth-child(2)"
expandBtn: "button.v-data-table__expand-icon",
},
sections: {
table: {
selector: "tbody",
elements: {
remove: "tr td:nth-child(1) .v-simple-checkbox",
baseline: "tr td:last-child .v-input--checkbox:nth-child(1)",
compareTo: "tr td:last-child .v-input--checkbox:nth-child(2)"
}
},
runFilterToolbar: {
selector: ".run-filter-toolbar",
elements: {
runName: ".v-input.run-name input[type='text']",
runTag: ".v-input.run-tag input[type='text']",
storedAfter: ".stored-after",
storedBefore: ".stored-before",
}
},
checkCommandDialog: {
selector: ".v-dialog__content--active .check-command",
elements: {
Expand All @@ -177,6 +75,26 @@ module.exports = {
confirmBtn: ".confirm-btn",
closeBtn: ".v-card__title button"
}
},
expanded: {
selector: ".v-data-table__expanded__content",
elements: {
items: ".v-list-item",
loadMoreBtn: ".v-btn.load-more-btn"
},
sections: {
timeline: {
selector: ".v-timeline",
elements: {
date: ".date",
showStatisticsBtn: "a.show-statistics",
showCheckCommandBtn: "button.show-check-command",
historyEvent: ".v-timeline-item.run-history",
baseline: ".compare-events .v-input--checkbox:nth-child(1)",
compareTo: ".compare-events .v-input--checkbox:nth-child(2)"
}
}
}
}
}
}
102 changes: 0 additions & 102 deletions web/server/vue-cli/e2e/specs/history.js

This file was deleted.

Loading

0 comments on commit 7afc78b

Please sign in to comment.