https://cypress.io logo
Join DiscordCommunities
Powered by
# help
  • m

    mysterious-belgium-25713

    10/08/2022, 9:00 PM
    I didn't have time to check your website. But what do you need to test with email. If you need to validate the mailto url then i would just get the property of the link. If the usecase is to really send a mail then i think you should not test it with Cypress if the button opens a mail client.
  • s

    stale-optician-85950

    10/08/2022, 9:00 PM
    2) Similar to how we approached the Facebook button, I suggest you validate what's in the HTML code rather than the OS Mail To pop-up box. This href is not an API so you cannot
    cy.request
    but you can verify that
    mailto
    is present:
    Copy code
    describe('Test application', () => {
      it('Validate email button', () => {
        // stop the cookie banner from appearing by setting the cookie
        cy.setCookie('consentUUID', '57261086-58c8-4b80-9c02-647d417b9861_12');
        cy.visit('https://www.businessinsider.com/ikea-nyc-store-planning-studio-tour-2019-4');
        cy.get('[aria-label="Click to email"][data-e2e-name="share-link-email"]')
          .first()
          .invoke('attr', 'href')
          .then(email => {
            cy.log('email link:', email);
    
            expect(email).to.include("mailto:?subject=I visited Ikea's new Manhattan location");
            expect(email).to.include('www.businessinsider.com');
          });
      });
    });
  • m

    mysterious-belgium-25713

    10/08/2022, 9:01 PM
    @stale-optician-85950 gave a better description of my solution
  • s

    stale-optician-85950

    10/08/2022, 9:03 PM
    @flaky-raincoat-53097 your application is not easy for a beginner to automation testing. Are you in direct contact with the developers?
  • f

    flaky-raincoat-53097

    10/08/2022, 9:07 PM
    @stale-optician-85950 Not really, to be honest this is a challenge to apply to an automation position... and I think that maybe they need a more specialized engineer..😐
  • p

    prehistoric-restaurant-72560

    10/08/2022, 9:08 PM
    First of all you should use pages made for automation practice, like this: https://practice.automationtesting.in/, using prod sites it's overall not allowed.
  • p

    prehistoric-restaurant-72560

    10/08/2022, 9:10 PM
    Things like email should be manually tested, as it's too expensive to create test that also confirms that emails was recieved ect. So don't stress if you don't cover some features with tests 😛
  • s

    stale-optician-85950

    10/08/2022, 9:12 PM
    @flaky-raincoat-53097 sure I get you, I admire your determination. From what we've done together so far I think you need to understand what's happening with the application requests more and know that automation testing has its limits too, as @prehistoric-restaurant-72560 has just mentioned.
  • f

    flaky-raincoat-53097

    10/08/2022, 9:14 PM
    Thanks @stale-optician-85950 for your support and taking the time to help me 🙏
  • f

    flaky-raincoat-53097

    10/08/2022, 9:14 PM
    And thanks @prehistoric-restaurant-72560 for your advice 🙏
  • f

    flaky-raincoat-53097

    10/08/2022, 9:14 PM
    Appreciate it
  • p

    prehistoric-restaurant-72560

    10/08/2022, 9:16 PM
    @flaky-raincoat-53097 Check https://cypress.tips/courses free course form Gleb
  • s

    stale-optician-85950

    10/08/2022, 9:18 PM
    You are welcome @flaky-raincoat-53097 and i'll second @prehistoric-restaurant-72560 advice about @gray-kilobyte-89541 courses, they are gold.
  • f

    flaky-raincoat-53097

    10/08/2022, 9:20 PM
    Thanks guys!!! @stale-optician-85950 and @prehistoric-restaurant-72560
  • f

    flaky-raincoat-53097

    10/08/2022, 9:21 PM
    @prehistoric-restaurant-72560 thanks for the course!
  • f

    flaky-raincoat-53097

    10/08/2022, 9:21 PM
    I'll follow your advice guys
  • f

    flaky-raincoat-53097

    10/08/2022, 9:21 PM
    Have a good day
  • m

    mysterious-belgium-25713

    10/08/2022, 9:43 PM
    Did they say to you that you have to automate that site. If not then why not look at the real world app of cypress?
  • s

    stale-optician-85950

    10/08/2022, 10:05 PM
    @flaky-raincoat-53097 I only read the last part of your task now, and as I feel like completing the job here's the solution 😆 :
    Copy code
    describe('Test application', () => {
      it('Assert all news items', () => {
        // stop the cookie banner from appearing by setting the cookie
        cy.setCookie('consentUUID', '57261086-58c8-4b80-9c02-647d417b9861_12');
        cy.visit('https://www.businessinsider.com/latest');
        // prepare news items requests
        cy.get(
          '[class="river-item featured-post"] [class*="js-feed-item"] [class="tout-text-wrapper default-tout"] a'
        ).then($elReults => {
          for (let i = 0; i < $elReults.length; i += 1) {
            cy.wrap($elReults)
              .eq(i)
              .then($el => {
                cy.wrap($el)
                  .invoke('attr', 'href')
                  .then(url => {
                    cy.request(url).then(resp => {
                      expect(resp.status).to.eq(200);
                    });
                  });
              });
          }
        });
      });
    });
  • f

    flaky-raincoat-53097

    10/08/2022, 10:28 PM
    @mysterious-belgium-25713 totally agree, I think it would be more productive
  • f

    flaky-raincoat-53097

    10/08/2022, 10:29 PM
    @stale-optician-85950 thank you a lot!!! You are awesome!!!
  • r

    refined-intern-1673

    10/09/2022, 12:40 AM
    Hi all, I'm having some trouble getting component tests working and I'm worried it's related to using Webpack with Laravel Mix, since mix uses a confirm format that's not the same as pure webpack but I also don't honestly know for sure. My setup is - Vue 2.6.12 - Laravel Mix (Laravel 8.x, mix 6.0.49) - Webpack 5.65.0 - Cypress 10.9.0 My
    cypress.config.js
    is pretty straightforward
    Copy code
    const { defineConfig } = require("cypress");
    
    module.exports = defineConfig({
      component: {
        devServer: {
          framework: "vue",
          bundler: "webpack",
          webpackConfig: require("./webpack.mix.js"),
        },
      },
    });
    And seems to run fine up until I actually try to run a component spec. I let Cypress generate a spec for me based on my component, and that seems fine up until it actually tries to load the component, at which point I get the following (non-Cypress) error:
    Copy code
    > Module parse failed: Unexpected token (1:0)
    You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
    > <template>
    |     <div class="px-4 py-8 flex items-center justify-between sm:px-0" :class="reverse ? 'flex-row-reverse' : 'flex-row'">
    |         <slot name="paginationCount">
    My webpack is definitely configured to load Vue files, I don't think our site would run without that 😅 So I'm thinking there's some divide between what Cypress expects for Webpack and what Mix provides but I've been down a rabbit-hole of non-solutions tonight and figured this might be a good place to reach out
  • p

    plain-pencil-72796

    10/09/2022, 8:55 AM
    I am sending a cy.request that fails on the dashboard. Is there a way to log the error body? I have tried: .then(resp => { cy.log(resp.body); }) but it doesnt seen to work
  • p

    purple-afternoon-2408

    10/09/2022, 11:01 AM
    Hi team, why do I get typescript error here, meanwhile it is documented to be "OK" - https://docs.cypress.io/api/cypress-api/custom-commands#Arguments
  • b

    brainy-translator-85865

    10/09/2022, 12:04 PM
    Custom Commands | Cypress Documentation
  • t

    thankful-dawn-86064

    10/09/2022, 6:05 PM
    Hello, can I specify firefox version when running tests on github actions?
  • t

    thankful-dawn-86064

    10/09/2022, 6:06 PM
    because it looks like the newest firefox version broke cypress (Still waiting to connect to Firefox, retrying in 1 second) and firefox was the best browser to run tests for me
  • m

    mysterious-belgium-25713

    10/09/2022, 6:30 PM
    If you select the right container with a specific firefox version then you can.
  • t

    thankful-dawn-86064

    10/09/2022, 6:30 PM
    where I can find browser containers?
  • m

    mysterious-belgium-25713

    10/09/2022, 6:31 PM
    Here is the list of containers https://github.com/cypress-io/cypress-docker-images/tree/master/included
1...167168169...252Latest