Move test repo URL to environment

This commit is contained in:
2026-07-06 09:48:55 +08:00
parent 77a07aae0a
commit 3f0ee98a54
4 changed files with 24 additions and 9 deletions

24
test.js
View File

@@ -1,6 +1,9 @@
import * as fs from "fs";
import axios from "axios";
import { chromium } from 'playwright'
import * as fs from "fs";
import axios from "axios";
import { chromium } from 'playwright'
import dotenv from 'dotenv';
dotenv.config();
(async () => {
const browser = await chromium.launch({
@@ -134,11 +137,16 @@ async function taskIsCompleted(task) {
return false;
}
async function doUpdateProject(page) {
console.log('👉 执行项目更新');
const context = page.context();
const newPage = await context.newPage();
await newPage.goto('https://gitcode.com/fzxlzy/test/edit/main/testjpgp11');
async function doUpdateProject(page) {
console.log('👉 执行项目更新');
const testRepoUrl = process.env.GITCODE_TEST_REPO_URL;
if (!testRepoUrl) {
throw new Error('未配置 GITCODE_TEST_REPO_URL无法执行更新项目任务');
}
const context = page.context();
const newPage = await context.newPage();
await newPage.goto(testRepoUrl);
// 你可以自己补逻辑
const frame = newPage.frameLocator('#codeartside');