Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update V2.1.45 #121

Merged
merged 3 commits into from
Jun 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions dist/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
/// <reference types="cypress" />
// @ts-nocheck
const tt_accessibility_1 = require("./commands/tt-accessibility");
const tt_click_if_eement_exist_1 = require("./commands/tt-click-if-eement-exist");
const tt_click_if_element_exist_1 = require("./commands/tt-click-if-element-exist");
const tt_cookie_all_accept_1 = require("./commands/tt-cookie-all-accept");
const tt_detect_http_1 = require("./commands/tt-detect-http");
const tt_element_exists_1 = require("./commands/tt-element-exists");
Expand All @@ -23,7 +23,7 @@ const tt_validate_no_google_services_1 = require("./commands/tt-validate-no-goog
const tt_validate_page_content_1 = require("./commands/tt-validate-page-content");
const tt_validate_subpages_and_images_1 = require("./commands/tt-validate-subpages-and-images");
Cypress.Commands.add('ttAccessibility', tt_accessibility_1.ttAccessibility);
Cypress.Commands.add('ttClickIfElementExist', tt_click_if_eement_exist_1.ttClickIfElementExist);
Cypress.Commands.add('ttClickIfElementExist', tt_click_if_element_exist_1.ttClickIfElementExist);
Cypress.Commands.add('ttCookieAllAcceptClick', tt_cookie_all_accept_1.ttCookieAllAcceptClick);
Cypress.Commands.add('ttDetectHttp', tt_detect_http_1.ttDetectHttp);
Cypress.Commands.add('ttElementExists', tt_element_exists_1.ttElementExists);
Expand Down
17 changes: 17 additions & 0 deletions dist/commands/tt-click-if-element-exist.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ttClickIfElementExist = void 0;
// src/commands/tt-click-if-element-exist.ts
const ttClickIfElementExist = (selector) => {
cy.log(`ttClickIfElementExist - Checking if element exists: ${selector}`);
return cy.get('body').then(($body) => {
if ($body.find(selector).length > 0) {
cy.log(`Element found: ${selector}. Clicking...`);
cy.get(selector).click();
}
else {
cy.log(`Element not found: ${selector}. Skipping click.`);
}
});
};
exports.ttClickIfElementExist = ttClickIfElementExist;
17 changes: 17 additions & 0 deletions dist/commands/tt-click-if-elment-exist.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ttClickIfElementExist = void 0;
// src/commands/tt-click-if-element-exist.ts
const ttClickIfElementExist = (selector) => {
cy.log(`ttClickIfElementExist - Checking if element exists: ${selector}`);
return cy.get('body').then(($body) => {
if ($body.find(selector).length > 0) {
cy.log(`Element found: ${selector}. Clicking...`);
cy.get(selector).click();
}
else {
cy.log(`Element not found: ${selector}. Skipping click.`);
}
});
};
exports.ttClickIfElementExist = ttClickIfElementExist;
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cypress-ncatestify-plugin",
"version": "2.1.44",
"version": "2.1.45",
"description": "NCA TESTIFY commands and tests",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
5 changes: 5 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,11 @@ cy.ttNoConsoleErrors()
cy.ttValidateSubpagesAndImages()
```

### Click if element element exits
```js
cy.ttClickIfElementExist()
```

Open
http://localhost:8090

Expand Down
2 changes: 1 addition & 1 deletion src/commands.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/// <reference types="cypress" />
// @ts-nocheck
import { ttAccessibility } from './commands/tt-accessibility'
import { ttClickIfElementExist } from './commands/tt-click-if-eement-exist'
import { ttClickIfElementExist } from './commands/tt-click-if-element-exist'
import { ttCookieAllAcceptClick } from './commands/tt-cookie-all-accept'
import { ttDetectHttp } from './commands/tt-detect-http'
import { ttElementExists } from './commands/tt-element-exists'
Expand Down
Loading