diff --git a/.eslintrc.js b/.eslintrc.js index 4434aecfdfe..7083e83cf7a 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -265,6 +265,8 @@ module.exports = { "jest/valid-expect": "off", "jest/valid-expect-in-promise": "off", "jest/no-done-callback": "off", + // covered by types, cypress plugins add extra options arguments + "jest/valid-describe-callback": "off", }, }, ], diff --git a/.github/workflows/cypress.yaml b/.github/workflows/cypress.yaml index 070dee5b5ea..3d07442c17d 100644 --- a/.github/workflows/cypress.yaml +++ b/.github/workflows/cypress.yaml @@ -199,6 +199,8 @@ jobs: CYPRESS_PULL_REQUEST_ID: ${{ needs.prepare.outputs.pr_id }} CYPRESS_PULL_REQUEST_URL: https://github.com/${{ github.repository }}/pull/${{ needs.prepare.outputs.pr_id }} + CYPRESS_grepTags: smoke + # pass the Percy token as an environment variable PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }} PERCY_ENABLE: ${{ needs.prepare.outputs.percy_enable }} diff --git a/cypress/e2e/composer/composer.spec.ts b/cypress/e2e/composer/composer.spec.ts index 85e258a127c..de260323d06 100644 --- a/cypress/e2e/composer/composer.spec.ts +++ b/cypress/e2e/composer/composer.spec.ts @@ -40,7 +40,7 @@ describe("Composer", () => { cy.createRoom({ name: "Composing Room" }).then((roomId) => cy.viewRoomById(roomId)); }); - it("sends a message when you click send or press Enter", () => { + it("sends a message when you click send or press Enter", { tags: ["smoke"] }, () => { // Type a message cy.findByRole("textbox", { name: "Send a messageā€¦" }).type("my message 0"); // It has not been sent yet diff --git a/cypress/e2e/create-room/create-room.spec.ts b/cypress/e2e/create-room/create-room.spec.ts index 1ebc1a7df7a..863d32e082e 100644 --- a/cypress/e2e/create-room/create-room.spec.ts +++ b/cypress/e2e/create-room/create-room.spec.ts @@ -25,7 +25,7 @@ function openCreateRoomDialog(): Chainable> { return cy.get(".mx_CreateRoomDialog"); } -describe("Create Room", () => { +describe("Create Room", { tags: ["smoke"] }, () => { let homeserver: HomeserverInstance; beforeEach(() => { diff --git a/cypress/e2e/crypto/crypto.spec.ts b/cypress/e2e/crypto/crypto.spec.ts index 3c815ab4088..4edb39996de 100644 --- a/cypress/e2e/crypto/crypto.spec.ts +++ b/cypress/e2e/crypto/crypto.spec.ts @@ -127,7 +127,7 @@ const verify = function (this: CryptoTestContext) { }); }; -describe("Cryptography", function () { +describe("Cryptography", { tags: ["smoke"] }, function () { let aliceCredentials: UserCredentials; beforeEach(function () { diff --git a/cypress/e2e/invite/invite-dialog.spec.ts b/cypress/e2e/invite/invite-dialog.spec.ts index ba6aa4040d4..67bbb50367f 100644 --- a/cypress/e2e/invite/invite-dialog.spec.ts +++ b/cypress/e2e/invite/invite-dialog.spec.ts @@ -17,7 +17,7 @@ limitations under the License. import type { MatrixClient } from "matrix-js-sdk/src/matrix"; import { HomeserverInstance } from "../../plugins/utils/homeserver"; -describe("Invite dialog", function () { +describe("Invite dialog", { tags: ["smoke"] }, function () { let homeserver: HomeserverInstance; let bot: MatrixClient; const botName = "BotAlice"; diff --git a/cypress/e2e/login/login.spec.ts b/cypress/e2e/login/login.spec.ts index 2bb7d4c6a00..9453d5a5f0d 100644 --- a/cypress/e2e/login/login.spec.ts +++ b/cypress/e2e/login/login.spec.ts @@ -19,7 +19,7 @@ limitations under the License. import { HomeserverInstance } from "../../plugins/utils/homeserver"; import { doTokenRegistration } from "./utils"; -describe("Login", () => { +describe("Login", { tags: ["smoke"] }, () => { let homeserver: HomeserverInstance; afterEach(() => { diff --git a/cypress/plugins/index.ts b/cypress/plugins/index.ts index 412057cf544..e34bba3b4ae 100644 --- a/cypress/plugins/index.ts +++ b/cypress/plugins/index.ts @@ -16,6 +16,7 @@ limitations under the License. /// import installLogsPrinter from "cypress-terminal-report/src/installLogsPrinter"; +import registerCypressGrep from "@cypress/grep/src/plugin"; import PluginEvents = Cypress.PluginEvents; import PluginConfigOptions = Cypress.PluginConfigOptions; @@ -32,6 +33,7 @@ import { mailhogDocker } from "./mailhog"; * @type {Cypress.PluginConfig} */ export default function (on: PluginEvents, config: PluginConfigOptions) { + registerCypressGrep(config); docker(on, config); synapseDocker(on, config); dendriteDocker(on, config); diff --git a/cypress/tsconfig.json b/cypress/tsconfig.json index bfff3775a4f..12c9a12f18c 100644 --- a/cypress/tsconfig.json +++ b/cypress/tsconfig.json @@ -3,7 +3,7 @@ "target": "es2016", "jsx": "react", "lib": ["es2020", "dom", "dom.iterable"], - "types": ["cypress", "cypress-axe", "@percy/cypress", "@testing-library/cypress"], + "types": ["cypress", "cypress-axe", "@percy/cypress", "@testing-library/cypress", "@cypress/grep"], "resolveJsonModule": true, "esModuleInterop": true, "moduleResolution": "node", diff --git a/package.json b/package.json index d6f63eed0c3..1323d23e51f 100644 --- a/package.json +++ b/package.json @@ -142,6 +142,7 @@ "@babel/register": "^7.12.10", "@babel/traverse": "^7.12.12", "@casualbot/jest-sonar-reporter": "^2.2.5", + "@cypress/grep": "^4.0.0", "@matrix-org/olm": "https://gitlab.matrix.org/api/v4/projects/27/packages/npm/@matrix-org/olm/-/@matrix-org/olm-3.2.14.tgz", "@peculiar/webcrypto": "^1.4.3", "@percy/cli": "^1.11.0", diff --git a/yarn.lock b/yarn.lock index 36fdf79b8b7..658ffcf6ae5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -442,6 +442,11 @@ resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.22.10.tgz#e37634f9a12a1716136c44624ef54283cabd3f55" integrity sha512-lNbdGsQb9ekfsnjFGhEiF4hfFqGgfOP3H3d27re3n+CGhNuTSUEQdfWk556sTLNTloczcdM5TYF2LhzmDQKyvQ== +"@babel/parser@^7.21.2": + version "7.22.14" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.22.14.tgz#c7de58e8de106e88efca42ce17f0033209dfd245" + integrity sha512-1KucTHgOvaw/LzCVrEOAyXkr9rQlp0A1HiHRYnSUE9dmb8PvPW7o5sscg+5169r54n3vGlbx6GevTE/Iw/P3AQ== + "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression@^7.22.5": version "7.22.5" resolved "https://registry.yarnpkg.com/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression/-/plugin-bugfix-safari-id-destructuring-collision-in-function-expression-7.22.5.tgz#87245a21cd69a73b0b81bcda98d443d6df08f05e" @@ -575,7 +580,7 @@ dependencies: "@babel/helper-plugin-utils" "^7.8.0" -"@babel/plugin-syntax-jsx@^7.22.5": +"@babel/plugin-syntax-jsx@^7.18.6", "@babel/plugin-syntax-jsx@^7.22.5": version "7.22.5" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.22.5.tgz#a6b68e84fb76e759fc3b93e901876ffabbe1d918" integrity sha512-gvyP4hZrgrs/wWMaocvxZ44Hw0b3W8Pe+cMxc8V1ULQ07oh8VNbIRaoD1LRZVTvD+0nieDKjfgKg89sD7rrKrg== @@ -1372,6 +1377,15 @@ resolved "https://registry.yarnpkg.com/@csstools/selector-specificity/-/selector-specificity-3.0.0.tgz#798622546b63847e82389e473fd67f2707d82247" integrity sha512-hBI9tfBtuPIi885ZsZ32IMEU/5nlZH/KOVYJCOh7gyMxaVLGmLedYqFN6Ui1LXkI8JlC8IsuC0rF0btcRZKd5g== +"@cypress/grep@^4.0.0": + version "4.0.0" + resolved "https://registry.yarnpkg.com/@cypress/grep/-/grep-4.0.0.tgz#d219259c62704d86651deceb0bd2d2e80ec5b559" + integrity sha512-5+X1P+GJmLp2IgX/OjoktJxFrezy4pYGI2wmi+574OTZ99yhNTesjKhMm0UJeEMAv9MjfihagroKbjdKNp/+og== + dependencies: + debug "^4.3.4" + find-test-names "^1.19.0" + globby "^11.0.4" + "@cypress/request@^2.88.11": version "2.88.12" resolved "https://registry.yarnpkg.com/@cypress/request/-/request-2.88.12.tgz#ba4911431738494a85e93fb04498cb38bc55d590" @@ -3105,7 +3119,7 @@ acorn-jsx@^5.3.2: resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.3.2.tgz#7ed5bb55908b3b2f1bc55c6af1653bada7f07937" integrity sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ== -acorn-walk@^8.0.2, acorn-walk@^8.1.1: +acorn-walk@^8.0.2, acorn-walk@^8.1.1, acorn-walk@^8.2.0: version "8.2.0" resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-8.2.0.tgz#741210f2e2426454508853a2f44d0ab83b7f69c1" integrity sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA== @@ -4342,7 +4356,7 @@ debug@2.6.9: dependencies: ms "2.0.0" -debug@4, debug@^4.1.0, debug@^4.1.1, debug@^4.3.2, debug@^4.3.4: +debug@4, debug@^4.1.0, debug@^4.1.1, debug@^4.3.2, debug@^4.3.3, debug@^4.3.4: version "4.3.4" resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865" integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== @@ -5460,6 +5474,18 @@ find-cache-dir@^2.0.0: make-dir "^2.0.0" pkg-dir "^3.0.0" +find-test-names@^1.19.0: + version "1.28.13" + resolved "https://registry.yarnpkg.com/find-test-names/-/find-test-names-1.28.13.tgz#871d5585d1f618ed772ffe544ea475ab4657ca83" + integrity sha512-hVatCLbiZmvBwqYNGTkVNbeJwK/8pvkXKQGji+23GzW8fVFHcEaRID77eQYItLKGwa1Tmu0AK2LjcUtuid57FQ== + dependencies: + "@babel/parser" "^7.21.2" + "@babel/plugin-syntax-jsx" "^7.18.6" + acorn-walk "^8.2.0" + debug "^4.3.3" + globby "^11.0.4" + simple-bin-help "^1.8.0" + find-up@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/find-up/-/find-up-3.0.0.tgz#49169f1d7993430646da61ecc5ae355c21c97b73" @@ -5796,7 +5822,7 @@ globalthis@^1.0.3: dependencies: define-properties "^1.1.3" -globby@^11.1.0: +globby@^11.0.4, globby@^11.1.0: version "11.1.0" resolved "https://registry.yarnpkg.com/globby/-/globby-11.1.0.tgz#bd4be98bb042f83d796f7e3811991fbe82a0d34b" integrity sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g== @@ -9066,6 +9092,11 @@ signal-exit@^4.0.1: resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-4.0.2.tgz#ff55bb1d9ff2114c13b400688fa544ac63c36967" integrity sha512-MY2/qGx4enyjprQnFaZsHib3Yadh3IXyV2C321GY0pjGfVBu4un0uDJkwgdxqO+Rdx8JMT8IfJIRwbYVz3Ob3Q== +simple-bin-help@^1.8.0: + version "1.8.0" + resolved "https://registry.yarnpkg.com/simple-bin-help/-/simple-bin-help-1.8.0.tgz#21bb82c6bccd9fa8678f9c0fadf2956b54e2160a" + integrity sha512-0LxHn+P1lF5r2WwVB/za3hLRIsYoLaNq1CXqjbrs3ZvLuvlWnRKrUjEWzV7umZL7hpQ7xULiQMV+0iXdRa5iFg== + sisteransi@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/sisteransi/-/sisteransi-1.0.5.tgz#134d681297756437cc05ca01370d3a7a571075ed"