forked from DevExpress/testcafe
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
…#2180) (DevExpress#2224) * Fix some issues in Firefox (closes DevExpress#2035, closes DevExpress#2180) Avoid password saving bubble in Firefox Fix concurrently mode for Firefox on macOS * Fix missing await
- Loading branch information
1 parent
b28bfea
commit 0818439
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) { | ||
const 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(); | ||
} | ||
} |