Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Remote Debug tools do not work - fixes #1556
- Loading branch information
1 parent
f89aa04
commit a6d39e6
Showing
6 changed files
with
98 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
describe('UI', function () { | ||
context('Remote Debugger', function () { | ||
it('adds an element, in the way the UI does', function () { | ||
cy.visit(Cypress.env('BS_URL')); | ||
cy.get('#__bs_notify__').should('have.length', 1); | ||
cy.request('POST', `${Cypress.env('BS_URL')}/__browser_sync__`, | ||
JSON.stringify(["ui:element:add", | ||
{ | ||
"src": "/browser-sync/pesticide.css", | ||
"active": true, | ||
"hidden": "", | ||
"name": "pesticide", | ||
"tagline": "Add simple CSS outlines to all elements. (powered by <a href=\"http://pesticide.io\" target=\"_blank\">Pesticide.io</a>)", | ||
"context": "remote-debug", | ||
"served": true, | ||
"title": "CSS Outlining", | ||
"type": "css", | ||
"id": "__browser-sync-pesticide__", | ||
"file": "/Users/shakyshane/sites/oss/browser-sync/node_modules/browser-sync-ui/lib/plugins/remote-debug/css/pesticide.min.css" | ||
} | ||
]) | ||
).then(res => { | ||
console.log(res); | ||
}); | ||
cy.get('[id="__browser-sync-pesticide__"]').should('have.length', 1); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,35 @@ | ||
module.exports = function(setup, specs) { | ||
const cypress = require('cypress'); | ||
const exec = require('child_process'); | ||
const assert = require('assert'); | ||
const {join} = require('path'); | ||
const {Observable} = require('rxjs/Observable'); | ||
|
||
const cypress = require('cypress'); | ||
const bs = require('../../').create(); | ||
module.exports = function(opts, ctx) { | ||
|
||
bs.init(setup, function(err, bs) { | ||
return cypress.run({ | ||
spec: specs, | ||
env: `BS_URL=${bs.options.getIn(['urls', 'local'])}` | ||
}) | ||
.then((results) => { | ||
// stop your server when it's complete | ||
bs.cleanup(); | ||
if (results.failures > 0) { | ||
return process.exit(1); | ||
} | ||
process.exit(0); | ||
assert.ok(typeof opts.config === 'string', '`opts.config` should be a string'); | ||
assert.ok(typeof opts.spec === 'string', '`opts.spec` should be a string'); | ||
assert.ok((opts.action === 'run' || opts.action === 'open'), '`action` should be either run or open'); | ||
|
||
const json = require(join(ctx.config.cwd, opts.config)); | ||
|
||
return Observable.create(obs => { | ||
const bs = require('../../').create(); | ||
const instance = bs.init(json, function(err, bs) { | ||
if (err) { | ||
return obs.error(err); | ||
} | ||
return cypress[opts.action]({ | ||
spec: opts.spec, | ||
env: `BS_URL=${bs.options.getIn(['urls', 'local'])},BS_UI_URL=${bs.options.getIn(['urls', 'ui'])}` | ||
}) | ||
.then((results) => { | ||
// stop your server when it's complete | ||
if (results.failures > 0) { | ||
return obs.error(new Error('Errors occurred')); | ||
} | ||
instance.cleanup(); | ||
obs.complete(); | ||
}) | ||
}); | ||
}); | ||
}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters