summaryrefslogtreecommitdiffstats
path: root/devtools/client/webide/test/test_build.html
diff options
context:
space:
mode:
authorJeroen Vreeken <jeroen@vreeken.net>2019-07-18 11:02:12 +0200
committerJeroen Vreeken <jeroen@vreeken.net>2019-07-18 11:02:12 +0200
commitf820636a8300b44751750354a01be21895b4b536 (patch)
treeab217ad50a145a8c7a1094fbafd5d3d30260e7cd /devtools/client/webide/test/test_build.html
parent6b6aa59ffc97ac76b4429db38eedac8474f5fda7 (diff)
parent45cb5ab7291f44d3e06de4e71e5b0a9e80f6a0b6 (diff)
downloadUXP-f820636a8300b44751750354a01be21895b4b536.tar
UXP-f820636a8300b44751750354a01be21895b4b536.tar.gz
UXP-f820636a8300b44751750354a01be21895b4b536.tar.lz
UXP-f820636a8300b44751750354a01be21895b4b536.tar.xz
UXP-f820636a8300b44751750354a01be21895b4b536.zip
Merge branch 'master' of github.com:JeroenVreeken/UXP
Diffstat (limited to 'devtools/client/webide/test/test_build.html')
-rw-r--r--devtools/client/webide/test/test_build.html128
1 files changed, 0 insertions, 128 deletions
diff --git a/devtools/client/webide/test/test_build.html b/devtools/client/webide/test/test_build.html
deleted file mode 100644
index ffb01998c..000000000
--- a/devtools/client/webide/test/test_build.html
+++ /dev/null
@@ -1,128 +0,0 @@
-<!DOCTYPE html>
-
-<html>
-
- <head>
- <meta charset="utf8">
- <title></title>
-
- <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
- <script type="application/javascript" src="chrome://mochikit/content/chrome-harness.js"></script>
- <script type="application/javascript;version=1.8" src="head.js"></script>
- <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
- </head>
-
- <body>
-
- <script type="application/javascript;version=1.8">
- window.onload = function() {
- SimpleTest.waitForExplicitFinish();
-
- let {TextDecoder, OS} = Cu.import("resource://gre/modules/osfile.jsm", {});
- let {ProjectBuilding} = require("devtools/client/webide/modules/build");
-
- Task.spawn(function* () {
- let win = yield openWebIDE();
- let winProject = getProjectWindow(win);
- let AppManager = win.AppManager;
-
- function isProjectMarkedAsValid() {
- let details = win.frames[0];
- return !details.document.body.classList.contains("error");
- }
-
- // # Test first package.json like this: `{webide: {prepackage: "command line string"}}`
- let platform = Services.appShell.hiddenDOMWindow.navigator.platform;
- let testSuffix = "";
- if (platform.indexOf("Win") != -1) {
- testSuffix = "_windows";
- }
-
- let packagedAppLocation = getTestFilePath("build_app" + testSuffix + "1");
-
- let onValidated = waitForUpdate(win, "project-validated");
- let onDetails = waitForUpdate(win, "details");
- yield winProject.projectList.importPackagedApp(packagedAppLocation);
- yield onValidated;
- yield onDetails;
-
- let project = win.AppManager.selectedProject;
-
- ok(!project.manifest, "manifest includes name");
- is(project.name, "--", "Display name uses manifest name");
-
- let loggedMessages = [];
- let logger = function (msg) {
- loggedMessages.push(msg);
- }
-
- yield ProjectBuilding.build({
- project,
- logger
- });
- let packageDir = yield ProjectBuilding.getPackageDir(project);
- is(packageDir, packagedAppLocation, "no custom packagedir");
- is(loggedMessages[0], "start", "log messages are correct");
- ok(loggedMessages[1].indexOf("Running pre-package hook") != -1, "log messages are correct");
- is(loggedMessages[2], "Terminated with error code: 0", "log messages are correct");
- is(loggedMessages[3], "succeed", "log messages are correct");
-
- // Trigger validation
- yield AppManager.validateAndUpdateProject(AppManager.selectedProject);
- yield nextTick();
-
- ok("name" in project.manifest, "manifest includes name");
- is(project.name, "hello", "Display name uses manifest name");
- is(project.manifest.name, project.name, "Display name uses manifest name");
-
- yield OS.File.remove(OS.Path.join(packagedAppLocation, "manifest.webapp"));
-
- // # Now test a full featured package.json
- packagedAppLocation = getTestFilePath("build_app" + testSuffix + "2");
-
- onValidated = waitForUpdate(win, "project-validated");
- onDetails = waitForUpdate(win, "details");
- yield winProject.projectList.importPackagedApp(packagedAppLocation);
- yield onValidated;
- yield onDetails;
-
- project = win.AppManager.selectedProject;
-
- loggedMessages = [];
- yield ProjectBuilding.build({
- project,
- logger
- });
- packageDir = yield ProjectBuilding.getPackageDir(project);
- is(OS.Path.normalize(packageDir),
- OS.Path.join(packagedAppLocation, "stage"), "custom packagedir");
- is(loggedMessages[0], "start", "log messages are correct");
- ok(loggedMessages[1].indexOf("Running pre-package hook") != -1, "log messages are correct");
- is(loggedMessages[2], "Terminated with error code: 0", "log messages are correct");
- is(loggedMessages[3], "succeed", "log messages are correct");
-
- // Switch to the package dir in order to verify the generated webapp.manifest
- onValidated = waitForUpdate(win, "project-validated");
- onDetails = waitForUpdate(win, "details");
- yield winProject.projectList.importPackagedApp(packageDir);
- yield onValidated;
- yield onDetails;
-
- project = win.AppManager.selectedProject;
-
- ok("name" in project.manifest, "manifest includes name");
- is(project.name, "world", "Display name uses manifest name");
- is(project.manifest.name, project.name, "Display name uses manifest name");
-
- yield closeWebIDE(win);
-
- yield removeAllProjects();
-
- SimpleTest.finish();
- });
- }
-
-
- </script>
- </body>
-</html>