Skip to content

Commit

Permalink
Replace get search field with get dialog and find search field
Browse files Browse the repository at this point in the history
  • Loading branch information
felixhabib committed Mar 1, 2024
1 parent aae4268 commit 893e393
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions cypress/support/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,9 @@ export const assertCodePaneHasFocus = () => {
export const findInCode = (term) => {
cy.wait(200); // eslint-disable-line @finsit/cypress/no-unnecessary-waiting
typeCode(`{${cmdPlus('f')}}`);
cy.get('.CodeMirror-search-field').type(`${term}{enter}`);
cy.get('.CodeMirror-dialog')
.find('.CodeMirror-search-field')
.type(`${term}{enter}`);
};

/**
Expand All @@ -209,9 +211,13 @@ export const findInCode = (term) => {
export const replaceInCode = (term, replaceWith) => {
cy.wait(200); // eslint-disable-line @finsit/cypress/no-unnecessary-waiting
typeCode(`{${cmdPlus('alt+f')}}`);
cy.get('.CodeMirror-search-field').type(`${term}{enter}`);
cy.get('.CodeMirror-dialog')
.find('.CodeMirror-search-field')
.type(`${term}{enter}`);
if (replaceWith) {
cy.get('.CodeMirror-search-field').type(`${replaceWith}{enter}`);
cy.get('.CodeMirror-dialog')
.find('.CodeMirror-search-field')
.type(`${replaceWith}{enter}`);
}
};

Expand All @@ -221,7 +227,9 @@ export const replaceInCode = (term, replaceWith) => {
export const jumpToLine = (line) => {
cy.wait(200); // eslint-disable-line @finsit/cypress/no-unnecessary-waiting
typeCode(`{${cmdPlus('g')}}`);
cy.get('.CodeMirror-search-field').type(`${line}{enter}`);
cy.get('.CodeMirror-dialog')
.find('.CodeMirror-search-field')
.type(`${line}{enter}`);
};

/**
Expand Down

0 comments on commit 893e393

Please sign in to comment.