summaryrefslogtreecommitdiff
path: root/cypress
diff options
context:
space:
mode:
authorKagami Sascha Rosylight <saschanaz@outlook.com>2023-03-01 07:24:09 +0100
committerGitHub <noreply@github.com>2023-03-01 15:24:09 +0900
commit6d82371449cc97f1ee8a7425b17ec536a3095640 (patch)
tree199afc9df4d21d20ab5e780b46a42a8d89a006bc /cypress
parentrefactor: plugin.tsの型を修正する (#10027) (diff)
downloadmisskey-6d82371449cc97f1ee8a7425b17ec536a3095640.tar.gz
misskey-6d82371449cc97f1ee8a7425b17ec536a3095640.tar.bz2
misskey-6d82371449cc97f1ee8a7425b17ec536a3095640.zip
fix(frontend): read KeyboardEvent.key instead of which/code (#10083)
Diffstat (limited to 'cypress')
-rw-r--r--cypress/e2e/basic.cy.js17
1 files changed, 15 insertions, 2 deletions
diff --git a/cypress/e2e/basic.cy.js b/cypress/e2e/basic.cy.js
index eb5195c4b2..fc3e6f35bc 100644
--- a/cypress/e2e/basic.cy.js
+++ b/cypress/e2e/basic.cy.js
@@ -17,7 +17,7 @@ describe('Before setup instance', () => {
cy.visit('/');
cy.intercept('POST', '/api/admin/accounts/create').as('signup');
-
+
cy.get('[data-cy-admin-username] input').type('admin');
cy.get('[data-cy-admin-password] input').type('admin1234');
cy.get('[data-cy-admin-ok]').click();
@@ -112,7 +112,7 @@ describe('After user signup', () => {
});
});
-describe('After user singed in', () => {
+describe('After user signed in', () => {
beforeEach(() => {
cy.resetState();
@@ -142,6 +142,19 @@ describe('After user singed in', () => {
cy.contains('Hello, Misskey!');
});
+
+ it('open note form with hotkey', () => {
+ // Wait until the page loads
+ cy.get('[data-cy-open-post-form]').should('be.visible');
+ // Use trigger() to give different `code` to test if hotkeys also work on non-QWERTY keyboards.
+ cy.document().trigger("keydown", { eventConstructor: 'KeyboardEvent', key: "n", code: "KeyL" });
+ // See if the form is opened
+ cy.get('[data-cy-post-form-text]').should('be.visible');
+ // Close it
+ cy.focused().trigger("keydown", { eventConstructor: 'KeyboardEvent', key: "Escape", code: "Escape" });
+ // See if the form is closed
+ cy.get('[data-cy-post-form-text]').should('not.be.visible');
+ });
});
// TODO: 投稿フォームの公開範囲指定のテスト