From d91b0b8e4f38a9102fca2b967e66b09fd821ca64 Mon Sep 17 00:00:00 2001 From: scarqin <1054139596@qq.com> Date: Sat, 25 Feb 2023 01:06:28 +0800 Subject: [PATCH] test: init e2e --- e2e/api-group.test.ts | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/e2e/api-group.test.ts b/e2e/api-group.test.ts index 922e1dd0..a9dd294c 100644 --- a/e2e/api-group.test.ts +++ b/e2e/api-group.test.ts @@ -2,8 +2,30 @@ import { test, expect } from '@playwright/test'; test('test', async ({ page }) => { await page.goto('http://localhost:4200/'); + + //Add group await page.getByRole('banner').getByRole('button').hover(); await page.locator('a').filter({ hasText: 'New Group' }).click(); - await page.getByLabel('Group Name').fill('test'); + await page.getByLabel('Group Name').fill('Parent Group'); + await page.getByRole('button', { name: 'Confirm' }).click(); + + //Add sub group + await page.getByTitle('Parent Group').locator('div').nth(1).hover(); + await page.getByTitle('Parent Group').getByRole('button').click(); + await page.getByText('Add Subgroup').click(); + await page.getByLabel('Group Name').fill('Sub Group'); + await page.getByRole('button', { name: 'Confirm' }).click(); + + //Edit group + await page.getByTitle('Sub Group').locator('div').nth(1).hover(); + await page.getByTitle('Sub Group').getByRole('button').click(); + await page.getByText('Edit').click(); + await page.getByLabel('Group Name').fill('Sub Group after'); + await page.getByRole('button', { name: 'Confirm' }).click(); + + //Delete group + await page.getByTitle('Sub Group after').locator('div').nth(1).hover(); + await page.getByTitle('Sub Group after').getByRole('button').click(); + await page.getByText('Delete').click(); await page.getByRole('button', { name: 'Confirm' }).click(); });