I am working Cypress Typescript and have integrated gmail-tester in my automation. The issue im facing is very weird. I am trying to click on a button from the email Everything seems to be workinf prefectly fine even if i click on the button manually i.e. by entering the URL the screen is displayed but while im doing this with by fetching the button URL and clicking nothing seems to be working!!
/// <reference types="Cypress" />
import * as cheerio from 'cheerio';
import fs from 'fs';
describe("Email assertion:", () => {
it("Using gmail_tester.get_messages(), look for an email with specific subject and link in email body", function () {
cy.task("gmail:get-messages", {
options: {
from: "test@test.com",
subject: "Account confirmation",
include_body: true,
},
}).then((emails: any) => {
assert.isAtLeast(emails.length, 1, "Expected to find at least one email, but none were found!");
assert.isTrue(emails[0].subject.indexOf("Account confirmation") >= 0, "Found email with subject 'Account confirmation'!");
const body = emails[0].html;
const emailContent = emails.html;
// Use Cheerio to extract the link URL from the email content
const $ = cheerio.load(emailContent);
const linkUrl = $('a[href^="http://localhost:3000/Identity/Account/ConfirmEmail"]').attr('href');
// Use cy.visit() to navigate to the link URL
cy.visit(linkUrl);
});
});
});
I tired multiple option, but nothing seems to be working.
I am working Cypress Typescript and have integrated gmail-tester in my automation. The issue im facing is very weird. I am trying to click on a button from the email Everything seems to be workinf prefectly fine even if i click on the button manually i.e. by entering the URL the screen is displayed but while im doing this with by fetching the button URL and clicking nothing seems to be working!!
I tired multiple option, but nothing seems to be working.