Title: Add: Cucumber/Gherkin step detection and assertion logging for test observability by prathams-cmd · Pull Request #1053 · browserstack/browserstack-cypress-cli · GitHub
Open Graph Title: Add: Cucumber/Gherkin step detection and assertion logging for test observability by prathams-cmd · Pull Request #1053 · browserstack/browserstack-cypress-cli
X Title: Add: Cucumber/Gherkin step detection and assertion logging for test observability by prathams-cmd · Pull Request #1053 · browserstack/browserstack-cypress-cli
Description: What is this about? Assertions logs and Cucumber/Gherkin step definitions were not showing up in observability log. I used Cypress log:changed event to detect these. I used createdAt and updatedAt timestamps and pushed COMMAND_START and COMMAND_END events for assertions logs and passed it as test_observability_command. The functions for showing cucumber step definitions were already placed I just detected them and passed it as test_observability_step. Related Jira task/s https://browserstack.atlassian.net/browse/SDK-4928 https://browserstack.atlassian.net/browse/SDK-4865 Automation cases to add Cypress test script it('displays two todo items by default', () => { cy.log('Verifying default todo items are displayed') // should (length) cy.get('.todo-list li').should('have.length', 2) // expect (first item text) cy.get('.todo-list li').first().then(($first) => { expect($first.text()).to.equal('Pay electric bill') }) // assert (last item text) cy.get('.todo-list li').last().then(($last) => { assert.include($last.text(), 'Walk the dog', 'Last item contains expected text') }) }) Cucumber test script import { Given, When, Then, defineStep } from "@badeball/cypress-cucumber-preprocessor"; import "cypress-xpath"; import Login from "../pages/login.page"; import Purchase from "../pages/purchase.page"; import Orders from "../pages/orders.page"; const login = new Login(); const purchase = new Purchase(); const orders = new Orders(); Given("I navigate to website", () => { cy.visit(Cypress.config().baseUrl + "signin"); }); defineStep("I wait for the page to load", () => { cy.document().its("readyState").should("eq", "complete"); }); When("I SignIn as {string} with {string} password", (username, password) => { login .username() .should("be.visible") .click({ force: true }) .type(username + "{enter}"); login .password() .click({ force: true }) .type(password + "{enter}"); login.logInButton().click(); }); When("I add three products to cart", () => { purchase.item1().click({ force: true }); purchase.item2().click({ force: true }); purchase.item3().click({ force: true }); }); When("I click on Buy Button", () => { purchase.buyButton().click({ force: true }); }); When( "I enter shipping details {string}, {string}, {string}, {string} and {string}", (first, last, address, province, pincode) => { cy.get("#firstNameInput").type(first); cy.get("#lastNameInput").type(last); cy.get("#addressLine1Input").type(address); cy.get("#provinceInput").type(province); cy.get("#postCodeInput").type(pincode); } ); When("I click on Checkout Button", () => { orders.checkout().click(); cy.contains("Continue ").click(); }); When("I click on {string} link", (link) => { cy.contains(link).click(); }); Then("I should see elements in list", () => { cy.xpath("/html/body/div/main/div/div/div/div[2]/div/div[2]") .children("div") .should("have.length", 3); cy.pause(); }); Code changes to check Please ensure that the following guidelines are being followed Spread operator is not used. Used syntax is supported by node 12+. Ex. No ? operator. Checklist Has it been approved by a member of your team? Has it been tested with obfuscation locally? Refer this. Have release notes been added to nodejs.yml? Required automation cases are added in description. PR Validations SCA: Comment RUN_SCA to trigger SCA check. Run Tests: Comment RUN_TESTS to trigger tests. Note: Make sure to pull the latest main branch changes in your branch before running the check.
Open Graph Description: What is this about? Assertions logs and Cucumber/Gherkin step definitions were not showing up in observability log. I used Cypress log:changed event to detect these. I used createdAt and updatedAt ...
X Description: What is this about? Assertions logs and Cucumber/Gherkin step definitions were not showing up in observability log. I used Cypress log:changed event to detect these. I used createdAt and updatedAt ...
Opengraph URL: https://github.com/browserstack/browserstack-cypress-cli/pull/1053
X: @github
Domain: github.com
IPv4 address: 140.82.112.3
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:e7dd5d54-0ad2-6a2f-c8d5-107c4dddb126 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | A740:27A224:60A809:82D292:6B0441C0 |
| html-safe-nonce | ef419b9336363d3fa2dfcebbc3b26db76e025f69a628d8fa093b729aab2dd9df |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNzQwOjI3QTIyNDo2MEE4MDk6ODJEMjkyOjZCMDQ0MUMwIiwidmlzaXRvcl9pZCI6IjEzNDA2MTUzOTAxNDc1NDc1MiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 97d6313d8e6d2e7b028b165ef8634a20bf82e07c679f0fbeee82c38d8efb0d5e |
| hovercard-subject-tag | pull_request:3276538174 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/browserstack/browserstack-cypress-cli/pull/1053/files |
| twitter:image | https://avatars.githubusercontent.com/u/254613254?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/254613254?s=400&v=4 |
| og:image:alt | What is this about? Assertions logs and Cucumber/Gherkin step definitions were not showing up in observability log. I used Cypress log:changed event to detect these. I used createdAt and updatedAt ... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 9185ccfefd80c1ff2d9ddcdb0cd2becf46b5a1efbbf30741a895e4bb8de25e64 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/browserstack/browserstack-cypress-cli git https://github.com/browserstack/browserstack-cypress-cli.git |
| octolytics-dimension-user_id | 1119453 |
| octolytics-dimension-user_login | browserstack |
| octolytics-dimension-repository_id | 242935045 |
| octolytics-dimension-repository_nwo | browserstack/browserstack-cypress-cli |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 242935045 |
| octolytics-dimension-repository_network_root_nwo | browserstack/browserstack-cypress-cli |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 06dc448a76fe4751ac1db26524aefa3aa3e889a8 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | no-cache |
Viewport: width=device-width