Skip to content

Commit 5a684cd

Browse files
committed
fix
1 parent e8be041 commit 5a684cd

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

libs/backend-api7/e2e/support/global-setup.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import axios from 'axios';
22
import { spawn } from 'node:child_process';
33
import { randomUUID } from 'node:crypto';
44
import { Agent } from 'node:https';
5+
import { gte, lt } from 'semver';
56

67
const httpClient = axios.create({
78
baseURL: 'https://localhost:7443',
@@ -66,6 +67,10 @@ const initUser = async (username = 'admin', password = 'admin') => {
6667
password: password,
6768
});
6869

70+
// If the version is lower than 3.2.15, the license should be activated first.
71+
if (lt('3.2.15', process.env.BACKEND_API7_VERSION ?? '0.0.0'))
72+
await activateAPI7();
73+
6974
console.log('Modify password');
7075
await httpClient.put(`/api/password`, {
7176
old_password: password,
@@ -80,6 +85,11 @@ const initUser = async (username = 'admin', password = 'admin') => {
8085
username: username,
8186
password: 'Admin12345!',
8287
});
88+
89+
// If the version is greater than or equal to 3.2.15, the license should
90+
// be activated after changing the password.
91+
if (gte('3.2.15', process.env.BACKEND_API7_VERSION ?? '0.0.0'))
92+
await activateAPI7();
8393
};
8494

8595
const activateAPI7 = async () => {
@@ -124,7 +134,6 @@ const generateToken = async () => {
124134
export default async () => {
125135
if (process.env['SKIP_API7_SETUP'] !== 'true') await setupAPI7();
126136
await initUser();
127-
await activateAPI7();
128137
await generateToken();
129138

130139
process.env.SERVER = 'https://localhost:7443';

0 commit comments

Comments
 (0)