init 003_test,

This commit is contained in:
2025-05-16 11:13:50 +08:00
parent 3e3e23aa68
commit 2371e40ad2
59 changed files with 1937 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
// tests/REQ0006/001_fresh-user-should-appears-sign-in-page.spec.ts
import { test, expect } from '@playwright/test';
//
import { CMS_HOST, HELLO } from '../_config/helloworld';
import { TS_HELLO } from '../_test_set/helloworld';
test('fresh user should appears sign in page', async ({ page }) => {
console.log({ HELLO, TS_HELLO });
await page.goto(`${CMS_HOST}/dashboard`);
// Expect a title "to contain" a substring.
await expect(page).toHaveTitle(/Sign in | Custom | Auth | demo cms/);
});
// test('fresh user login', async ({ page }) => {
// await page.goto('http://192.168.222.199:3000/dashboard');
// // Expect a title "to contain" a substring.
// const emailField = page.getByPlaceholder('e.g. admin@123.com');
// await emailField.press('Enter');
// });
// test('get started link', async ({ page }) => {
// await page.goto('https://playwright.dev/');
// // Click the get started link.
// await page.getByRole('link', { name: 'Get started' }).click();
// // Expects page to have a heading with the name of Installation.
// await expect(page.getByRole('heading', { name: 'Installation' })).toBeVisible();
// });

View File

@@ -0,0 +1,40 @@
// tests/REQ0006/001_fresh-user-should-appears-sign-in-page.spec.ts
import { test, expect } from '@playwright/test';
//
import { CMS_HOST, HELLO } from '../_config/helloworld';
import { TS_HELLO } from '../_test_set/helloworld';
test('user login', async ({ page }) => {
console.log({ HELLO, TS_HELLO });
await page.goto(`${CMS_HOST}/dashboard`);
await expect(page).toHaveTitle(/Sign in | Custom | Auth | demo cms/);
await page.getByPlaceholder('name@example.com').pressSequentially('user5@123.com');
await page.getByPlaceholder('password').pressSequentially('user5@123.com');
await page.waitForTimeout(1 * 1000);
await page.getByRole('button', { name: 'Sign in' }).click();
await page.waitForTimeout(1 * 1000);
await expect(page).toHaveTitle(/192.168.222.199:3000\/dashboard/);
});
// test('fresh user login', async ({ page }) => {
// await page.goto('http://192.168.222.199:3000/dashboard');
// // Expect a title "to contain" a substring.
// const emailField = page.getByPlaceholder('e.g. admin@123.com');
// await emailField.press('Enter');
// });
// test('get started link', async ({ page }) => {
// await page.goto('https://playwright.dev/');
// // Click the get started link.
// await page.getByRole('link', { name: 'Get started' }).click();
// // Expects page to have a heading with the name of Installation.
// await expect(page.getByRole('heading', { name: 'Installation' })).toBeVisible();
// });

View File

@@ -0,0 +1,2 @@
export const HELLO = 'WORLD';
export const CMS_HOST = 'http://192.168.222.199:3000';

View File

@@ -0,0 +1 @@
export const TS_HELLO = 'WORLD';