Skip to content

Commit

Permalink
Issue #2725: Some refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
ksy36 committed May 28, 2019
1 parent 520ac8d commit 442c92e
Show file tree
Hide file tree
Showing 2 changed files with 182 additions and 131 deletions.
186 changes: 105 additions & 81 deletions tests/functional/reporting-non-auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,83 +65,83 @@ registerSuite("Reporting (non-auth)", {
.end();
},

// "space in domain name validation"() {
// return FunctionalHelpers.openPage(
// this,
// url("/issues/new"),
// ".js-report-buttons"
// )
// .findByCssSelector("#url")
// .click()
// .type("http:// example.com")
// .end()
// .sleep(500)
// .findByCssSelector(".form-message-error");
// },
//
// "URL validation"() {
// return FunctionalHelpers.openPage(
// this,
// url("/issues/new"),
// ".js-report-buttons"
// )
// .findByCssSelector("#url")
// .click()
// .type("sup")
// .end()
// .sleep(500)
// .findByCssSelector(".form-message-error")
// .getVisibleText()
// .then(function(text) {
// assert.include(
// text,
// "A valid URL is required",
// "URL validation message is shown"
// );
// })
// .end()
// .findByCssSelector("#url")
// .clearValue()
// .type("http://sup.com")
// .end()
// .waitForDeletedByCssSelector(".form-message-error")
// .end();
// },
//
// "Description validation"() {
// return (
// FunctionalHelpers.openPage(
// this,
// url("/issues/new"),
// ".js-report-buttons"
// )
// .findByCssSelector("#description")
// .click()
// .end()
// .execute(function() {
// var elm = document.querySelector("#description");
// WindowHelpers.sendEvent(elm, "input");
// })
// .sleep(500)
// .findByCssSelector(".form-message-error")
// .getVisibleText()
// .then(function(text) {
// assert.include(
// text,
// "A problem summary is required",
// "Problem summary validation message is shown"
// );
// })
// .end()
// // enter a bug description
// .findByCssSelector("#description")
// .type("bug description")
// .end()
// // validation message should be gone
// .waitForDeletedByCssSelector(".form-message-error")
// .end()
// );
// },
"space in domain name validation"() {
return FunctionalHelpers.openPage(
this,
url("/issues/new"),
".js-report-buttons"
)
.findByCssSelector("#url")
.click()
.type("http:// example.com")
.end()
.sleep(500)
.findByCssSelector(".form-message-error");
},

"URL validation"() {
return FunctionalHelpers.openPage(
this,
url("/issues/new"),
".js-report-buttons"
)
.findByCssSelector("#url")
.click()
.type("sup")
.end()
.sleep(500)
.findByCssSelector(".form-message-error")
.getVisibleText()
.then(function(text) {
assert.include(
text,
"A valid URL is required",
"URL validation message is shown"
);
})
.end()
.findByCssSelector("#url")
.clearValue()
.type("http://sup.com")
.end()
.waitForDeletedByCssSelector(".form-message-error")
.end();
},

"Description validation"() {
return (
FunctionalHelpers.openPage(
this,
url("/issues/new"),
".js-report-buttons"
)
.findByCssSelector("#description")
.click()
.end()
.execute(function() {
var elm = document.querySelector("#description");
WindowHelpers.sendEvent(elm, "input");
})
.sleep(500)
.findByCssSelector(".form-message-error")
.getVisibleText()
.then(function(text) {
assert.include(
text,
"A problem summary is required",
"Problem summary validation message is shown"
);
})
.end()
// enter a bug description
.findByCssSelector("#description")
.type("bug description")
.end()
// validation message should be gone
.waitForDeletedByCssSelector(".form-message-error")
.end()
);
},

"(optional) browser + os validation"() {
return (
Expand Down Expand Up @@ -250,10 +250,10 @@ registerSuite("Reporting (non-auth)", {
.sleep(250)
// now make sure the buttons aren't disabled anymore
.findAllByCssSelector(".js-report-buttons button")
.getAttribute("class")
.then(function(classNames) {
classNames.forEach(function(className) {
assert.notInclude(className, "is-disabled");
.getAttribute("disabled")
.then(function(values) {
values.forEach(function(value) {
assert.isNull(value);
});
})
.end()
Expand Down Expand Up @@ -412,6 +412,30 @@ registerSuite("Reporting (non-auth)", {
);
})
.end();
},
"Submitting form without filling anything"() {
return FunctionalHelpers.openPage(
this,
url("/issues/new"),
".js-report-buttons"
)
.findByCssSelector(".js-Button-wrapper")
.click()
.end()
.sleep(500)
.findAllByCssSelector(".form-message-error")
.getVisibleText()
.then(function(texts) {
var errorTexts = [
"A valid URL is required.",
"Problem type required.",
"A problem summary is required."
];
errorTexts.forEach(function(expectedText) {
assert.include(texts, expectedText, "Error messages don't match");
});
})
.end();
}
}
});
Loading

0 comments on commit 442c92e

Please sign in to comment.