| | import { Page } from 'playwright'; |
| | import { TestFile } from '../../types'; |
| |
|
| | |
| | |
| | |
| | export class BlazeCampaignPage { |
| | private page: Page; |
| |
|
| | |
| | |
| | |
| | |
| | |
| | constructor( page: Page ) { |
| | this.page = page; |
| | } |
| |
|
| | |
| | |
| | |
| | |
| | |
| | async clickButton( name: string ) { |
| | await this.page.getByRole( 'button', { name: name } ).click(); |
| | } |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | async enterText( name: string, text: string ) { |
| | |
| | await this.page.getByRole( 'textbox', { name: name } ).clear(); |
| | await this.page.getByRole( 'textbox', { name: name } ).fill( text ); |
| | } |
| |
|
| | |
| | |
| | |
| | |
| | |
| | async uploadImage( path: TestFile ) { |
| | const timeout = 15_000; |
| | const fileChooserPromise = this.page.waitForEvent( 'filechooser', { timeout } ); |
| |
|
| | const [ fileChooser ] = await Promise.all( [ |
| | fileChooserPromise, |
| | this.page |
| | .getByRole( 'region', { name: 'Appearance' } ) |
| | .getByRole( 'button', { name: 'Upload' } ) |
| | .click( { timeout } ), |
| | ] ); |
| |
|
| | await fileChooser.setFiles( path.fullpath ); |
| |
|
| | await this.page.getByRole( 'region', { name: 'Appearance' } ).locator( 'img' ).waitFor(); |
| | } |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | async validatePreview( { title, snippet }: { title: string; snippet: string } ) { |
| | await this.page.locator( '.ad-preview-section' ).getByText( title ).waitFor(); |
| | await this.page.locator( '.ad-preview-section' ).getByText( snippet ).waitFor(); |
| | } |
| | } |
| |
|