使用playwright内置test

This commit is contained in:
xief
2024-08-02 11:31:51 +08:00
parent 79bb32bc6c
commit b2321c7ee7
10 changed files with 134 additions and 2649 deletions

View File

@@ -1,9 +1,9 @@
import { describe, it, expect } from '@jest/globals'
import { test } from '@playwright/test'
import { chromium } from "playwright";
describe("mes登录", function () {
test.describe("mes登录", function () {
it('login', async function () {
test('login', async function () {
const browser = await chromium.launch({
// headless: false
});
@@ -32,7 +32,7 @@ describe("mes登录", function () {
await page.waitForTimeout(1000)
let path = await page.evaluateHandle(()=>window.location.hash.substr(1))
expect(await path.jsonValue()).toEqual('/dashboard')
test.expect(await path.jsonValue()).toEqual('/dashboard')
// ---------------------

View File

@@ -1,9 +1,9 @@
import { describe, it, expect } from '@jest/globals'
import { test } from '@playwright/test'
import { chromium } from "playwright";
describe('平台', function(){
test.describe('平台', function(){
it('登陆', async function(){
test('登陆', async function(){
const browser = await chromium.launch({
// headless: false
@@ -30,7 +30,7 @@ describe('平台', function(){
let path = await page.evaluateHandle(()=>window.location.pathname);
expect(await path.jsonValue()).not.toEqual('/user-login.html')
test.expect(await path.jsonValue()).not.toEqual('/user-login.html')
// ---------------------
await context.close();