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

    cold-van-45410

    09/19/2022, 8:01 AM
    How can we assert video in cypress? I want assert 1. video should not be corrupted 2. Video length should be correct 3. video should play correctly
  • c

    curved-morning-53652

    09/19/2022, 8:54 AM
    Hi Members I would like to know if it is possible to create cypress tests even when the website is not developed yet. Or if the website is missing some features and those features are the in the design, can cypress be used for that too? Can cypress be used for the design that has been made, for e.g. in Figma?
  • f

    fast-motherboard-28167

    09/19/2022, 10:34 AM
    Hi. Can someone help with a simple sensor array readout configuration on PSoC 6? I have a CY8CPROTO-062-4343W. Just need some help with digital outputs, multiplexing signals to ADC and configuring the ADC.
  • h

    happy-dinner-13480

    09/19/2022, 2:03 PM
    I have a
    table
    with a variable number of
    tr
    elements. Each
    tr
    is clickable and when clicked a modal opens (always the same modal for each
    tr
    ). In the modal a toggle has to be set:
    Copy code
    typescript
    it('Set payment methods', () => {
        cy.el('tablePaymentMethods')
            .children()
            .each(($el, index) => {
                cy.intercept({
                    method: 'PATCH',
                    url: `${Cypress.env('API_URL')}/api/v1/company/*/paymentMethod/*?cache_buster=*`,
                }).as('paymentMethod');
                cy.wrap($el).click();
                cy.el('toggleActive').click();
                cy.el('btnEditPaymentMethod').click();
                cy.wait('@paymentMethod').then((data: any) => {
                    expect(data.response.body.data.active).to.eq(true);
                });
            });
    });
    The problem with this test is that Cypress executes them at the same time, showing me the error: > is being covered by another element I can use
    force: true
    to still click on the toggle but I would much rather wait with clicking on the second
    tr
    when the
    cy.wait()
    has gotten a response (meaning the first modal is closed).
  • a

    acceptable-hamburger-48790

    09/19/2022, 2:22 PM
    shouldnt you be waiting for the intercept to complete after cy.wrap($el).click();
  • h

    happy-dinner-13480

    09/19/2022, 2:36 PM
    it doesn't really matter since the test executes the code at the same time
  • g

    gifted-bear-34349

    09/19/2022, 4:06 PM
    So I have a question checking for the text that loads on a page. I have a test that will visit a page and using
    cy.contains('Some text).should('exist')
    checks to see if the text we want is displaying on the page. I refactored it to look like this:
    Copy code
    before(() => {
        cy.fixture("users.json").then(() => {
          cy.login(Cypress.env("username"), Cypress.env("password"));
          cy.intercept({
            method: 'GET',
            url: apiUrl
          }).as('body');
          cy.visitApp("/help?lang=eng");
        });
      });
    
      it("fsy_help_page : Smoke Test", function () {
        cy.get("h1").contains("Help").should("exist");
        cy.wait('@body').then((intercept) => {
          let pageText = intercept.response.body.body;
    //removes all the html tags present in text
          let cleanPageText = pageText.replaceAll(/<(.+?)>/g, "").replaceAll(/ | /g, " ").split("\n").filter(entry => entry.trim() != '');
          cleanPageText.forEach(paragraph => {
            cy.contains(paragraph).should('exist');
          });
        });
        cy.get('main').within((body) => {
          if (body.find('a').length > 0) {
            cy.get('a').each(($el) => {
              cy.wrap($el).should("have.attr", "href");
            })
          }
        });
      });
    I was wondering if there is a functional difference between the two approaches
  • b

    bitter-fountain-36713

    09/19/2022, 4:07 PM
    I think you are looking for the cypress semiconductor group.
  • f

    fresh-nail-30646

    09/19/2022, 7:47 PM
    Does anybody have a good example of using
    cy.task()
    to query a Postgres db? The example for MySQL in documentation is great, but can't find something that works with Postgres.
  • c

    cold-van-45410

    09/20/2022, 5:50 AM
    Best way to make reports in cypress?
  • w

    worried-shampoo-96177

    09/20/2022, 5:57 AM
    beforeEach(function () { Cypress.Cookies.preserveOnce( "id", "rememberMeToken", "loginId", "userName", "image", "isRememberMe", "activePageNum", "role", "userLevelType", "isAdmin" ); }); it("logIN",()=>{ cy.visit('/') cy.get('[name="userName"]').type('webautomation') cy.get('[name="password"]').type('1') cy.get('[aria-label="Sign in"]').click({force:true}) cy.wait(5000) }) it("privacy",()=>{ cy.wait(5000) cy.get('[href="/pages/web/privacyPolicy"]').click() }) it("accessibility",()=>{ // cy.get('[name="menuBtn"]').click() cy.get('[href="/pages/web/accessibility"]').click() }) it("vehicle tips",()=>{ // cy.get('[name="menuBtn"]').click() cy.get('[href="/pages/web/vehicleTips"]').click() })
  • w

    worried-shampoo-96177

    09/20/2022, 5:58 AM
    If there is an alternative to cypress.cookies.preserveOnce in version 10 please share a link. If there is no video, please make one. Thank you very much.
  • g

    gray-kilobyte-89541

    09/20/2022, 10:41 AM
    https://cypress.tips/search
  • m

    mysterious-belgium-25713

    09/20/2022, 1:52 PM
    Does anybody have a good example of
  • m

    microscopic-fish-5767

    09/20/2022, 2:27 PM
    Hi everyone!! I wan´t to connect Cypress with a Oracle DB and i don´t know how. I´m searching from information in internet but it ´t work from me. Can anyone help me please? Thanks!!
  • m

    mysterious-belgium-25713

    09/20/2022, 2:49 PM
    Hi @microscopic-fish-5767 , i think its almost the same as how i did it for postgres. check this thread how i setup postgres. https://discord.com/channels/755913899261296641/1021507971861200918 but instead of postgres npm module you need to use oracledb and use the connection settings explained in the https://oracle.github.io/node-oracledb/doc/api.html#getstarted If that is not enough i maybe can try and create a demo project tomorrow for you and see if i can get it up and running.
  • m

    microscopic-fish-5767

    09/20/2022, 3:36 PM
    Hi @mysterious-belgium-25713 I've been following this: https://stackoverflow.com/questions/73309524/cypress-10-and-connecting-to-an-oracle-database
  • m

    microscopic-fish-5767

    09/20/2022, 3:37 PM
    This is my test: describe ("I do a test database call", () => { // Again this is an example query for obvious reasons const query = "SELECT * FROM cellular_call_restrictions" cy.task("sqlQuery", query).then((resolvedValue: any) => { resolvedValue["rows"].forEach((item: any) => { console.log("result==>" + item); }); }) })
  • m

    microscopic-fish-5767

    09/20/2022, 3:38 PM
    this my cypress.config.ts: import { defineConfig } from "cypress"; import createBundler from "@gray-kilobyte-89541/cypress-esbuild-preprocessor"; import { addCucumberPreprocessorPlugin } from "@freezing-piano-2792/cypress-cucumber-preprocessor"; import createEsbuildPlugin from "@freezing-piano-2792/cypress-cucumber-preprocessor/esbuild"; const oracledb = require("oracledb"); oracledb.initOracleClient({ libDir: "C:\\Oracle\\instantclient_19_3\\oci.dll" }); // This data is correct, I've obscured it for obvious reasons const db_config = { "user": "", "password": "", "connectString": "(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=melideo.claro.amx)(PORT=1521))(CONNECT_DATA=(SID=ARTPROD)))" } const queryData = async(query, dbconfig) => { let conn; try{ // It's failing on this getConnection line conn = await oracledb.getConnection(dbconfig); console.log("NOTE===>connect established") return await conn.execute(query); }catch(err){ console.log("Error===>"+err) return err } finally{ if(conn){ try{ conn.close(); }catch(err){ console.log("Error===>"+err) } } } } async function setupNodeEvents( on: Cypress.PluginEvents, config: Cypress.PluginConfigOptions ): Promise { await addCucumberPreprocessorPlugin(on, config); on("file:preprocessor", createBundler({ plugins: [createEsbuildPlugin(config)], }) ); on("task", { sqlQuery: (query) => { return queryData(query, db_config); }, }); return config; } export default defineConfig({ e2e: { specPattern: "**/*.feature", supportFile: false, setupNodeEvents, }, });
  • m

    microscopic-fish-5767

    09/20/2022, 3:40 PM
    and this my depencies and devdepencies:
  • m

    mysterious-belgium-25713

    09/20/2022, 3:42 PM
    If i have time later today I will see if i can recreate or alter a part of it to see if i can get it to work
  • m

    mammoth-knife-96508

    09/20/2022, 3:50 PM
    hi Cypress community, i’m an engineer at Handshake and i’ve been working closely with our internal developer experience team to explore implementing Cypress for E2E testing in our codebase for the past couple of sprints. we’ve looked into several approaches to get Cypress running in CI but none of them are particularly straightforward. i’m looking for guidance on what high level approach would make the most sense for our codebase - is there anyone that i could consult with here?
  • g

    gray-kilobyte-89541

    09/20/2022, 4:23 PM
    https://on.cypress.io/ci plus my workshop for CI https://cypress.tips/workshops if you are interested
  • l

    limited-barista-33480

    09/20/2022, 4:28 PM
    Hi Team, can someone help me with this error. I am trying to run a test automation from cypress.
  • b

    bitter-fountain-36713

    09/20/2022, 4:45 PM
    looks like an error with
    aws-iot-device-sdk
    package
  • q

    quaint-yacht-91780

    09/20/2022, 4:50 PM
    Could some help me with achieving data driven approach through excel sheet..while doing so we are unable to pass the test data to web app
  • l

    limited-barista-33480

    09/20/2022, 4:51 PM
    @bitter-fountain-36713 yes, I think it could be the path that I am calling, I don't know how to call the path from the cypress test spec.cy.js
  • p

    polite-lunch-8069

    09/20/2022, 5:08 PM
    Hi! Is it possible to check if random number exists on page if it was formatted?
  • p

    polite-lunch-8069

    09/20/2022, 5:10 PM
    My test is passing random number in range 1200-2048, then it is formatted to 1,200, 2,048 etc. How do I check if number was saved using the same const?
  • b

    bitter-fountain-36713

    09/20/2022, 5:33 PM
    You can create another const that formats the random number and use that to check the page.
1...104105106...192Latest