Skip to content
This repository has been archived by the owner on Jul 26, 2024. It is now read-only.

Commit

Permalink
feat: LEAP-447: Add helper methods for Modals, Number, ToolBar (#24)
Browse files Browse the repository at this point in the history
feat: LEAP-447: Add helper methods for warning modals, Number tag and toolbar
  • Loading branch information
Gondragos authored Jan 30, 2024
1 parent 9ff949f commit 2619550
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 2 deletions.
25 changes: 24 additions & 1 deletion helpers/LSF/Modals.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,37 @@
/**
* An object representing different methods for interacting with modals.
*/
export const Modals = {
/**
* Gets the warning modal.
* @returns {Cypress.Chainable<JQuery<HTMLElement>>} - The warning modal.
*/
get warning() {
return cy.get('.ant-modal.ant-modal-confirm-warning');
},
hasWarning(text) {

/**
* Checks if the warning modal contains certain text.
* @param {string} text - The text to check for in the modal.
*/
hasWarning(text: string) {
this.warning.should('be.visible');
this.warning.contains('Warning').should('be.visible');
this.warning.contains(text).should('be.visible');
this.warning.contains('OK').should('be.visible');
},

/**
* Checks that there are no warning modals.
*/
hasNoWarnings() {
this.warning.should('not.exist');
},

/**
* Closes the warning modal.
*/
closeWarning() {
this.warning.find('.ant-modal-confirm-btns .ant-btn').contains('OK').click();
},
};
6 changes: 5 additions & 1 deletion helpers/LSF/Number.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class NumberHelper {
return '.lsf-number';
}

private _rootSelector: string
private _rootSelector: string;

constructor(rootSelector) {
this._rootSelector = rootSelector.replace(/^\&/, this._baseRootSelector);
Expand All @@ -20,6 +20,10 @@ class NumberHelper {
.find('[type="number"]');
}

selectAll() {
this.input.type('{selectAll}');
}

type(text: string) {
this.input.type(text);
}
Expand Down
4 changes: 4 additions & 0 deletions helpers/LSF/ToolBar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,8 @@ export const ToolBar = {
.eq(annotationIndex)
.click();
},

clickSubmit() {
this.submitBtn.click();
},
};

0 comments on commit 2619550

Please sign in to comment.