|
1 | 1 | /* global describe, it, before */
|
2 | 2 |
|
3 | 3 | const Brave = require('../lib/brave')
|
| 4 | +const assert = require('assert') |
| 5 | +const messages = require('../../js/constants/messages') |
4 | 6 | const {urlInput, autofillAddressPanel, autofillCreditCardPanel} = require('../lib/selectors')
|
5 | 7 | const {getTargetAboutUrl} = require('../../js/lib/appUrlUtil')
|
6 | 8 |
|
@@ -253,4 +255,63 @@ describe('Autofill', function () {
|
253 | 255 | .waitForVisible('[data-l10n-id=noCreditCardsSaved]')
|
254 | 256 | })
|
255 | 257 | })
|
| 258 | + |
| 259 | + describe('prevent autocomplete data leak from private to regular', function () { |
| 260 | + Brave.beforeAll(this) |
| 261 | + const url = 'https://yoast.com/research/autocompletetype.php' |
| 262 | + before(function * () { |
| 263 | + yield setup(this.app.client) |
| 264 | + }) |
| 265 | + it('submit form on regular', function * () { |
| 266 | + yield this.app.client |
| 267 | + .ipcSend(messages.SHORTCUT_NEW_FRAME, url) |
| 268 | + .waitForUrl(url) |
| 269 | + .windowByUrl(Brave.browserWindowUrl) |
| 270 | + .waitForExist('.tab[data-frame-key="2"]') |
| 271 | + .waitForVisible('webview[partition="persist:default"]') |
| 272 | + .tabByUrl(this.url) |
| 273 | + .setValue('[x-autocompletetype="name"]', 'bravery') |
| 274 | + .click('[value="Submit your name"]') |
| 275 | + .loadUrl(url) |
| 276 | + .click('[x-autocompletetype="name"]') |
| 277 | + .keys('b') |
| 278 | + .windowByUrl(Brave.browserWindowUrl) |
| 279 | + let item = yield this.app.client.getText('.contextMenuItemText') |
| 280 | + assert.equal(item, 'bravery') |
| 281 | + yield this.app.client.setContextMenuDetail() |
| 282 | + }) |
| 283 | + it('submit form on private', function * () { |
| 284 | + yield this.app.client |
| 285 | + .ipcSend(messages.SHORTCUT_NEW_FRAME, url, { isPrivate: true }) |
| 286 | + .waitForUrl(url) |
| 287 | + .windowByUrl(Brave.browserWindowUrl) |
| 288 | + .waitForExist('.tab.private[data-frame-key="3"]') |
| 289 | + .waitForVisible('webview[partition="default"]') |
| 290 | + .tabByUrl(this.url) |
| 291 | + .setValue('[x-autocompletetype="name"]', 'bravery2') |
| 292 | + .click('[value="Submit your name"]') |
| 293 | + .loadUrl(url) |
| 294 | + .click('[x-autocompletetype="name"]') |
| 295 | + .keys('b') |
| 296 | + .windowByUrl(Brave.browserWindowUrl) |
| 297 | + let item = yield this.app.client.getText('.contextMenuItemText') |
| 298 | + assert.equal(item, 'bravery') |
| 299 | + yield this.app.client.setContextMenuDetail() |
| 300 | + }) |
| 301 | + it('check on regular', function * () { |
| 302 | + yield this.app.client |
| 303 | + .ipcSend(messages.SHORTCUT_NEW_FRAME, url) |
| 304 | + .waitForUrl(url) |
| 305 | + .windowByUrl(Brave.browserWindowUrl) |
| 306 | + .waitForExist('.tab[data-frame-key="4"]') |
| 307 | + .waitForVisible('webview[partition="persist:default"]') |
| 308 | + .tabByUrl(this.url) |
| 309 | + .click('[x-autocompletetype="name"]') |
| 310 | + .keys('b') |
| 311 | + .windowByUrl(Brave.browserWindowUrl) |
| 312 | + let item = yield this.app.client.getText('.contextMenuItemText') |
| 313 | + assert.equal(item, 'bravery') |
| 314 | + yield this.app.client.setContextMenuDetail() |
| 315 | + }) |
| 316 | + }) |
256 | 317 | })
|
0 commit comments