Skip to content

Commit bfa9c3f

Browse files
authored
Merge branch 'main' into main
2 parents 14f3136 + 61c09e1 commit bfa9c3f

File tree

9 files changed

+30
-25
lines changed

9 files changed

+30
-25
lines changed

extension/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# remotedev-redux-devtools-extension
22

3+
## 3.2.4
4+
5+
### Patch Changes
6+
7+
- f1d6158: Fix mocking Chrome API for Electron
8+
39
## 3.2.3
410

511
### Patch Changes

extension/chrome/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "3.2.3",
2+
"version": "3.2.4",
33
"name": "Redux DevTools",
44
"description": "Redux DevTools for debugging application's state changes.",
55
"homepage_url": "https://github.com/reduxjs/redux-devtools",

extension/edge/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "3.2.3",
2+
"version": "3.2.4",
33
"name": "Redux DevTools",
44
"description": "Redux DevTools for debugging application's state changes.",
55
"homepage_url": "https://github.com/reduxjs/redux-devtools",

extension/firefox/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "3.2.3",
2+
"version": "3.2.4",
33
"name": "Redux DevTools",
44
"manifest_version": 3,
55
"description": "Redux Developer Tools for debugging application state changes.",

extension/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"private": true,
33
"name": "remotedev-redux-devtools-extension",
4-
"version": "3.2.3",
4+
"version": "3.2.4",
55
"description": "Redux Developer Tools for debugging application state changes.",
66
"homepage": "https://github.com/reduxjs/redux-devtools/tree/master/extension",
77
"license": "MIT",

extension/src/app/Actions.tsx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,7 @@ interface OwnProps {
2929
}
3030
type Props = StateProps & DispatchProps & OwnProps;
3131

32-
declare global {
33-
interface Window {
34-
isElectron?: boolean;
35-
}
36-
}
32+
const isElectron = navigator.userAgent.includes('Electron');
3733

3834
function sendMessage(message: SingleMessage) {
3935
chrome.runtime.sendMessage(message);
@@ -98,7 +94,7 @@ class Actions extends Component<Props> {
9894
<DispatcherButton dispatcherIsOpen={this.props.dispatcherIsOpen} />
9995
)}
10096
<Divider />
101-
{!window.isElectron && (
97+
{!isElectron && (
10298
<Button
10399
onClick={() => {
104100
this.openWindow('window');
@@ -107,7 +103,7 @@ class Actions extends Component<Props> {
107103
<MdOutlineWindow />
108104
</Button>
109105
)}
110-
{!window.isElectron && (
106+
{!isElectron && (
111107
<Button
112108
onClick={() => {
113109
this.openWindow('remote');

extension/src/background/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import '../chromeApiMock';
12
import configureStore from './store/backgroundStore';
23
import openDevToolsWindow, { DevToolsPosition } from './openWindow';
34
import { createMenu, removeMenu } from './contextMenus';

extension/src/chromeApiMock.ts

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
// Mock not supported chrome.* API for Firefox and Electron
22

3-
window.isElectron =
4-
window.navigator && window.navigator.userAgent.indexOf('Electron') !== -1;
5-
6-
const isFirefox = navigator.userAgent.indexOf('Firefox') !== -1;
3+
const isElectron = navigator.userAgent.includes('Electron');
4+
const isFirefox = navigator.userAgent.includes('Firefox');
75

86
// Background page only
97
if (
10-
(window.isElectron &&
11-
location.pathname === '/_generated_background_page.html') ||
8+
(isElectron && location.pathname === '/background.bundle.js') ||
129
isFirefox
1310
) {
1411
(chrome.runtime as any).onConnectExternal = {
@@ -18,7 +15,7 @@ if (
1815
addListener() {},
1916
};
2017

21-
if (window.isElectron) {
18+
if (isElectron) {
2219
(chrome.notifications as any) = {
2320
onClicked: {
2421
addListener() {},
@@ -31,6 +28,11 @@ if (
3128
addListener() {},
3229
},
3330
};
31+
(chrome.commands as any) = {
32+
onCommand: {
33+
addListener() {},
34+
},
35+
};
3436
} else {
3537
(chrome.storage as any).sync = chrome.storage.local;
3638
(chrome.runtime as any).onInstalled = {
@@ -39,7 +41,7 @@ if (
3941
}
4042
}
4143

42-
if (window.isElectron) {
44+
if (isElectron) {
4345
if (!chrome.storage.local || !chrome.storage.local.remove) {
4446
(chrome.storage as any).local = {
4547
set(obj: any, callback: any) {
@@ -87,6 +89,6 @@ if (window.isElectron) {
8789
};
8890
}
8991

90-
if (isFirefox || window.isElectron) {
92+
if (isFirefox || isElectron) {
9193
(chrome.storage as any).sync = chrome.storage.local;
9294
}

extension/test/electron/devpanel.spec.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import chromedriver from 'chromedriver';
66
import { switchMonitorTests, delay } from '../utils/e2e';
77

88
const devPanelPath =
9-
'chrome-extension://lmhkpmbekcpmknklioeibfkpmmfibljd/window.html';
9+
'chrome-extension://lmhkpmbekcpmknklioeibfkpmmfibljd/devpanel.html';
1010

1111
describe('DevTools panel for Electron', function () {
1212
let driver;
@@ -76,7 +76,7 @@ describe('DevTools panel for Electron', function () {
7676
expect(className).not.toMatch(/hidden/); // not hidden
7777
});
7878

79-
it.skip('should have Redux DevTools UI on current tab', async () => {
79+
it('should have Redux DevTools UI on current tab', async () => {
8080
await driver
8181
.switchTo()
8282
.frame(
@@ -87,7 +87,7 @@ describe('DevTools panel for Electron', function () {
8787
await delay(1000);
8888
});
8989

90-
it.skip('should contain INIT action', async () => {
90+
it('should contain INIT action', async () => {
9191
const element = await driver.wait(
9292
webdriver.until.elementLocated(
9393
webdriver.By.xpath('//div[@data-testid="actionListRows"]'),
@@ -99,15 +99,15 @@ describe('DevTools panel for Electron', function () {
9999
expect(val).toMatch(/@@INIT/);
100100
});
101101

102-
it.skip("should contain Inspector monitor's component", async () => {
102+
it("should contain Inspector monitor's component", async () => {
103103
const val = await driver
104104
.findElement(webdriver.By.xpath('//div[@data-testid="inspector"]'))
105105
.getText();
106106
expect(val).toBeDefined();
107107
});
108108

109109
Object.keys(switchMonitorTests).forEach((description) =>
110-
it.skip(description, () => switchMonitorTests[description](driver)),
110+
it(description, () => switchMonitorTests[description](driver)),
111111
);
112112

113113
/* it('should be no logs in console of main window', async () => {

0 commit comments

Comments
 (0)