Skip to content

Commit cf330bd

Browse files
committed
fix: electron test don't work anymore
1 parent fa8128e commit cf330bd

1 file changed

Lines changed: 14 additions & 4 deletions

File tree

cypress/support/commands.js

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,26 @@
1616
// populate localStorage with a default connection, automatically cleared before each spec
1717
// assumes default 'admin' user and '' password
1818
// actual server URL is retrieved via ENV
19-
Cypress.Commands.add("connect", () => {
19+
Cypress.Commands.add("connect", () => {
2020
// conn_val mimics actual app behavior, its value is inconsequential for establishing a connection
2121
let conn_val = 'admin@' + Cypress.env('API_HOST')
22-
let nested = {"name":"localhost","server": Cypress.env('API_HOST'),"username":"admin","password":"","users":[],"groups":[]}
22+
let nested = { "name": "localhost", "server": Cypress.env('API_HOST'), "username": "admin", "password": "", "users": [], "groups": [] }
2323
let obj = {}
2424
obj[conn_val] = nested
2525

26-
localStorage.setItem('connections', JSON.stringify(obj))
26+
localStorage.setItem('connections', JSON.stringify(obj))
2727

28-
})
28+
})
29+
Cypress.Commands.overwrite('visit', (orig, url, options) => {
30+
// this is a fix to include the process variable when using the Electron browser
31+
return orig('/', Cypress.isBrowser('electron') ? {
32+
onBeforeLoad(win) {
33+
win.process = {
34+
env: [],
35+
};
36+
}
37+
} : undefined);
38+
})
2939
//
3040
//
3141
// -- This is a child command --

0 commit comments

Comments
 (0)