https://cypress.io logo
Join DiscordCommunities
Powered by
# e2e-testing
  • s

    stocky-salesclerk-42224

    01/13/2023, 12:14 PM
    Hi there. I need your help. I need to send notification in slack via request about all test results. The request works fine in hooks and inside a test, but i use in support/e2e.js this code Cypress.on("after:run", (results) => { cy.request({ method: 'POST',.....} and it does not work for me.
  • n

    nutritious-hydrogen-65702

    01/13/2023, 12:14 PM
    actually on visiting page , the data at the backend is able to load , and yes it is in jquery and the test-script is excuted
  • g

    gray-kilobyte-89541

    01/13/2023, 12:31 PM
    so you can wait for the page jQuery object to have a method. On https://cypress.tips/search search for "jquery" to find my blog post
  • n

    nutritious-hydrogen-65702

    01/13/2023, 12:57 PM
    i am using the scripting inside the cy.origin and cy.intercept() is not supported any more solution?
  • d

    dry-portugal-25841

    01/13/2023, 1:21 PM
    Hi, i'm getting this messages when running tests in bitbucket pipeline :
    Copy code
    ERROR:zygote_host_impl_linux.cc(263)] Failed to adjust OOM score of renderer with pid 552: Permission denied (13)
    ERROR:gpu_memory_buffer_support_x11.cc(44)] dri3 extension not supported.
    libva error: vaGetDriverNameByIndex() failed with unknown libva error, driver_name = (null)
    Browser: Electron 106 headless After searching it up looks like it's browser issue, not Cypress. Tests pass, so it's not a critical problem, but maybe someone knows the solution, if there is one.
  • e

    early-egg-66445

    01/13/2023, 2:30 PM
    Hello
  • e

    early-egg-66445

    01/13/2023, 2:30 PM
    Can someone help me out with cypress in a laravel+keycloak application?
  • e

    early-egg-66445

    01/13/2023, 2:32 PM
    I have laravel running on localhost:8001 and keycloak running on keycloak:8080. When I run cypress, it starts on
    http://localhost:8001/__/#/specs
    , but when I run any tests it changes to
    http://keycloak:8080/__/#/specs/runner?file=cypress/e2e/dashboard/login.cy.js
    .
  • e

    early-egg-66445

    01/13/2023, 2:32 PM
    On top level browser address
  • e

    early-egg-66445

    01/13/2023, 2:33 PM
    Is this normal?
  • m

    magnificent-finland-58048

    01/13/2023, 2:33 PM
    what's the baseURL
  • m

    magnificent-finland-58048

    01/13/2023, 2:33 PM
    in Cypress config
  • e

    early-egg-66445

    01/13/2023, 2:33 PM
    Copy code
    js
    module.exports = defineConfig({
      e2e: {
        baseUrl: 'http://localhost:8001',
  • e

    early-egg-66445

    01/13/2023, 2:34 PM
    It's localhost:8001
  • m

    magnificent-finland-58048

    01/13/2023, 2:34 PM
    does anything fail?
  • e

    early-egg-66445

    01/13/2023, 2:35 PM
    The test doesn't fail, but it fails to properly login on laravel
  • e

    early-egg-66445

    01/13/2023, 2:35 PM
    I thought it had something to do with this
  • m

    magnificent-finland-58048

    01/13/2023, 2:36 PM
    you might have to use the cy.session way of doing things with that, basically you want a redirect to the original origin
  • m

    magnificent-finland-58048

    01/13/2023, 2:36 PM
    is it just clicking ui without cy.session?
  • e

    early-egg-66445

    01/13/2023, 2:37 PM
    yes
  • e

    early-egg-66445

    01/13/2023, 2:37 PM
    Here's the test:
    Copy code
    js
    context('Login', () => {
        it('should login the test user in .env', () => {
            cy.login(Cypress.env().testUser, Cypress.env().testPassword)
        })
    })
    Here's the command:
    Copy code
    js
    Cypress.Commands.add('login', (username, password) => {
        cy.visit('/')
        cy.get('#username').type(username)
            .get('#password').type(password)
            .get('#kc-login').click()
    });
  • m

    magnificent-finland-58048

    01/13/2023, 2:37 PM
    try something like this https://github.com/muratkeremozcan/auth0-cypress/blob/master/cypress/support/commands.js#L3
  • m

    magnificent-finland-58048

    01/13/2023, 2:37 PM
    beyond that, you need a reproducible repo
  • e

    early-egg-66445

    01/13/2023, 2:42 PM
    Like this?
    Copy code
    js
    Cypress.Commands.add('login', (username, password) => {
        const args = { username, password }
        cy.session(args, () => {
            cy.visit('/')
            cy.origin('http://keycloak:8080', { args }, (args) => {
                cy.get('#username').type(args.username)
                    .get('#password').type(args.password)
                    .get('#kc-login').click()
            })
        });
        return cy.visit('/')
    });
  • e

    early-egg-66445

    01/13/2023, 2:42 PM
    It complains that I'm trying to cy.origin into the same url
  • e

    early-egg-66445

    01/13/2023, 2:44 PM
    The thing that I see that's different between your example and my case is that when I visit / it immediately redirects to keycloak, while yours only goes to AUTH_URL when you click. Don't know if it makes any difference
  • m

    magnificent-finland-58048

    01/13/2023, 2:47 PM
    the other origin is 8081 right? So, why not.
    cy.origin('http://keycloak:8081
  • m

    magnificent-finland-58048

    01/13/2023, 2:48 PM
    the url argument of cy.origin (cofusingly) has to be the other domain than your baseUrl
  • m

    magnificent-finland-58048

    01/13/2023, 2:49 PM
    the error says the same thing
  • e

    early-egg-66445

    01/13/2023, 2:50 PM
    The app is running on localhost:8001 and keycloak is running on keycloak:8080
1...186187188...192Latest