diff --git a/Makefile b/Makefile index 8909692230..e9aeb832f1 100644 --- a/Makefile +++ b/Makefile @@ -43,11 +43,3 @@ l10n-read: node_modules .PHONY: l10n-write l10n-write: node_modules make -C packages/web-runtime/l10n translations - -.PHONY: generate-qa-activity-report -generate-qa-activity-report: node_modules - @if [ -z "${MONTH}" ] || [ -z "${YEAR}" ]; then \ - echo "Please set the MONTH and YEAR environment variables. Usage: make generate-qa-activity-report MONTH= YEAR="; \ - exit 1; \ - fi - pnpm exec node generate-qa-activity-report.js --month ${MONTH} --year ${YEAR} diff --git a/generate-qa-activity-report.js b/generate-qa-activity-report.js deleted file mode 100644 index 8b72702e54..0000000000 --- a/generate-qa-activity-report.js +++ /dev/null @@ -1,213 +0,0 @@ -import simpleGit from 'simple-git' -import path from 'path' -import { fileURLToPath } from 'url' -import { dirname } from 'path' -import { Command } from 'commander' -import fs from 'fs' - -const __filename = fileURLToPath(import.meta.url) -const __dirname = dirname(__filename) - -const git = simpleGit() -const program = new Command() - -program - .option('-d, --days ', 'number of days to look back') - .option('-m, --month ', 'month to look back') - .option('-y, --year ', 'year to look back') - .parse(process.argv) - -const options = program.opts() - -function getGitDateFormat(date) { - const year = date.getFullYear() - const month = String(date.getMonth() + 1).padStart(2, '0') - const day = String(date.getDate()).padStart(2, '0') - return `${year}-${month}-${day}` -} - -function getStartAndEndDate(month, year) { - const startDate = new Date(year, month - 1, 1) - const endDate = new Date(year, month, 0) - return { startDate, endDate } -} - -async function getRecentChanges() { - try { - const repoPath = path.resolve(__dirname) - await git.cwd(repoPath) - - let formattedSinceDate, formattedUntilDate, period - - if (options.month && options.year) { - const { startDate, endDate } = getStartAndEndDate(options.month, options.year) - formattedSinceDate = getGitDateFormat(startDate) - formattedUntilDate = getGitDateFormat(endDate) - period = `${options.month}_${options.year}` - } else if (options.days) { - const today = new Date() - today.setDate(today.getDate() - options.days) - formattedSinceDate = getGitDateFormat(today) - formattedUntilDate = getGitDateFormat(new Date()) - period = `Last_${options.days}_days` - } else { - console.error('Please provide either days or month and year.') - return - } - - const logOptions = { - '--since': formattedSinceDate - } - if (formattedUntilDate) { - logOptions['--until'] = formattedUntilDate - } - - const logs = await git.log(logOptions) - - const csvRows = [ - ['Test-Type', 'Date', 'Tests Added', 'Tests Changed', 'Tests Deleted', 'commit-ID'] - ] - - for (const log of logs.all) { - const e2eDiff = await git.diff([ - `${log.hash}~1`, - log.hash, - '--', - 'tests/e2e/cucumber/features' - ]) - const unitDiff = await git.diff([`${log.hash}~1`, log.hash, '--', 'packages/**/*.spec.ts']) - - const e2eRow = analyzeE2eDiff(e2eDiff, log) - const unitRow = analyzeUnitDiff(unitDiff, log) - - if (e2eRow) { - csvRows.push(e2eRow) - } - - if (unitRow) { - csvRows.push(unitRow) - } - } - - const csvContent = csvRows.map((row) => row.join(',')).join('\n') - const reportsDir = path.join(__dirname, 'reports') - - if (!fs.existsSync(reportsDir)) { - fs.mkdirSync(reportsDir) - } - const reportFilePath = path.join(reportsDir, `QA_Activity_Report_${period}.csv`) - - fs.writeFile(reportFilePath, csvContent, (err) => { - if (err) { - console.error('Error writing CSV report:', err) - } else { - console.log(`CSV report generated successfully. You can find it in , ${reportFilePath}`) - } - }) - } catch (error) { - console.error('Error:', error) - } -} - -function analyzeE2eDiff(diff, log) { - const diffLines = diff.split('\n') - - let commitAddedTests = 0 - let commitChangedTests = 0 - let commitDeletedTests = 0 - let currentFile = null - - for (const line of diffLines) { - if (line.startsWith('diff --git')) { - const match = line.match(/ b\/(tests\/e2e\/cucumber\/features\/[^\s]+)/) - if (match) { - currentFile = match[1] - } - } else if (line.startsWith('+') && !line.startsWith('+++')) { - // Consider only the addition of scenarios or features. Example: + Scenario: activity - if (line.includes('Scenario:')) { - commitAddedTests++ - } - } else if (line.startsWith('-') && !line.startsWith('---')) { - // Consider only the deleting of scenarios or features. Example: - Scenario: activity - if (line.includes('Scenario:')) { - commitDeletedTests++ - } - } else if (line.includes('@@ Feature:') && currentFile) { - // if line contains 'Feature', that is test change. Example @@ -17,8 +17,8 @@ Feature: Download - commitChangedTests++ - } - } - if (commitAddedTests || commitChangedTests || commitDeletedTests) { - return ['UI Test', log.date, commitAddedTests, commitChangedTests, commitDeletedTests, log.hash] - } -} - -function analyzeUnitDiff(diff, log) { - const diffLines = diff.split('\n') - - let commitAddedTests = 0 - let commitChangedTests = 0 - let commitDeletedTests = 0 - let currentFile = null - let inChangeBlock = false - let inTest = false - - for (let i = 0; i < diffLines.length; i++) { - const line = diffLines[i] - - // Detect the file being diffed - if (line.startsWith('diff --git')) { - const match = line.match(/ b\/(packages\/[^\s]+\.spec\.ts)/) - if (match) { - currentFile = match[1] - } - } - - // Start a new change block - if (line.startsWith('@@')) { - if (inChangeBlock && !inTest) { - commitChangedTests++ - } - inChangeBlock = true - inTest = false - } - - // Process changes in the current block - if (inChangeBlock) { - if (line.startsWith('+') && !line.startsWith('+++')) { - if (line.includes('it(') || line.includes('it.each(')) { - commitAddedTests++ - inTest = true - } - } else if (line.startsWith('-') && !line.startsWith('---')) { - if (line.includes('it(') || line.includes('it.each(')) { - commitDeletedTests++ - inTest = true - } - } - } - - // End of a change block - if (line === '' || i === diffLines.length - 1) { - if (inChangeBlock && !inTest) { - commitChangedTests++ - } - inChangeBlock = false - } - } - - // Return results if there are any changes - if (commitAddedTests || commitChangedTests || commitDeletedTests) { - return [ - 'Unit Test', - log.date, - commitAddedTests, - commitChangedTests, - commitDeletedTests, - log.hash - ] - } -} - -getRecentChanges() diff --git a/package.json b/package.json index f0602630f5..dc12421fff 100644 --- a/package.json +++ b/package.json @@ -65,7 +65,6 @@ "@vue/test-utils": "2.4.6", "browserslist-to-esbuild": "^2.1.1", "browserslist-useragent-regexp": "^4.1.3", - "commander": "14.0.3", "eslint": "10.2.1", "franc-min": "^6.2.0", "happy-dom": "20.9.0", @@ -74,7 +73,6 @@ "pino": "10.3.1", "pino-pretty": "13.1.3", "qs": "^6.15.0", - "simple-git": "3.36.0", "tailwindcss": "^4.2.2", "ts-node": "10.9.2", "tslib": "2.8.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b4f43f209c..dd00b89063 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -88,9 +88,6 @@ importers: browserslist-useragent-regexp: specifier: ^4.1.3 version: 4.1.4(browserslist@4.28.1) - commander: - specifier: 14.0.3 - version: 14.0.3 eslint: specifier: 10.2.1 version: 10.2.1(jiti@2.6.1) @@ -115,9 +112,6 @@ importers: qs: specifier: ^6.15.0 version: 6.15.1 - simple-git: - specifier: 3.36.0 - version: 3.36.0 tailwindcss: specifier: ^4.2.2 version: 4.2.3 @@ -1839,12 +1833,6 @@ packages: '@jridgewell/trace-mapping@0.3.9': resolution: {integrity: sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==} - '@kwsites/file-exists@1.1.1': - resolution: {integrity: sha512-m9/5YGR18lIwxSFDwfE3oA7bWuq9kdau6ugN4H2rJeyhFQZcG9AgSHkQtSD15a8WvTgfz9aikZMrKPHvbpqFiw==} - - '@kwsites/promise-deferred@1.1.1': - resolution: {integrity: sha512-GaHYm+c0O9MjZRu0ongGBRbinu8gVAMd2UZjji6jVmqKtZluZnptXGWhz1E8j8D2HJ3f/yMxKAUC0b+57wncIw==} - '@lezer/common@1.5.1': resolution: {integrity: sha512-6YRVG9vBkaY7p1IVxL4s44n5nUnaNnGM2/AckNgYOnxTG2kWh1vR8BMxPseWPjRNpb5VtXnMpeYAEAADoRV1Iw==} @@ -2388,13 +2376,6 @@ packages: '@shikijs/vscode-textmate@10.0.2': resolution: {integrity: sha512-83yeghZ2xxin3Nj8z1NMd/NCuca+gsYXswywDy5bHvwlWL8tpTQmzGeUuHd9FC3E/SBEMvzJRwWEOz5gGes9Qg==} - '@simple-git/args-pathspec@1.0.3': - resolution: {integrity: sha512-ngJMaHlsWDTfjyq9F3VIQ8b7NXbBLq5j9i5bJ6XLYtD6qlDXT7fdKY2KscWWUF8t18xx052Y/PUO1K1TRc9yKA==} - - '@simple-git/argv-parser@1.1.0': - resolution: {integrity: sha512-sUKOu2lb5vGIWADNNLpscyj07DAeQZU3KLbnE2Tj53tW6BbDQKMly2CCfnR4oYzqtRELCPWfwaPg+Q0T8qfKBg==} - deprecated: Contains a breaking change that should be a major version bump - '@standard-schema/spec@1.1.0': resolution: {integrity: sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w==} @@ -5219,9 +5200,6 @@ packages: resolution: {integrity: sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==} engines: {node: '>=14'} - simple-git@3.36.0: - resolution: {integrity: sha512-cGQjLjK8bxJw4QuYT7gxHw3/IouVESbhahSsHrX97MzCL1gu2u7oy38W6L2ZIGECEfIBG4BabsWDPjBxJENv9Q==} - slide@1.1.6: resolution: {integrity: sha512-NwrtjCg+lZoqhFU8fOwl4ay2ei8PaqCBOUV3/ektPY9trO1yQ1oXEfmHAhKArUVUr/hOHvy5f6AdP17dCM0zMw==} @@ -6753,14 +6731,6 @@ snapshots: '@jridgewell/resolve-uri': 3.1.2 '@jridgewell/sourcemap-codec': 1.5.5 - '@kwsites/file-exists@1.1.1': - dependencies: - debug: 4.4.3(supports-color@8.1.1) - transitivePeerDependencies: - - supports-color - - '@kwsites/promise-deferred@1.1.1': {} - '@lezer/common@1.5.1': {} '@lezer/cpp@1.1.5': @@ -7246,12 +7216,6 @@ snapshots: '@shikijs/vscode-textmate@10.0.2': {} - '@simple-git/args-pathspec@1.0.3': {} - - '@simple-git/argv-parser@1.1.0': - dependencies: - '@simple-git/args-pathspec': 1.0.3 - '@standard-schema/spec@1.1.0': {} '@tailwindcss/node@4.2.3': @@ -10333,16 +10297,6 @@ snapshots: signal-exit@4.1.0: {} - simple-git@3.36.0: - dependencies: - '@kwsites/file-exists': 1.1.1 - '@kwsites/promise-deferred': 1.1.1 - '@simple-git/args-pathspec': 1.0.3 - '@simple-git/argv-parser': 1.1.0 - debug: 4.4.3(supports-color@8.1.1) - transitivePeerDependencies: - - supports-color - slide@1.1.6: {} sonic-boom@4.2.1: diff --git a/tests/e2e/support/environment/actor/actor.ts b/tests/e2e/support/environment/actor/actor.ts index 0b19b3c285..4f3ad5b754 100644 --- a/tests/e2e/support/environment/actor/actor.ts +++ b/tests/e2e/support/environment/actor/actor.ts @@ -36,6 +36,12 @@ export class ActorEnvironment extends EventEmitter implements Actor { if (exception.message.includes('ResizeObserver')) { return } + if ( + exception.message.includes('access control checks') && + exception.message.includes('preview=1') + ) { + return + } } // make the test fail if FAIL_ON_UNCAUGHT_CONSOLE_ERR=true if (this.options.context.failOnUncaughtConsoleError) { diff --git a/tests/e2e/support/objects/app-files/resource/actions.ts b/tests/e2e/support/objects/app-files/resource/actions.ts index 78c34a69d4..4250c3262c 100644 --- a/tests/e2e/support/objects/app-files/resource/actions.ts +++ b/tests/e2e/support/objects/app-files/resource/actions.ts @@ -144,6 +144,7 @@ const onlyOfficeCanvasEditorSelector = '#id_viewer_overlay' const onlyOfficeCanvasCursorSelector = '#id_target_cursor' const onlyOfficeInfoDialog = '.alert .info-box' const onlyOfficeInfoDialogConfirm = `.alert button[result="ok"]` + const fileThumbnail = `//img[@data-test-thumbnail-resource-name="%s"]` const fileIcon = '#oc-file-details-sidebar .details-icon' const fileIconPreview = '#oc-file-details-sidebar .details-preview' @@ -155,6 +156,7 @@ const openWithButton = '//*[@id="oc-files-context-actions-context"]//span[text() const tilesSlider = '#tiles-size-slider' const undoBtn = 'action-handler' const previewFavoriteButton = '.preview-controls-favorite' +const uploadList = '#upload-list' export const getResourceLocator = ({ page, @@ -637,14 +639,14 @@ const performUpload = async (args: uploadResourceArgs): Promise => { await clickResource({ page, path: to }) } - await page.locator(addNewResourceButton).click() const inputSelector = type === 'folder' ? folderUploadInput : fileUploadInput - await expect(page.locator(folderUploadInput)).toBeAttached() - let uploadAction: Promise = page .locator(inputSelector) .setInputFiles(resources.map((file) => file.path)) + await page.locator(addNewResourceButton).click() + await expect(page.locator(uploadList)).toBeVisible() + if (option) { await uploadAction