Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
"use strict";
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
const intern = require("intern").default;
const { assert } = intern.getPlugin("chai");
const { registerSuite } = intern.getInterface("object");
const FunctionalHelpers = require("./lib/helpers.js");
var url = function(path) {
return intern.config.siteRoot + path;
};
registerSuite("Index", {
tests: {
"front page loads"() {
return FunctionalHelpers.openPage(this, url("/"), ".js-hero-title")
.findByCssSelector(".js-hero-title")
.getVisibleText()
.then(function(text) {
assert.equal(
text.toLowerCase(),
"use strict";
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
const intern = require("intern").default;
const { assert } = intern.getPlugin("chai");
const { registerSuite } = intern.getInterface("object");
const FunctionalHelpers = require("./lib/helpers.js");
var url = function(path) {
return intern.config.siteRoot + path;
};
registerSuite("User Activity (auth)", {
before() {
return FunctionalHelpers.login(this);
},
after() {
return FunctionalHelpers.logout(this);
},
"use strict";
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
const intern = require("intern").default;
const { assert } = intern.getPlugin("chai");
const { registerSuite } = intern.getInterface("object");
const FunctionalHelpers = require("./lib/helpers.js");
var url = function(path) {
return intern.config.siteRoot + path;
};
registerSuite("Issues", {
tests: {
"Issue page loads"() {
return FunctionalHelpers.openPage(this, url("/issues/100"), ".js-Issue")
.findDisplayedByCssSelector(".js-issue-number")
.getVisibleText()
.then(function(text) {
assert.include(text, "#100", "Issue title displayed");
})
"use strict";
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
const intern = require("intern").default;
const { assert } = intern.getPlugin("chai");
const { registerSuite } = intern.getInterface("object");
const FunctionalHelpers = require("./lib/helpers.js");
var url = path => intern.config.siteRoot + path;
registerSuite("Comments (auth)", {
before() {
return FunctionalHelpers.login(this);
},
after() {
return FunctionalHelpers.logout(this);
},
tests: {
"Comments form visible when logged in"() {
"use strict";
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
const intern = require("intern").default;
const { assert } = intern.getPlugin("chai");
const { registerSuite } = intern.getInterface("object");
const FunctionalHelpers = require("./lib/helpers.js");
const path = require("path");
var cwd = intern.config.basePath;
var VALID_IMAGE_PATH = path.join(cwd, "tests/fixtures", "green_square.png");
// DETAILS_STRING is a URL encoded object, stringified to JSON.
var DETAILS_STRING =
'{"gfx.webrender.all"%3Afalse%2C"gfx.webrender.blob-images"%3A2%2C"gfx.webrender.enabled"%3Afalse%2C"image.mem.shared"%3A2%2C"layout.css.servo.enabled"%3Atrue}';
var url = function(path) {
return intern.config.siteRoot + path;
};
registerSuite("Reporting (non-auth)", {
tests: {
"use strict";
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
const intern = require("intern").default;
const { assert } = intern.getPlugin("chai");
const { registerSuite } = intern.getInterface("object");
const FunctionalHelpers = require("./lib/helpers.js");
var url = function(path) {
return intern.config.siteRoot + path;
};
registerSuite("History navigation", {
tests: {
"Back button works from issues page"() {
return (
FunctionalHelpers.openPage(this, url("/"), ".js-issues-link")
.findByCssSelector(".js-issues-link")
.click()
.end()
// check that the page is loaded
"use strict";
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
const intern = require("intern").default;
const { assert } = intern.getPlugin("chai");
const { registerSuite } = intern.getInterface("object");
const FunctionalHelpers = require("./lib/helpers.js");
var url = function(path, params) {
var fullUrl =
params !== undefined
? intern.config.siteRoot + path + params
: intern.config.siteRoot + path;
return fullUrl;
};
registerSuite("Search (auth)", {
before() {
return FunctionalHelpers.login(this);
},
"use strict";
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
const intern = require("intern").default;
const { assert } = intern.getPlugin("chai");
const { registerSuite } = intern.getInterface("object");
const FunctionalHelpers = require("./lib/helpers.js");
var url = function(path) {
return intern.config.siteRoot + path;
};
registerSuite("Milestones (non-auth)", {
tests: {
"Page loads without milestone set": function() {
return FunctionalHelpers.openPage(
this,
url("/issues/9"),
".js-Issue",
true /* longerTimeout */
)
"use strict";
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
const intern = require("intern").default;
const { assert } = intern.getPlugin("chai");
const { registerSuite } = intern.getInterface("object");
const FunctionalHelpers = require("./lib/helpers.js");
var url = function(path, params) {
var base = intern.config.siteRoot + path;
return params ? base + params : base;
};
registerSuite("Search (non-auth)", {
tests: {
"Pressing g inside of search input *doesnt* go to github issues"() {
return (
FunctionalHelpers.openPage(this, url("/issues"), "#js-SearchForm-input")
.findByCssSelector("#js-SearchForm-input")
.click()
.type("g")
"use strict";
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/*global WindowHelpers:true*/
const intern = require("intern").default;
const { assert } = intern.getPlugin("chai");
const { registerSuite } = intern.getInterface("object");
const FunctionalHelpers = require("./lib/helpers.js");
const url = intern.config.siteRoot + "/issues/new";
// This string is executed by calls to `execute()` in various tests
// it postMessages a small green test square.
const POSTMESSAGE_TEST_SQUARE =
'postMessage("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAAZCAIAAABLixI0AAAACXBIWXMAAA7DAAAOwwHHb6hkAAAAB3RJTUUH3gYSAig452t/EQAAAClJREFUOMvtzkENAAAMg0A25ZU+E032AQEXoNcApCGFLX5paWlpaWl9dqq9AS6CKROfAAAAAElFTkSuQmCC", "http://localhost:5000")';
registerSuite("Image Uploads (non-auth)", {
tests: {
"postMessaged dataURI preview"() {
return (
FunctionalHelpers.openPage(this, url, ".js-image-upload")
// send a small base64 encoded green test square