https://cypress.io logo
Join Discord
Powered by
# e2e-testing
  • f

    freezing-piano-2792

    11/16/2022, 4:41 PM
    @few-oyster-82478, @mysterious-belgium-25713, you can still use the
    And
    keyword in your
    .feature
    files
  • f

    freezing-piano-2792

    11/16/2022, 4:41 PM
    Not only can you, but you should, where appropriate
  • m

    mysterious-belgium-25713

    11/16/2022, 4:41 PM
    Oww so only in your spec def it will be routed to given/when/then
  • f

    few-oyster-82478

    11/16/2022, 4:47 PM
    ah, I see 👍
  • f

    few-oyster-82478

    11/16/2022, 4:48 PM
    by the way, in case there is an easy solution for this, I get this error in the
    .feature
    files:
  • f

    few-oyster-82478

    11/16/2022, 4:49 PM
    not a big deal, since it works nevertheless, but I could not find a solution yet
  • f

    freezing-piano-2792

    11/16/2022, 5:16 PM
    I'm guessing you're using the official Cucumber extension for vscode and that simply isn't tailored for Cypress + @freezing-piano-2792/cypress-cucumber-preprocessor, so your mileage may vary
  • f

    few-oyster-82478

    11/16/2022, 6:12 PM
    yes, that's the case
  • f

    few-oyster-82478

    11/16/2022, 6:15 PM
    if I disable it I don't get the error, but neither syntax highlighting, is there any alternative by any chance?
  • m

    mysterious-belgium-25713

    11/16/2022, 6:32 PM
    I think there is another cucumber plugin
  • m

    mysterious-belgium-25713

    11/16/2022, 6:32 PM
    I think it's called gherkin
  • r

    red-gpu-23661

    11/16/2022, 7:35 PM
    u need to add ur fetaures and defintion steps under E2E folder, also add this follonwog file '**.cypress-cucumber-preprocessorrc.json**' at root level:
    Copy code
    {
      "json": {
        "enabled": false,
        "output": "jsonlogs/log.json",
        "formatter": "cucumber-json-formatter.exe"
      },
      "messages": {
        "enabled": false,
        "output": "jsonlogs/messages.ndjson"
      },
      "html": {
        "enabled": false
      },
      "stepDefinitions": [
        "[filepath]/**/*.{js,ts}",
        "[filepath].{js,ts}",
        "cypress/e2e/definitions_etapes/*.{js,ts}"
      ]
    }
  • f

    few-oyster-82478

    11/16/2022, 8:23 PM
    yes, I have the features and the definition steps under
    cypress/e2e/
    , I've added
    .cypress-cucumber-preprocessorrc.json
    at
    cypress
    level with that config , but the official cucumber extension still shows the same error message regarding
    undefined steps
    (and it does not navigate to the steps either)
  • f

    few-oyster-82478

    11/16/2022, 8:25 PM
    I'll use the Gherkin extension, at least it shows highlightning
  • m

    mysterious-belgium-25713

    11/16/2022, 8:27 PM
    Also read the gherkin docs you have to alter your vscode settings to make it work a bit better.
    Copy code
    json
    {
        "cucumberautocomplete.steps": [
            "test/features/step_definitions/*.js",
            "node_modules/qa-lib/src/step_definitions/*.js"
        ],
        "cucumberautocomplete.strictGherkinCompletion": true
    }
  • m

    mysterious-belgium-25713

    11/16/2022, 8:28 PM
    You have to point to the folder where your step defs are
  • f

    few-oyster-82478

    11/16/2022, 9:09 PM
    yes, the Gherkin plugin is working great, autocomplete, going to steps, etc 👌
  • b

    billowy-librarian-83114

    11/16/2022, 10:47 PM
    I'm running into an issue with a confirmation alert not automatically clicking OK. it's a deletion confirmation if that matters
  • b

    billowy-librarian-83114

    11/16/2022, 11:27 PM
    Yeah I don't even see the confirmation showing up in the verbose cypress logs
  • l

    late-quill-17187

    11/17/2022, 8:28 AM
    Hello, i am new to Cypress and while writing an e2e test i am stuck , i am pushing div elements in an array and then trying to click each div in second loop and go back to previous page. but after "each" command Array length becomes 0 and unable to enter second loop.
  • b

    brash-scientist-28014

    11/17/2022, 9:38 AM
    @mysterious-belgium-25713 but how do you call/use it in a test then the command?
  • f

    fresh-doctor-14925

    11/17/2022, 9:39 AM
    I suspect that this is due to you not being explicit with the order of execution. What happens if you place a
    then()
    after the
    each()
    and put your length statement and for loop in there
  • m

    mysterious-belgium-25713

    11/17/2022, 9:39 AM
    Cypress.on is loaded by itself you dont call it like a function. Its just changing the behaviour of cypress
  • b

    brash-scientist-28014

    11/17/2022, 9:41 AM
    ah oke, ill check it out
  • l

    late-quill-17187

    11/17/2022, 10:04 AM
    thank you Liam this worked. one thing more. i am facing another issue in this code, due to use of go command elements becoming detached from DOM, so cypress throws error after first iteration of for loop. How to tackle this scenario in cypress?
  • f

    fresh-doctor-14925

    11/17/2022, 10:29 AM
    I don't know. I try not to write tests that click through each and every interactive element in sequence. Is it necessary to click each link to see if it works? If they're regular anchor tags, why not just assert on the
    href
    instead? Otherwise, Gleb wrote about solving element detachment problems a while back: https://glebbahmutov.com/blog/detached/
  • f

    fresh-doctor-14925

    11/17/2022, 1:11 PM
    You may also wish to consider using cypress-recurse instead. Stopping the loop when you reach the last of the elements https://www.npmjs.com/package/cypress-recurse/v/1.8.0
  • g

    gray-kilobyte-89541

    11/17/2022, 1:28 PM
    ohh this is a beautiful question, it deserves a blog post or a video. But here is a quick solution - instead of elements, grab the HREF links to the pages from anchor elements - move using the array of links into
    cy.then
    (any time you want to use something you get from the page, its value is available in the
    cy.then
    callback or via an alias) Stay tuned, I will show a solution and post it on my blog / youtube
  • t

    thankful-lock-39376

    11/17/2022, 2:47 PM
    Hi guys Does anyone know how to unblock cookies in cypress . In my github Microsoft authentication page when i login by giving the below code It shows that Your browser is currently set to block cookies. Or any other solution to access the page would be helpful. Prefferably not with api requests . describe("gitLogin with microsoft SSO", () => { it("gitLogin with microsoft", () => { cy.visit("https://github.com/login"); cy.get("[name='login']").type("user@web.net"); cy.get("[name='password']").type("password123"); cy.get("[name='commit']").click(); cy.get("[data-target='webauthn-get.button']").click(); cy.get("[class='dropdown-caret']").last().click(); cy.wait(3000); cy.get("span:contains(projectName)").last().click(); cy.get("[type='submit']").click(); cy.origin("https://login.microsoftonline.com/", { args: { username: "user@web.net", password: "password123", ssoUsernameBox: "[name='loginfmt']", nextButton: "[id='idSIButton9']", ssoPasswordBox: "[name='passwd']", }, }, ({ username, password, ssoUsernameBox, ssoPasswordBox, nextButton }) => { cy.log(username); const uName = username; cy.get(ssoUsernameBox).clear().type(uName); cy.get(nextButton).click(); cy.wait(3000); cy.get(ssoPasswordBox).type(password, { log: false }).should(el$ => { if (el$.val() !== password) { throw new Error('Different value of typed password'); } }); cy.get(nextButton).click(); }); }); });
  • t

    thankful-lock-39376

    11/17/2022, 2:49 PM
    If anywant want to reproduce it, as it would need password pls reply to this thread . also as i am new to this discord community pls point out any of my mistakes
1...144145146...192Latest