0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2024-12-16 20:26:19 -05:00

chore: bump dependencies (#6873)

* chore: bump dependencies

* fix: ui test

* fix: ui test
This commit is contained in:
Charles Zhao 2024-12-11 17:35:47 +08:00 committed by GitHub
parent 7463e88f29
commit baef49df3c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
18 changed files with 815 additions and 521 deletions

View file

@ -34,7 +34,7 @@
"pg": "^8.8.0", "pg": "^8.8.0",
"tsup": "^8.3.0", "tsup": "^8.3.0",
"typescript": "^5.0.0", "typescript": "^5.0.0",
"vite": "^5.3.4" "vite": "^6.0.3"
}, },
"engines": { "engines": {
"node": "^20.9.0", "node": "^20.9.0",
@ -45,7 +45,14 @@
"formidable@<3.2.4": "^3.2.4", "formidable@<3.2.4": "^3.2.4",
"d3-color@2.0.0": "^3.1.0", "d3-color@2.0.0": "^3.1.0",
"braces@<3.0.3": "^3.0.3", "braces@<3.0.3": "^3.0.3",
"@75lb/deep-merge@<1.1.2": "^1.1.2" "cross-spawn@<6.0.6": "^6.0.6",
"cross-spawn@>=7.0.0 <7.0.5": "^7.0.5",
"@75lb/deep-merge@<1.1.2": "^1.1.2",
"micromatch@<4.0.8": "^4.0.8",
"nanoid@>=4.0.0 <5.0.9": "^5.0.9",
"path-to-regexp@>=0.2.0 <1.9.0": "^1.9.0",
"path-to-regexp@>=4.0.0 <6.3.0": "^6.3.0",
"rollup@>=4.0.0 <4.22.4": "^4.22.4"
}, },
"peerDependencyRules": { "peerDependencyRules": {
"allowedVersions": { "allowedVersions": {

View file

@ -54,7 +54,7 @@
"got": "^14.0.0", "got": "^14.0.0",
"hpagent": "^1.2.0", "hpagent": "^1.2.0",
"inquirer": "^9.0.0", "inquirer": "^9.0.0",
"nanoid": "^5.0.1", "nanoid": "^5.0.9",
"ora": "^8.0.1", "ora": "^8.0.1",
"p-limit": "^6.0.0", "p-limit": "^6.0.0",
"p-retry": "^6.0.0", "p-retry": "^6.0.0",

View file

@ -9,7 +9,7 @@
"@silverhand/essentials": "^2.9.1", "@silverhand/essentials": "^2.9.1",
"jose": "^5.6.3", "jose": "^5.6.3",
"ky": "^1.2.3", "ky": "^1.2.3",
"nanoid": "^5.0.1", "nanoid": "^5.0.9",
"snakecase-keys": "^8.0.1", "snakecase-keys": "^8.0.1",
"zod": "^3.23.8" "zod": "^3.23.8"
}, },

View file

@ -9,7 +9,7 @@
"@silverhand/essentials": "^2.9.1", "@silverhand/essentials": "^2.9.1",
"jose": "^5.6.3", "jose": "^5.6.3",
"ky": "^1.2.3", "ky": "^1.2.3",
"nanoid": "^5.0.1", "nanoid": "^5.0.9",
"snakecase-keys": "^8.0.1", "snakecase-keys": "^8.0.1",
"zod": "^3.23.8" "zod": "^3.23.8"
}, },

View file

@ -82,7 +82,7 @@
"libphonenumber-js": "^1.10.51", "libphonenumber-js": "^1.10.51",
"lint-staged": "^15.0.0", "lint-staged": "^15.0.0",
"mermaid": "^10.9.1", "mermaid": "^10.9.1",
"nanoid": "^5.0.1", "nanoid": "^5.0.9",
"overlayscrollbars": "^2.0.2", "overlayscrollbars": "^2.0.2",
"overlayscrollbars-react": "^0.5.0", "overlayscrollbars-react": "^0.5.0",
"postcss": "^8.4.39", "postcss": "^8.4.39",
@ -115,9 +115,9 @@
"stylelint": "^15.0.0", "stylelint": "^15.0.0",
"swr": "^2.2.0", "swr": "^2.2.0",
"typescript": "^5.5.3", "typescript": "^5.5.3",
"vite": "^5.3.4", "vite": "^6.0.3",
"vite-plugin-compression": "^0.5.1", "vite-plugin-compression": "^0.5.1",
"vite-plugin-svgr": "^4.2.0", "vite-plugin-svgr": "^4.3.0",
"zod": "^3.23.8", "zod": "^3.23.8",
"zod-to-ts": "^1.2.0" "zod-to-ts": "^1.2.0"
}, },

