-
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.
Merge pull request #87 from joomcode/fix/mobile-emulation
fix: mobile emulation
- Loading branch information
Showing
36 changed files
with
340 additions
and
301 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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,36 +1,31 @@ | ||
import {LogEventStatus, LogEventType} from '../constants/internal'; | ||
import {getConsoleMessagesFromContext} from '../context/consoleMessages'; | ||
import {log} from '../utils/log'; | ||
|
||
type ConsoleMessages = Readonly<{ | ||
error: readonly string[]; | ||
info: readonly string[]; | ||
log: readonly string[]; | ||
warn: readonly string[]; | ||
}>; | ||
import type {ConsoleMessage} from '../types/internal'; | ||
|
||
type Options = Readonly<{ | ||
showMessagesInLog?: boolean; | ||
}>; | ||
|
||
const logMessage = 'Get browser console messages'; | ||
|
||
/** | ||
* Returns an object that contains messages output to the browser console. | ||
*/ | ||
export const getBrowserConsoleMessages = (options: Options = {}): Promise<ConsoleMessages> => { | ||
export const getBrowserConsoleMessages = (options: Options = {}): readonly ConsoleMessage[] => { | ||
const {showMessagesInLog = false} = options; | ||
const consoleMessages = getConsoleMessagesFromContext(); | ||
|
||
if (showMessagesInLog === false) { | ||
log('Get browser console messages', LogEventType.InternalAction); | ||
log(logMessage, LogEventType.InternalAction); | ||
} else { | ||
const logEventStatus = consoleMessages.some(({type}) => type === 'error') | ||
? LogEventStatus.Failed | ||
: LogEventStatus.Passed; | ||
|
||
// TODO | ||
return Promise.resolve({error: [], info: [], log: [], warn: []}); | ||
log(logMessage, {consoleMessages, logEventStatus}, LogEventType.InternalAction); | ||
} | ||
|
||
return Promise.resolve({error: [], info: [], log: [], warn: []}).then((messages) => { | ||
const logEventStatus = | ||
messages.error.length > 0 ? LogEventStatus.Failed : LogEventStatus.Passed; | ||
|
||
log('Got browser console messages', {logEventStatus, messages}, LogEventType.InternalAction); | ||
|
||
return messages; | ||
}); | ||
return consoleMessages; | ||
}; |
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,30 +1,25 @@ | ||
import {LogEventStatus, LogEventType} from '../constants/internal'; | ||
import {getJsErrorsFromContext} from '../context/jsError'; | ||
import {log} from '../utils/log'; | ||
|
||
import type {BrowserJsError} from '../types/internal'; | ||
|
||
type Options = Readonly<{ | ||
showErrorsInLog?: boolean; | ||
}>; | ||
|
||
/** | ||
* Get browser JS errors. | ||
*/ | ||
export const getBrowserJsErrors = (options: Options = {}): Promise<readonly BrowserJsError[]> => { | ||
export const getBrowserJsErrors = (options: Options = {}): readonly Error[] => { | ||
const {showErrorsInLog = false} = options; | ||
const jsErrors = getJsErrorsFromContext(); | ||
|
||
if (showErrorsInLog === false) { | ||
log('Get browser JS errors', LogEventType.InternalAction); | ||
|
||
return Promise.resolve([]); | ||
} | ||
|
||
// TODO | ||
return Promise.resolve([]).then((jsErrors = []) => { | ||
} else { | ||
const logEventStatus = jsErrors.length > 0 ? LogEventStatus.Failed : LogEventStatus.Passed; | ||
|
||
log('Got browser JS errors', {jsErrors, logEventStatus}, LogEventType.InternalAction); | ||
} | ||
|
||
return jsErrors; | ||
}); | ||
return jsErrors; | ||
}; |
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,14 @@ | ||
import {LogEventType} from '../constants/internal'; | ||
import {getPlaywrightPage} from '../useContext'; | ||
import {log} from '../utils/log'; | ||
|
||
/** | ||
* Pauses the test and switches to the step-by-step execution mode. | ||
*/ | ||
export const pause = (): Promise<void> => { | ||
log('Pause', LogEventType.InternalAction); | ||
|
||
const page = getPlaywrightPage(); | ||
|
||
return page.pause(); | ||
}; |
Oops, something went wrong.