From b2b32d03c4308e7cb8f1508cf03bf194527fdc20 Mon Sep 17 00:00:00 2001 From: Shin'ya Ueoka Date: Mon, 22 Jan 2018 21:24:49 +0900 Subject: install web-ext --- package.json | 1 + 1 file changed, 1 insertion(+) (limited to 'package.json') diff --git a/package.json b/package.json index 6395a21..1391496 100644 --- a/package.json +++ b/package.json @@ -43,6 +43,7 @@ "preact": "^8.2.6", "sass-loader": "^6.0.6", "style-loader": "^0.19.0", + "web-ext": "github:ueokande/web-ext#patched-2.3.2", "webpack": "^3.5.3" } } -- cgit v1.2.3 From 8ff200755f6b3661c405b14fe1ff6dc5b0f17dbd Mon Sep 17 00:00:00 2001 From: Shin'ya Ueoka Date: Sun, 4 Feb 2018 17:44:40 +0900 Subject: add ambassador extension --- .gitignore | 1 + e2e/ambassador/src/background/index.js | 0 e2e/ambassador/src/content/index.js | 0 e2e/ambassador/webpack.config.js | 37 ++++++++++++++++++++++++++++++++++ package.json | 4 +++- 5 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 e2e/ambassador/src/background/index.js create mode 100644 e2e/ambassador/src/content/index.js create mode 100644 e2e/ambassador/webpack.config.js (limited to 'package.json') diff --git a/.gitignore b/.gitignore index 2515a99..07d22c4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /node_modules/ /build/ +/e2e/ambassador/build/ *.zip diff --git a/e2e/ambassador/src/background/index.js b/e2e/ambassador/src/background/index.js new file mode 100644 index 0000000..e69de29 diff --git a/e2e/ambassador/src/content/index.js b/e2e/ambassador/src/content/index.js new file mode 100644 index 0000000..e69de29 diff --git a/e2e/ambassador/webpack.config.js b/e2e/ambassador/webpack.config.js new file mode 100644 index 0000000..2a544bf --- /dev/null +++ b/e2e/ambassador/webpack.config.js @@ -0,0 +1,37 @@ +const path = require('path'); + +const src = path.resolve(__dirname, 'src'); +const dist = path.resolve(__dirname, 'build'); + +config = { + entry: { + content: path.join(src, 'content'), + background: path.join(src, 'background') + }, + + output: { + path: dist, + filename: '[name].js' + }, + + module: { + loaders: [ + { + test: [ /\.js$/ ], + exclude: /node_modules/, + loader: 'babel-loader', + query: { + presets: ['es2015'] + } + } + ] + }, + + resolve: { + extensions: [ '.js' ], + modules: [path.join(__dirname, 'src'), 'node_modules'] + } +}; + +module.exports = config + diff --git a/package.json b/package.json index 1391496..0a48e3a 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,9 @@ "build": "NODE_ENV=production webpack --progress --display-error-details", "package": "npm run build && script/package.sh", "lint": "eslint --ext .jsx,.js src", - "test": "karma start" + "test": "karma start", + "ambassador:start": "webpack -w --debug --context --devtool inline-source-map", + "ambassador:build": "webpack --context e2e/ambassador" }, "repository": { "type": "git", -- cgit v1.2.3 From 2362f68fcb1a9994fe6395673b71348660678c7d Mon Sep 17 00:00:00 2001 From: Shin'ya Ueoka Date: Sun, 4 Feb 2018 17:48:18 +0900 Subject: ambassador --- e2e/ambassador/manifest.json | 27 +++++++++++++++++++++++++++ package.json | 2 +- 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 e2e/ambassador/manifest.json (limited to 'package.json') diff --git a/e2e/ambassador/manifest.json b/e2e/ambassador/manifest.json new file mode 100644 index 0000000..9f3e063 --- /dev/null +++ b/e2e/ambassador/manifest.json @@ -0,0 +1,27 @@ +{ + "manifest_version": 2, + "name": "ambassador", + "description": "WebExtension test helper", + "version": "0.1", + "content_scripts": [ + { + "all_frames": true, + "matches": [ "" ], + "js": [ "build/content.js" ], + "run_at": "document_end", + "match_about_blank": true + } + ], + "background": { + "scripts": [ + "build/background.js" + ] + }, + "permissions": [ + "history", + "sessions", + "storage", + "tabs", + "clipboardRead" + ] +} diff --git a/package.json b/package.json index 0a48e3a..6e1ad2c 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "package": "npm run build && script/package.sh", "lint": "eslint --ext .jsx,.js src", "test": "karma start", - "ambassador:start": "webpack -w --debug --context --devtool inline-source-map", + "ambassador:start": "webpack -w --debug --context e2e/ambassador --devtool inline-source-map", "ambassador:build": "webpack --context e2e/ambassador" }, "repository": { -- cgit v1.2.3 From b26d027ce8326d5c233a3295c98b2147bda49727 Mon Sep 17 00:00:00 2001 From: Shin'ya Ueoka Date: Sun, 4 Feb 2018 17:50:48 +0900 Subject: add test:e2e --- e2e/karma.conf.js | 41 +++++++++++++++++++++++++++++++++++++++++ package.json | 1 + 2 files changed, 42 insertions(+) create mode 100644 e2e/karma.conf.js (limited to 'package.json') diff --git a/e2e/karma.conf.js b/e2e/karma.conf.js new file mode 100644 index 0000000..259eb17 --- /dev/null +++ b/e2e/karma.conf.js @@ -0,0 +1,41 @@ +module.exports = function (config) { + + config.set({ + basePath: '', + frameworks: ['mocha'], + files: [ + '**/*.test.js' + ], + + preprocessors: { + '**/*.test.js': ['webpack'] + }, + + port: 9876, + colors: true, + logLevel: config.LOG_INFO, + + customLaunchers: { + FirefoxWebExtRunner: { + base: 'FirefoxWebExt', + sourceDirs: [ '.', 'e2e/ambassador'], + }, + }, + browsers: ['FirefoxWebExtRunner'], + sauceLabs: { + username: 'michael_jackson' + }, + + singleRun: true, + + webpackMiddleware: { + noInfo: true + }, + + plugins: [ + require('./karma-webext-launcher'), + 'karma-mocha', + 'karma-webpack', + ], + }) +} diff --git a/package.json b/package.json index 6e1ad2c..f3ded13 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,7 @@ "package": "npm run build && script/package.sh", "lint": "eslint --ext .jsx,.js src", "test": "karma start", + "test:e2e": "karma start e2e/karma.conf.js", "ambassador:start": "webpack -w --debug --context e2e/ambassador --devtool inline-source-map", "ambassador:build": "webpack --context e2e/ambassador" }, -- cgit v1.2.3 From 4e4c1affb626d955121821779da5483a17787e0d Mon Sep 17 00:00:00 2001 From: Shin'ya Ueoka Date: Sun, 4 Feb 2018 18:32:26 +0900 Subject: ambassador --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'package.json') diff --git a/package.json b/package.json index f3ded13..d2ecd11 100644 --- a/package.json +++ b/package.json @@ -8,8 +8,8 @@ "lint": "eslint --ext .jsx,.js src", "test": "karma start", "test:e2e": "karma start e2e/karma.conf.js", - "ambassador:start": "webpack -w --debug --context e2e/ambassador --devtool inline-source-map", - "ambassador:build": "webpack --context e2e/ambassador" + "ambassador:start": "webpack -w --debug --context e2e/ambassador --config e2e/ambassador/webpack.config.js --devtool inline-source-map", + "ambassador:build": "webpack --context e2e/ambassador --config e2e/ambassador/webpack.config.js" }, "repository": { "type": "git", -- cgit v1.2.3 From 2a04298ad1c470c160de05f96f3d7a87d8ea039e Mon Sep 17 00:00:00 2001 From: Shin'ya Ueoka Date: Sun, 4 Feb 2018 19:13:56 +0900 Subject: add lint target --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'package.json') diff --git a/package.json b/package.json index d2ecd11..9977b10 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "start": "webpack -w --debug --devtool inline-source-map", "build": "NODE_ENV=production webpack --progress --display-error-details", "package": "npm run build && script/package.sh", - "lint": "eslint --ext .jsx,.js src", + "lint": "eslint --ext .jsx,.js src e2e/ambassador/src", "test": "karma start", "test:e2e": "karma start e2e/karma.conf.js", "ambassador:start": "webpack -w --debug --context e2e/ambassador --config e2e/ambassador/webpack.config.js --devtool inline-source-map", -- cgit v1.2.3