View file

@ -79,7 +79,7 @@
"koa-send": "^5.0.1", "koa-send": "^5.0.1",
"ky": "^1.2.3", "ky": "^1.2.3",
"lru-cache": "^11.0.0", "lru-cache": "^11.0.0",
"nanoid": "^5.0.1", "nanoid": "^5.0.9",
"node-forge": "^1.3.1", "node-forge": "^1.3.1",
"oidc-provider": "github:logto-io/node-oidc-provider#de2d8fd68e91b76d71fb910d44142f9eccd844bc", "oidc-provider": "github:logto-io/node-oidc-provider#de2d8fd68e91b76d71fb910d44142f9eccd844bc",
"openapi-types": "^12.1.3", "openapi-types": "^12.1.3",

View file

@ -45,7 +45,7 @@
"react-i18next": "^12.3.1", "react-i18next": "^12.3.1",
"stylelint": "^15.0.0", "stylelint": "^15.0.0",
"typescript": "^5.5.3", "typescript": "^5.5.3",
"vite": "^5.3.4", "vite": "^6.0.3",
"vite-plugin-compression": "^0.5.1", "vite-plugin-compression": "^0.5.1",
"zod": "^3.23.8" "zod": "^3.23.8"
}, },

View file

@ -85,9 +85,9 @@
"tiny-cookie": "^2.4.1", "tiny-cookie": "^2.4.1",
"typescript": "^5.5.3", "typescript": "^5.5.3",
"use-debounced-loader": "^0.1.1", "use-debounced-loader": "^0.1.1",
"vite": "^5.3.4", "vite": "^6.0.3",
"vite-plugin-compression": "^0.5.1", "vite-plugin-compression": "^0.5.1",
"vite-plugin-svgr": "^4.2.0" "vite-plugin-svgr": "^4.3.0"
}, },
"engines": { "engines": {
"node": "^20.9.0" "node": "^20.9.0"

View file

@ -85,9 +85,9 @@
"tiny-cookie": "^2.4.1", "tiny-cookie": "^2.4.1",
"typescript": "^5.5.3", "typescript": "^5.5.3",
"use-debounced-loader": "^0.1.1", "use-debounced-loader": "^0.1.1",
"vite": "^5.3.4", "vite": "^6.0.3",
"vite-plugin-compression": "^0.5.1", "vite-plugin-compression": "^0.5.1",
"vite-plugin-svgr": "^4.2.0" "vite-plugin-svgr": "^4.3.0"
}, },
"engines": { "engines": {
"node": "^20.9.0" "node": "^20.9.0"

View file

@ -2,7 +2,7 @@
const config = { const config = {
transform: {}, transform: {},
preset: 'jest-puppeteer', preset: 'jest-puppeteer',
setupFilesAfterEnv: ['jest-matcher-specific-error', './jest.setup.js'], setupFilesAfterEnv: ['jest-matcher-specific-error', 'expect-puppeteer', './jest.setup.js'],
moduleNameMapper: { moduleNameMapper: {
'^#src/(.*)\\.js(x)?$': '<rootDir>/lib/$1', '^#src/(.*)\\.js(x)?$': '<rootDir>/lib/$1',
'^(chalk|inquirer)$': '<rootDir>/../shared/lib/esm/module-proxy.js', '^(chalk|inquirer)$': '<rootDir>/../shared/lib/esm/module-proxy.js',

View file

@ -38,16 +38,16 @@
"@types/node": "^20.9.5", "@types/node": "^20.9.5",
"dotenv": "^16.4.5", "dotenv": "^16.4.5",
"eslint": "^8.56.0", "eslint": "^8.56.0",
"expect-puppeteer": "^10.0.0", "expect-puppeteer": "^10.1.4",
"jest": "^29.7.0", "jest": "^29.7.0",
"jest-matcher-specific-error": "^1.0.0", "jest-matcher-specific-error": "^1.0.0",
"jest-puppeteer": "^10.1.2", "jest-puppeteer": "^10.1.4",
"jose": "^5.6.3", "jose": "^5.6.3",
"ky": "^1.2.3", "ky": "^1.2.3",
"openapi-schema-validator": "^12.1.3", "openapi-schema-validator": "^12.1.3",
"openapi-types": "^12.1.3", "openapi-types": "^12.1.3",
"prettier": "^3.0.0", "prettier": "^3.0.0",
"puppeteer": "^22.6.5", "puppeteer": "^23.10.3",
"tsup": "^8.3.0", "tsup": "^8.3.0",
"typescript": "^5.5.3", "typescript": "^5.5.3",
"zod": "^3.23.8" "zod": "^3.23.8"

View file

@ -9,6 +9,7 @@ import {
} from '#src/ui-helpers/index.js'; } from '#src/ui-helpers/index.js';
import { import {
appendPathname, appendPathname,
dcls,
expectNavigation, expectNavigation,
formatPhoneNumberToInternational, formatPhoneNumberToInternational,
generateEmail, generateEmail,
@ -51,6 +52,7 @@ describe('user management', () => {
// Go to user details page // Go to user details page
await expectToClickModalAction(page, 'Check user detail'); await expectToClickModalAction(page, 'Check user detail');
await page.waitForNavigation({ waitUntil: 'networkidle0' });
await expect(page).toMatchElement('div[class$=main] div[class$=metadata] div[class$=name]', { await expect(page).toMatchElement('div[class$=main] div[class$=metadata] div[class$=name]', {
text: 'jdoe@gmail.com', text: 'jdoe@gmail.com',
}); });
@ -61,15 +63,25 @@ describe('user management', () => {
if (userId) { if (userId) {
expect(page.url()).toBe(new URL(`console/users/${userId}/settings`, logtoConsoleUrl).href); expect(page.url()).toBe(new URL(`console/users/${userId}/settings`, logtoConsoleUrl).href);
} }
const email = await page.$eval('form input[name=primaryEmail]', (element) => await expect(page).toMatchElement(
element instanceof HTMLInputElement ? element.value : null [dcls('main'), dcls('introduction'), dcls('title')].join(' '),
); {
const phone = await page.$eval('form input[name=primaryPhone]', (element) => text: 'Authentication',
element instanceof HTMLInputElement ? element.value : null }
);
const username = await page.$eval('form input[name=username]', (element) =>
element instanceof HTMLInputElement ? element.value : null
); );
const [email, phone, username] = await Promise.all([
page.$eval('form input[name=primaryEmail]', (element) =>
element instanceof HTMLInputElement ? element.value : null
),
page.$eval('form input[name=primaryPhone]', (element) =>
element instanceof HTMLInputElement ? element.value : null
),
page.$eval('form input[name=username]', (element) =>
element instanceof HTMLInputElement ? element.value : null
),
]);
console.log('################### email, phone, username', email, phone, username);
expect(email).toBe('jdoe@gmail.com'); expect(email).toBe('jdoe@gmail.com');
expect(phone).toBe('+1 810 555 5555'); expect(phone).toBe('+1 810 555 5555');

View file

@ -6,7 +6,7 @@ import { consolePassword, consoleUsername, logtoConsoleUrl } from '#src/constant
import { cls, dcls, waitFor } from '#src/utils.js'; import { cls, dcls, waitFor } from '#src/utils.js';
import ExpectPage, { ExpectPageError } from './expect-page.js'; import ExpectPage, { ExpectPageError } from './expect-page.js';
import { expectConfirmModalAndAct, expectToSaveChanges } from './index.js'; import { expectConfirmModalAndAct, expectToSaveChanges, type PuppeteerInstance } from './index.js';
type ExpectConsoleOptions = { type ExpectConsoleOptions = {
/** The URL of the console endpoint. */ /** The URL of the console endpoint. */
@ -67,7 +67,9 @@ export default class ExpectConsole extends ExpectPage {
* *
* @see {@link jest.Matchers.toMatchElement} * @see {@link jest.Matchers.toMatchElement}
*/ */
async toMatchElement(...args: Parameters<jest.Matchers<unknown>['toMatchElement']>) { async toMatchElement(
...args: Parameters<jest.Matchers<unknown, PuppeteerInstance>['toMatchElement']>
) {
return expect(this.page).toMatchElement(...args); return expect(this.page).toMatchElement(...args);
} }

View file

@ -2,6 +2,8 @@ import { type ElementHandle, type Page } from 'puppeteer';
import { expectNavigation } from '#src/utils.js'; import { expectNavigation } from '#src/utils.js';
import { type PuppeteerInstance } from './index.js';
/** Error thrown by {@link ExpectPage}. */ /** Error thrown by {@link ExpectPage}. */
export class ExpectPageError extends Error { export class ExpectPageError extends Error {
constructor( constructor(
@ -83,7 +85,7 @@ export default class ExpectPage {
/** /**
* Alias for {@link jest.Matchers['toFill']}. * Alias for {@link jest.Matchers['toFill']}.
*/ */
async toFill(...args: Parameters<jest.Matchers<unknown>['toFill']>) { async toFill(...args: Parameters<jest.Matchers<unknown, PuppeteerInstance>['toFill']>) {
return expect(this.page).toFill(...args); return expect(this.page).toFill(...args);
} }
@ -142,7 +144,9 @@ export default class ExpectPage {
* @alias `expect(this.page).toMatchElement()` * @alias `expect(this.page).toMatchElement()`
* @see {@link jest.Matchers.toMatchElement} * @see {@link jest.Matchers.toMatchElement}
*/ */
async toMatchElement(...args: Parameters<jest.Matchers<unknown>['toMatchElement']>) { async toMatchElement(
...args: Parameters<jest.Matchers<unknown, PuppeteerInstance>['toMatchElement']>
) {
return expect(this.page).toMatchElement(...args); return expect(this.page).toMatchElement(...args);
} }

View file

@ -1,6 +1,6 @@
import { ConnectorType } from '@logto/connector-kit'; import { ConnectorType } from '@logto/connector-kit';
import { SignInMode, SignInIdentifier, type PartialPasswordPolicy } from '@logto/schemas'; import { SignInMode, SignInIdentifier, type PartialPasswordPolicy } from '@logto/schemas';
import { type ElementHandle, type Browser, type Page } from 'puppeteer'; import { type ElementHandle, type Browser, type Page, type Frame } from 'puppeteer';
import { updateSignInExperience } from '#src/api/sign-in-experience.js'; import { updateSignInExperience } from '#src/api/sign-in-experience.js';
import { import {
@ -13,6 +13,8 @@ import { dcls, expectNavigation, waitFor } from '#src/utils.js';
import { selectDropdownMenuItem } from './select-dropdown-menu-item.js'; import { selectDropdownMenuItem } from './select-dropdown-menu-item.js';
export type PuppeteerInstance = Page | Frame | ElementHandle;
export const goToAdminConsole = async () => { export const goToAdminConsole = async () => {
const logtoConsoleUrl = new URL(logtoConsoleUrlString); const logtoConsoleUrl = new URL(logtoConsoleUrlString);
await expectNavigation(page.goto(logtoConsoleUrl.href)); await expectNavigation(page.goto(logtoConsoleUrl.href));

View file

@ -85,7 +85,7 @@
"@logto/phrases-experience": "workspace:^1.9.0", "@logto/phrases-experience": "workspace:^1.9.0",
"@logto/shared": "workspace:^3.1.2", "@logto/shared": "workspace:^3.1.2",
"@withtyped/server": "^0.14.0", "@withtyped/server": "^0.14.0",
"nanoid": "^5.0.1" "nanoid": "^5.0.9"
}, },
"peerDependencies": { "peerDependencies": {
"zod": "^3.23.8" "zod": "^3.23.8"

View file

@ -63,6 +63,6 @@
"chalk": "^5.3.0", "chalk": "^5.3.0",
"find-up": "^7.0.0", "find-up": "^7.0.0",
"libphonenumber-js": "^1.9.49", "libphonenumber-js": "^1.9.49",
"nanoid": "^5.0.1" "nanoid": "^5.0.9"
} }
} }

File diff suppressed because it is too large Load diff