File size: 781 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import { Page } from 'playwright';
import { AccountSettingsPage, AccountClosedPage } from '../pages';

/**
 * Closes the ccount.
 */
export class CloseAccountFlow {
	private page: Page;

	/**
	 * Constructs an instance of the flow.
	 *
	 * @param {Page} page The underlying page.
	 */
	constructor( page: Page ) {
		this.page = page;
	}

	/**
	 * Closes the account.
	 *
	 * This method will navigate from the navbar to the /me page,
	 * then onto Account Settings.
	 */
	async closeAccount(): Promise< void > {
		const accountSettingsPage = new AccountSettingsPage( this.page );
		await accountSettingsPage.visit();
		await accountSettingsPage.closeAccount();

		const accountClosedPage = new AccountClosedPage( this.page );
		await accountClosedPage.confirmAccountClosed();
	}
}