File size: 747 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
import { Page, expect } from '@playwright/test'

export async function createLabel(
  page: Page,
  key: string,
  value: string,
  isMobile: boolean,
): Promise<void> {
  // Create a label for the service
  await page.getByRole('link', { name: 'Labels' }).click()

  if (isMobile) {
    await page.getByRole('button', { name: 'Add' }).click()
  } else {
    await page.getByTestId('create-label').click()
  }

  await page.getByLabel('Key', { exact: true }).fill(key)
  await page.getByText('Create "' + key + '"').click()
  await page.getByLabel('Value', { exact: true }).fill(value)
  await page.click('[role=dialog] button[type=submit]')

  await expect(page.getByText(key)).toBeVisible()
  await expect(page.getByText(value)).toBeVisible()
}