File size: 819 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
import { Locator, Page } from 'playwright';

/**
 * Represents the Subscription Management page, accessed under
 * /subscriptions/sites when confirming subscription to a site.
 */
export class SubscriptionManagementPage {
	private page: Page;
	private anchor: Locator;

	/**
	 * Constructs an instance of the component.
	 *
	 * @param {Page} page The underlying page
	 */
	constructor( page: Page ) {
		this.page = page;
		this.anchor = this.page.getByRole( 'main' );
	}

	/**
	 * Validates the user is subscribed to a specific site, either by
	 * the site name or the site URL.
	 *
	 * @param {string} identifier Identifier to locate the site, either
	 * the site name or the URL.
	 */
	async validateSiteSubscribed( identifier: string ) {
		await this.anchor.getByRole( 'link', { name: identifier } ).waitFor();
	}
}