Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
/* 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/. */
"use strict";
const args = require("yargs").argv;
const intern = require("intern").default;
const siteRoot = args.siteRoot ? args.siteRoot : "http://localhost:5000";
let environments = [];
const browsers = args.browsers
? args.browsers.replace(/\s/g, "").split(",")
: ["firefox", "chrome"];
browsers.forEach(function(b) {
if (b.toLowerCase() === "chrome") {
environments.push({
browserName: b.toLowerCase(),
chromeOptions: {
args: ["headless", "disable-gpu"]
}
});
"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")
"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("Issue-list", {
tests: {
"FilterView renders"() {
return FunctionalHelpers.openPage(
this,
url("/issues"),
".js-SearchIssue-filter"
"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 (non-auth)", {
tests: {
"Trying to view someone else's activity fails (logged out)"() {
return FunctionalHelpers.openPage(
this,
url("/activity/someoneelse"),
"article"
)
/* 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 http = require("http");
var url = function(path, params) {
var base = intern.config.siteRoot + path;
return params ? base + params : base;
};
/*
This method makes a call to our API and
checks that the server is returning fixture data,
it will also check if there's anything wrong with the server.
*/
intern.registerPlugin("checkServer", function() {
return new Promise(function(resolve, reject) {
var request = http.get(url("/api/issues/100"), function(response) {
"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)", {
"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(
"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: {
"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 (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("New Issue Page", {
tests: {
"new issue page loads"() {
return FunctionalHelpers.openPage(
this,
url("/issues/new"),
".js-Navbar-link"
)