mirror of
https://github.com/reduxjs/redux-devtools.git
synced 2024-11-25 11:03:57 +03:00
83b2c19a11
* Update Chrome manifest.json * Remove use of window in background * Test devpanel * Inject pageScript using new API * Keep connection from devpanel to background alive * Keep connection from content script to background alive * Replace page action with action * Cleanup syncOptions * Update options to not rely on background page access * Start work on updating popup * Updates * Remove window * Get opening in a separate window working * Remove pageScriptWrap * Add socket to panelStore * Fix tests * Try to use MV3 for Firefox * Fix path * Fix Chrome E2E tests * Revert unintentional change * Skip Electron tests for now Looks like they're still working through stuff in https://github.com/electron/electron/issues/41613 * Better image centering The Firefox popup did not like the old CSS. This is still not perfect, but it's better than it was. * Create shaggy-taxis-cross.md
124 lines
3.8 KiB
JavaScript
124 lines
3.8 KiB
JavaScript
import { join } from 'path';
|
|
import webdriver from 'selenium-webdriver';
|
|
import chrome from 'selenium-webdriver/chrome';
|
|
import electronPath from 'electron';
|
|
import chromedriver from 'chromedriver';
|
|
import { switchMonitorTests, delay } from '../utils/e2e';
|
|
|
|
const devPanelPath =
|
|
'chrome-extension://lmhkpmbekcpmknklioeibfkpmmfibljd/window.html';
|
|
|
|
describe('DevTools panel for Electron', function () {
|
|
let driver;
|
|
|
|
beforeAll(async () => {
|
|
chromedriver.start();
|
|
await delay(1000);
|
|
driver = new webdriver.Builder()
|
|
.usingServer('http://localhost:9515')
|
|
.setChromeOptions(
|
|
new chrome.Options()
|
|
.setChromeBinaryPath(electronPath)
|
|
.addArguments(`app=${join(__dirname, 'fixture')}`),
|
|
)
|
|
.forBrowser('chrome')
|
|
.build();
|
|
});
|
|
|
|
afterAll(async () => {
|
|
await driver.quit();
|
|
chromedriver.stop();
|
|
});
|
|
|
|
it('should open Redux DevTools tab', async () => {
|
|
if (!(await driver.getCurrentUrl()).startsWith('devtools')) {
|
|
const originalWindow = await driver.getWindowHandle();
|
|
const windows = await driver.getAllWindowHandles();
|
|
for (const window of windows) {
|
|
if (window === originalWindow) continue;
|
|
await driver.switchTo().window(window);
|
|
if ((await driver.getCurrentUrl()).startsWith('devtools')) {
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
expect(await driver.getCurrentUrl()).toMatch(
|
|
/devtools:\/\/devtools\/bundled\/devtools_app.html/,
|
|
);
|
|
|
|
const id = await driver.executeAsyncScript(function (callback) {
|
|
let attempts = 5;
|
|
function showReduxPanel() {
|
|
if (attempts === 0) {
|
|
return callback('Redux panel not found');
|
|
}
|
|
if (EUI.InspectorView) {
|
|
const instance = EUI.InspectorView.InspectorView.instance();
|
|
const tabs = instance.tabbedPane.tabs;
|
|
const idList = tabs.map((tab) => tab.id);
|
|
const reduxPanelId =
|
|
'chrome-extension://lmhkpmbekcpmknklioeibfkpmmfibljdRedux';
|
|
if (idList.indexOf(reduxPanelId) !== -1) {
|
|
instance.showPanel(reduxPanelId);
|
|
return callback(reduxPanelId);
|
|
}
|
|
}
|
|
attempts--;
|
|
setTimeout(showReduxPanel, 500);
|
|
}
|
|
showReduxPanel();
|
|
});
|
|
expect(id).toBe('chrome-extension://lmhkpmbekcpmknklioeibfkpmmfibljdRedux');
|
|
|
|
const className = await driver
|
|
.findElement(webdriver.By.className(id))
|
|
.getAttribute('class');
|
|
expect(className).not.toMatch(/hidden/); // not hidden
|
|
});
|
|
|
|
it.skip('should have Redux DevTools UI on current tab', async () => {
|
|
await driver
|
|
.switchTo()
|
|
.frame(
|
|
driver.findElement(
|
|
webdriver.By.xpath(`//iframe[@src='${devPanelPath}']`),
|
|
),
|
|
);
|
|
await delay(1000);
|
|
});
|
|
|
|
it.skip('should contain INIT action', async () => {
|
|
const element = await driver.wait(
|
|
webdriver.until.elementLocated(
|
|
webdriver.By.xpath('//div[@data-testid="actionListRows"]'),
|
|
),
|
|
5000,
|
|
'Element not found',
|
|
);
|
|
const val = await element.getText();
|
|
expect(val).toMatch(/@@INIT/);
|
|
});
|
|
|
|
it.skip("should contain Inspector monitor's component", async () => {
|
|
const val = await driver
|
|
.findElement(webdriver.By.xpath('//div[@data-testid="inspector"]'))
|
|
.getText();
|
|
expect(val).toBeDefined();
|
|
});
|
|
|
|
Object.keys(switchMonitorTests).forEach((description) =>
|
|
it.skip(description, () => switchMonitorTests[description](driver)),
|
|
);
|
|
|
|
/* it('should be no logs in console of main window', async () => {
|
|
const handles = await driver.getAllWindowHandles();
|
|
await driver.switchTo().window(handles[1]); // Change to main window
|
|
|
|
expect(await driver.getTitle()).toBe('Electron Test');
|
|
|
|
const logs = await driver.manage().logs().get(webdriver.logging.Type.BROWSER);
|
|
expect(logs).toEqual([]);
|
|
});
|
|
*/
|
|
});
|