Skip to content

Commit

Permalink
Merge pull request #8 from jimuelmedrano/letcode-alert
Browse files Browse the repository at this point in the history
letcode alert scenario
  • Loading branch information
jimuelmedrano authored Sep 20, 2023
2 parents 2a207b0 + 4c28b3c commit 66af245
Show file tree
Hide file tree
Showing 21 changed files with 46 additions and 0 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
46 changes: 46 additions & 0 deletions cypress/e2e/1-letcode-tests/alert.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/// <reference types="cypress" />

describe('Letcode Alert Tests', () => {
beforeEach(() => {
cy.visit(Cypress.env('test_endpoint'))
cy.get('a[href*="/alert"]').click()
cy.wait(1000)
})

it('Accept alert', () => {
cy.get('#accept').click()
cy.wait(500)
cy.on('window:alert', (t) => {
cy.log(t)
});
cy.on('window:confirm', (t) => {
return true;
});
})

it('Dismiss alert', () => {
cy.get('#confirm').click()
cy.wait(500)
cy.on('window:alert', (t) => {
cy.log(t)
});
cy.on('window', (t) => {
return false;
});
})

it('Prompt alert', () => {
cy.window().then(($win) => {
//input text
cy.stub($win, 'prompt').returns('Renzo')
//button that will trigger the prompt
cy.get('#prompt').click()
})
})

it('Modern alert', () => {
cy.get('#modern').click()
cy.xpath(`//button[@aria-label='close']`).click()
})

})

0 comments on commit 66af245

Please sign in to comment.