Skip to content

Commit 96fb902

Browse files
committed
add method for moving copilot icon when test starts
1 parent eea7667 commit 96fb902

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

scripts/pit/its/k8s-demo.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1-
const { log, args, createPage, closePage, takeScreenshot, waitForServerReady, dismissDevmode} = require('./test-utils');
1+
const { log, args, createPage, closePage, takeScreenshot, waitForServerReady, dismissDevmode, setupCopilotConfig} = require('./test-utils');
22

33
(async () => {
44
const arg = args();
5+
6+
setupCopilotConfig();
7+
58
const page = await createPage(arg.headless, arg.ignoreHTTPSErrors);
69
await waitForServerReady(page, arg.url);
710

scripts/pit/its/test-utils.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,25 @@ async function compileAndReload(page, url, options = {}) {
262262
}
263263
}
264264

265+
function setupCopilotConfig() {
266+
const os = require('os');
267+
const copilotConfigPath = path.join(os.homedir(), '.vaadin', 'copilot-configuration.json');
268+
const copilotConfig = {
269+
dismissedNotifications: ["devmode"],
270+
activationButtonPosition: { right: 212, bottom: 73 }
271+
};
272+
273+
fs.mkdirSync(path.dirname(copilotConfigPath), { recursive: true });
274+
275+
if (fs.existsSync(copilotConfigPath)) {
276+
const existingConfig = JSON.parse(fs.readFileSync(copilotConfigPath, 'utf8'));
277+
Object.assign(existingConfig, copilotConfig);
278+
fs.writeFileSync(copilotConfigPath, JSON.stringify(existingConfig, null, 2));
279+
} else {
280+
fs.writeFileSync(copilotConfigPath, JSON.stringify(copilotConfig, null, 2));
281+
}
282+
}
283+
265284
module.exports = {
266285
log, out, err, warn,
267286
run,
@@ -273,4 +292,5 @@ module.exports = {
273292
waitForServerReady,
274293
dismissDevmode,
275294
compileAndReload,
295+
setupCopilotConfig,
276296
};

0 commit comments

Comments
 (0)