-
Notifications
You must be signed in to change notification settings - Fork 672
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Avoid password saving bubble in Firefox Fix concurrently mode for Firefox on macOS
- Loading branch information
1 parent
e7dee93
commit eec4474
Showing
4 changed files
with
52 additions
and
20 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
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,38 @@ | ||
import Promise from 'pinkie'; | ||
import OS from 'os-family'; | ||
import browserTools from 'testcafe-browser-tools'; | ||
import delay from '../../../utils/delay'; | ||
|
||
|
||
const POST_OPERATION_DELAY = 500; | ||
|
||
class OperationsQueue { | ||
constructor () { | ||
this.chainPromise = Promise.resolve(); | ||
} | ||
|
||
executeOperation (operation) { | ||
var operationPromise = this.chainPromise.then(operation); | ||
|
||
this.chainPromise = operationPromise.then(() => delay(POST_OPERATION_DELAY)); | ||
|
||
return operationPromise; | ||
} | ||
} | ||
|
||
export default class BrowserStarter { | ||
constructor () { | ||
// NOTE: You can't start multiple instances of the same app at the same time on macOS. | ||
// That's why a queue of opening requests is needed. | ||
this.macOSBrowserOpeningQueue = new OperationsQueue(); | ||
} | ||
|
||
async startBrowser (...openArgs) { | ||
const openBrowserOperation = () => browserTools.open(...openArgs); | ||
|
||
if (OS.mac) | ||
await this.macOSBrowserOpeningQueue.executeOperation(openBrowserOperation); | ||
else | ||
await openBrowserOperation(); | ||
} | ||
} |