mirror of
https://github.com/usebruno/bruno.git
synced 2026-06-16 04:11:29 +00:00
chore: reduce ux conflicts with toasts in playwright (#6367)
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import React from 'react';
|
||||
import { Toaster } from 'react-hot-toast';
|
||||
import { useTheme } from 'providers/Theme';
|
||||
import { isPlaywright } from 'utils/common';
|
||||
|
||||
export const ToastContext = React.createContext();
|
||||
|
||||
@@ -8,7 +9,7 @@ export const ToastProvider = (props) => {
|
||||
const { storedTheme } = useTheme();
|
||||
|
||||
const toastOptions = {
|
||||
duration: 2000,
|
||||
duration: isPlaywright() ? 500 : 2000,
|
||||
style: {
|
||||
// Break long word like file-path, URL etc. to prevent overflow
|
||||
overflowWrap: 'anywhere'
|
||||
|
||||
@@ -5,6 +5,10 @@ import fastJsonFormat from 'fast-json-format';
|
||||
import { format, applyEdits } from 'jsonc-parser';
|
||||
import { patternHasher } from '@usebruno/common/utils';
|
||||
|
||||
export const isPlaywright = () => {
|
||||
return typeof window !== 'undefined' && window.isPlaywright === true;
|
||||
};
|
||||
|
||||
// a customized version of nanoid without using _ and -
|
||||
export const uuid = () => {
|
||||
// https://github.com/ai/nanoid/blob/main/url-alphabet/index.js
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
const { ipcRenderer, contextBridge, webUtils, shell } = require('electron');
|
||||
|
||||
contextBridge.exposeInMainWorld('isPlaywright', process.env.PLAYWRIGHT === 'true');
|
||||
|
||||
contextBridge.exposeInMainWorld('ipcRenderer', {
|
||||
invoke: (channel, ...args) => ipcRenderer.invoke(channel, ...args),
|
||||
send: (channel, ...args) => ipcRenderer.send(channel, ...args),
|
||||
|
||||
@@ -90,6 +90,7 @@ export const test = baseTest.extend<
|
||||
...process.env,
|
||||
ELECTRON_USER_DATA_PATH: userDataPath,
|
||||
DISABLE_SAMPLE_COLLECTION_IMPORT: 'true',
|
||||
PLAYWRIGHT: 'true',
|
||||
...dotEnv
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user