Can I disable "Change back to Google?" warning during e2e Puppeteer test?

178 views
Skip to first unread message

Juraj M.

unread,
Jul 17, 2025, 5:07:40 AM7/17/25
to Chromium Extensions
I'm using Puppeteer to test my extension that overrides New tab page, but each time the test runs, it displays this warning:

this_page_was_changed.png

I'm now writing a lot of new tests so I need to see what's happening or debug when needed and this warning is getting quite annoying... 
Is there some flag I could use maybe?

Juraj M.

unread,
Jul 17, 2025, 7:20:07 AM7/17/25
to Chromium Extensions, Juraj M.
I've managed to do it, but it's not exactly easy...
Where the local extensions guru wOxxOm suggested preparing folder with "Preferences" file (thank you wOxxOm!).

This time, the flag "ack_ntp_bubble" is set in the "Secure Preferences" file.

So, what I did is to run the tests, approve the message, locate the current profile folder in the OS "Temp" folder, then copy the "Secure Preferences" file in a new folder - which will be used a template.
Then each time I run the tests, I'll copy this folder into the Temp folder and instruct Puppeteer to use this folder as profile.
In code it looks something like this:

const pathToExtension = path.join(process.cwd(), 'chrome_dev');
const templateProfilePath = 'C:\\tmp\\chrome_dev_profile';
const tempProfilePath = path.join(tmpdir(), `gsd_chrome_dev_profile_${Date.now()}`);
await cp(templateProfilePath, tempProfilePath, {recursive: true});
this.browser = await puppeteer.launch({
  userDataDir: tempProfilePath, // this works, but it's persistent (also it changes the profile!)
  headless: false,
  devtools,
  slowMo,
  executablePath: 'C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe',
  args: [
    `--disable-extensions-except=${pathToExtension}`,
    `--load-extension=${pathToExtension}`,
    // `--user-data-dir=C:\\tmp\\chrome_dev_profile`,
  ],
});
this.browser.on('disconnected', async () => {
  await timeoutPromise(1e3);
  await rm(tempProfilePath, {recursive: true, force: true})
});
this.extPage = await this.browser.newPage();

Reply all
Reply to author
Forward
0 new messages