Created
March 12, 2024 00:29
-
-
Save yatsenkolesh/e53cb5dbf94201b0ef3f86aa0ded9073 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe('template spec', () => { | |
it('testing email', { | |
defaultCommandTimeout: 10000, | |
}, () => { | |
cy.proxiedmail().then((proxiedmail) => { | |
cy.visit('https://proxiedmail.com') | |
cy.get('.nav_li').contains('Sign up').click() | |
cy.url().should('include', '/en/signup') | |
cy.then( | |
() => { | |
return new Promise(resolve => { | |
proxiedmail.createProxyEmail(proxyEmail => { | |
resolve(proxyEmail) | |
}) | |
}) | |
}).then((proxyEmail) => { | |
cy.wrap(proxyEmail.getId()).as('proxyEmailId') | |
cy.wrap(proxyEmail.getProxyEmail()).as('emailAddress') | |
}) | |
Cypress.on('uncaught:exception', (err, runnable) => { | |
// returning false here prevents Cypress from | |
// failing the test | |
return false | |
}) | |
cy.then(function () { | |
global.proxyEmailId = this.proxyEmailId | |
cy.get('#login').type(this.emailAddress) | |
cy.get('#password').type('123456') | |
return cy.get('#proceed').click() | |
}) | |
cy.then(() => { | |
return new Promise(resolve => { | |
const interval = setInterval(() => { | |
proxiedmail.getReceivedEmails(global.proxyEmailId, (resp) => { | |
if (resp.data.length > 0) { | |
resp.data[0].getDetails(function (details) { | |
clearInterval(interval); | |
resolve(details) | |
}) | |
} | |
})}, 3000); | |
return interval; | |
}) | |
}, | |
{ | |
timeout: 10000 | |
} | |
).then(details => { | |
expect(details.getSubject()).to.equal('Please confirm your email on ProxiedMail') | |
expect(details.getPayloadBodyHtml()).to.have.string( | |
'please confirm that you want to receive messages by clicking' | |
); | |
}); | |
}); | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment