Add tests for disablewebsecurity (Allow mixed contents)
This commit is contained in:
parent
eda5d56d78
commit
2347d5e299
|
@ -150,7 +150,7 @@ var SettingsPage = React.createClass({
|
||||||
<option value="dark">Dark</option>
|
<option value="dark">Dark</option>
|
||||||
</Input>);
|
</Input>);
|
||||||
}
|
}
|
||||||
options.push(<Input key="inputDisableWebSecurity" ref="disablewebsecurity" type="checkbox" label="Allow mixed content (Enabling allows both secure and insecure content, images and scripts to render and execute. Disabling allows only secure content.)"
|
options.push(<Input key="inputDisableWebSecurity" id="inputDisableWebSecurity" ref="disablewebsecurity" type="checkbox" label="Allow mixed content (Enabling allows both secure and insecure content, images and scripts to render and execute. Disabling allows only secure content.)"
|
||||||
checked={ this.state.disablewebsecurity } onChange={ this.handleChangeDisableWebSecurity } />);
|
checked={ this.state.disablewebsecurity } onChange={ this.handleChangeDisableWebSecurity } />);
|
||||||
//OSX has an option in the Dock, to set the app to autostart, so we choose to not support this option for OSX
|
//OSX has an option in the Dock, to set the app to autostart, so we choose to not support this option for OSX
|
||||||
if (process.platform === 'win32' || process.platform === 'linux') {
|
if (process.platform === 'win32' || process.platform === 'linux') {
|
||||||
|
|
|
@ -11,6 +11,14 @@ function initClient(client) {
|
||||||
.waitUntilWindowLoaded();
|
.waitUntilWindowLoaded();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function addClientCommands(client) {
|
||||||
|
client.addCommand('loadSettingsPage', function() {
|
||||||
|
return this
|
||||||
|
.url('file://' + path.join(env.sourceRootDir, 'dist/browser/settings.html'))
|
||||||
|
.waitUntilWindowLoaded();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
describe('browser/settings.html', function() {
|
describe('browser/settings.html', function() {
|
||||||
this.timeout(10000);
|
this.timeout(10000);
|
||||||
|
|
||||||
|
@ -88,5 +96,50 @@ describe('browser/settings.html', function() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('Allow mixed content', function() {
|
||||||
|
[true, false].forEach(function(v) {
|
||||||
|
it(`should be loaded from config: ${v}`, function() {
|
||||||
|
var new_config = {};
|
||||||
|
Object.assign(new_config, config);
|
||||||
|
new_config.disablewebsecurity = v;
|
||||||
|
fs.writeFileSync(env.configFilePath, JSON.stringify(new_config));
|
||||||
|
return this.app.restart().then(() => {
|
||||||
|
addClientCommands(this.app.client);
|
||||||
|
return this.app.client
|
||||||
|
.getAttribute('.mattermostView', 'disablewebsecurity').then((disablewebsecurity) => {
|
||||||
|
// disablewebsecurity is an array of String
|
||||||
|
disablewebsecurity.forEach((d) => {
|
||||||
|
v.toString().should.equal(d)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.loadSettingsPage()
|
||||||
|
.isSelected('#inputDisableWebSecurity input').should.eventually.equal(v);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
[true, false].forEach(function(v) {
|
||||||
|
it(`should be saved as config.json: ${v}`, function() {
|
||||||
|
return this.app.restart().then(() => {
|
||||||
|
addClientCommands(this.app.client);
|
||||||
|
return this.app.client
|
||||||
|
.loadSettingsPage()
|
||||||
|
.isSelected('#inputDisableWebSecurity input').then((isSelected) => {
|
||||||
|
if (isSelected !== v) {
|
||||||
|
return this.app.client.click('#inputDisableWebSecurity input')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.click('#btnSave')
|
||||||
|
.pause(1000)
|
||||||
|
.then(() => {
|
||||||
|
const saved_config = JSON.parse(fs.readFileSync(env.configFilePath, 'utf8'));
|
||||||
|
saved_config.disablewebsecurity.should.equal(v);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue