blob: a22b39bc6759dc1782512315c95f17a1d5042320 [file] [log] [blame]
Zijie He0dc9dce2024-07-11 19:34:291import * as common from './common.mjs';
2Object.assign(global, common);
3
4(async () => {
5 const default_param = {
6 manifestId: 'https://developer.chrome.com/'
7 };
8
9 await waitfor_enter('Now I will show the chrome://apps, there should not ' +
10 'be any apps so far.');
11 await (await browser.newPage()).goto('chrome://apps');
12 await waitfor_enter('The first launch should fail since the app has not ' +
13 'been installed yet.');
14 await send(null, 'PWA.launch', default_param);
15
16 await waitfor_enter('Now I will install the web app.');
17 await send(null, 'PWA.install', {
18 manifestId: 'https://developer.chrome.com/',
19 installUrlOrBundleUrl: 'https://developer.chrome.com/'
20 });
21
22 await waitfor_enter('You should see the newly installed app in the ' +
23 'chrome://apps tab now. It will be launched.');
24 await send(null, 'PWA.launch', default_param);
25 await waitfor_enter('The second launch should succeed. Now I will inspect ' +
26 'its information.');
27 await send(await current_page_session(),
28 'Page.getAppManifest',
29 default_param);
30 await send(null, 'PWA.getOsAppState', default_param);
31 await waitfor_enter('Now I will open the page in its own window.');
32 await send(await current_page_session(),
33 'PWA.openCurrentPageInApp',
34 default_param);
35 await waitfor_enter('Now I will close the page and uninstall the webapp.');
36 await (await browser.pages()).pop().close();
37 await send(null, 'PWA.uninstall', default_param);
38 await waitfor_enter('You should see the installed app being removed in the ' +
39 'chrome://apps tab now. Will close the browser window ' +
40 'and stop.');
41 browser.close();
42 shutdown();
43})();