Skip to content

Commit

Permalink
Update typeInEditor
Browse files Browse the repository at this point in the history
  • Loading branch information
sidharthv96 committed Apr 13, 2023
1 parent c821848 commit e789adf
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions cypress/e2e/util.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
export const cmd = `{${Cypress.platform === 'darwin' ? 'meta' : 'ctrl'}}`;
export const getEditor = () => cy.get('#editor textarea:first');

interface EditorOptions {
bottom?: boolean;
Expand All @@ -10,13 +9,14 @@ export const typeInEditor = (
text: string,
{ bottom = true, newline = false }: EditorOptions = {}
) => {
cy.get('#editor textarea:first').click();
if (bottom) {
getEditor().type('{pageDown}');
cy.focused().type('{pageDown}');
}
if (newline) {
getEditor().type('{enter}');
cy.focused().type('{enter}');
}
getEditor().type(text);
cy.focused().type(text);
};

const downloadsFolder = Cypress.config('downloadsFolder');
Expand Down

0 comments on commit e789adf

Please sign in to comment.