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.
Overhaul t.resizeWindow and implement t.maximizeWindow (closes DevExp…
…ress#816, closes DevExpress#812) (DevExpress#837) * Show error is the requested size is too big on Mac * Implement t.maximize
- Loading branch information
1 parent
571d25f
commit f33c166
Showing
29 changed files
with
525 additions
and
254 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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
import PathBrowserProvider from './path'; | ||
import LocallyInstalledBrowserProvider from './locally-installed'; | ||
import RemoteBrowserProvider from './remote'; | ||
import pathBrowserProvider from './path'; | ||
import locallyInstalledBrowserProvider from './locally-installed'; | ||
import remoteBrowserProvider from './remote'; | ||
|
||
|
||
export default { | ||
'locally-installed': new LocallyInstalledBrowserProvider(), | ||
'path': new PathBrowserProvider(), | ||
'remote': new RemoteBrowserProvider() | ||
'locally-installed': locallyInstalledBrowserProvider, | ||
'path': pathBrowserProvider, | ||
'remote': remoteBrowserProvider | ||
}; |
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 |
---|---|---|
@@ -1,46 +1,47 @@ | ||
import BrowserProviderBase from './base'; | ||
import OS from 'os-family'; | ||
import { findWindow } from 'testcafe-browser-tools'; | ||
import WARNING_MESSAGE from '../../../warnings/message'; | ||
|
||
|
||
export default class RemoteBrowserProvider extends BrowserProviderBase { | ||
constructor () { | ||
super(); | ||
|
||
// NOTE: This can be used to disable resize correction when running unit tests. | ||
this.disableResizeHack = false; | ||
} | ||
export default { | ||
localBrowsersFlags: {}, | ||
|
||
async openBrowser (browserId) { | ||
try { | ||
if (OS.win && !this.disableResizeHack) | ||
await super.calculateResizeCorrections(browserId); | ||
} | ||
catch (e) { | ||
return; | ||
} | ||
} | ||
await this.waitForConnectionReady(browserId); | ||
|
||
async closeBrowser () { | ||
return; | ||
} | ||
var localBrowserWindow = await findWindow(browserId); | ||
|
||
// NOTE: we must try to do a local screenshot or resize, if browser is accessible, but emit warning | ||
async takeScreenshot (browserId, ...args) { | ||
try { | ||
await super.takeScreenshot(browserId, ...args); | ||
} | ||
catch (e) { | ||
this.reportWarning(browserId, WARNING_MESSAGE.browserManipulationsOnRemoteBrowser); | ||
} | ||
} | ||
this.localBrowsersFlags[browserId] = localBrowserWindow !== null; | ||
}, | ||
|
||
async closeBrowser (browserId) { | ||
delete this.localBrowsersFlags[browserId]; | ||
}, | ||
|
||
async isLocalBrowser (browserId) { | ||
return this.localBrowsersFlags[browserId]; | ||
}, | ||
|
||
// NOTE: we must try to do a local screenshot or resize, if browser is accessible, and emit warning otherwise | ||
async hasCustomActionForBrowser (browserId) { | ||
var isLocalBrowser = this.localBrowsersFlags[browserId]; | ||
|
||
return { | ||
hasResizeWindow: !isLocalBrowser, | ||
hasMaximizeWindow: !isLocalBrowser, | ||
hasTakeScreenshot: !isLocalBrowser, | ||
hasCanResizeWindowToDimensions: !isLocalBrowser | ||
}; | ||
}, | ||
|
||
async takeScreenshot (browserId) { | ||
this.reportWarning(browserId, WARNING_MESSAGE.browserManipulationsOnRemoteBrowser); | ||
}, | ||
|
||
async resizeWindow (browserId) { | ||
this.reportWarning(browserId, WARNING_MESSAGE.browserManipulationsOnRemoteBrowser); | ||
}, | ||
|
||
async resizeWindow (browserId, ...args) { | ||
try { | ||
await super.resizeWindow(browserId, ...args); | ||
} | ||
catch (e) { | ||
this.reportWarning(browserId, WARNING_MESSAGE.browserManipulationsOnRemoteBrowser); | ||
} | ||
async maximizeWindow (browserId) { | ||
this.reportWarning(browserId, WARNING_MESSAGE.browserManipulationsOnRemoteBrowser); | ||
} | ||
} | ||
}; |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.