From 4c28b3ccf4708cee55721da54f132daa239d6ded Mon Sep 17 00:00:00 2001 From: Jimuel Renzo Medrano Date: Wed, 20 Sep 2023 16:40:39 +0800 Subject: [PATCH] letcode alert scenario --- .../2-getting-started/todo.cy.js | 0 .../3-advanced-examples/actions.cy.js | 0 .../3-advanced-examples/aliasing.cy.js | 0 .../3-advanced-examples/assertions.cy.js | 0 .../3-advanced-examples/connectors.cy.js | 0 .../3-advanced-examples/cookies.cy.js | 0 .../3-advanced-examples/cypress_api.cy.js | 0 .../3-advanced-examples/files.cy.js | 0 .../3-advanced-examples/location.cy.js | 0 .../3-advanced-examples/misc.cy.js | 0 .../3-advanced-examples/navigation.cy.js | 0 .../network_requests.cy.js | 0 .../3-advanced-examples/querying.cy.js | 0 .../spies_stubs_clocks.cy.js | 0 .../3-advanced-examples/storage.cy.js | 0 .../3-advanced-examples/traversal.cy.js | 0 .../3-advanced-examples/utilities.cy.js | 0 .../3-advanced-examples/viewport.cy.js | 0 .../3-advanced-examples/waiting.cy.js | 0 .../3-advanced-examples/window.cy.js | 0 cypress/e2e/1-letcode-tests/alert.cy.js | 46 +++++++++++++++++++ 21 files changed, 46 insertions(+) rename cypress/{e2e => cyrpress-test-files}/2-getting-started/todo.cy.js (100%) rename cypress/{e2e => cyrpress-test-files}/3-advanced-examples/actions.cy.js (100%) rename cypress/{e2e => cyrpress-test-files}/3-advanced-examples/aliasing.cy.js (100%) rename cypress/{e2e => cyrpress-test-files}/3-advanced-examples/assertions.cy.js (100%) rename cypress/{e2e => cyrpress-test-files}/3-advanced-examples/connectors.cy.js (100%) rename cypress/{e2e => cyrpress-test-files}/3-advanced-examples/cookies.cy.js (100%) rename cypress/{e2e => cyrpress-test-files}/3-advanced-examples/cypress_api.cy.js (100%) rename cypress/{e2e => cyrpress-test-files}/3-advanced-examples/files.cy.js (100%) rename cypress/{e2e => cyrpress-test-files}/3-advanced-examples/location.cy.js (100%) rename cypress/{e2e => cyrpress-test-files}/3-advanced-examples/misc.cy.js (100%) rename cypress/{e2e => cyrpress-test-files}/3-advanced-examples/navigation.cy.js (100%) rename cypress/{e2e => cyrpress-test-files}/3-advanced-examples/network_requests.cy.js (100%) rename cypress/{e2e => cyrpress-test-files}/3-advanced-examples/querying.cy.js (100%) rename cypress/{e2e => cyrpress-test-files}/3-advanced-examples/spies_stubs_clocks.cy.js (100%) rename cypress/{e2e => cyrpress-test-files}/3-advanced-examples/storage.cy.js (100%) rename cypress/{e2e => cyrpress-test-files}/3-advanced-examples/traversal.cy.js (100%) rename cypress/{e2e => cyrpress-test-files}/3-advanced-examples/utilities.cy.js (100%) rename cypress/{e2e => cyrpress-test-files}/3-advanced-examples/viewport.cy.js (100%) rename cypress/{e2e => cyrpress-test-files}/3-advanced-examples/waiting.cy.js (100%) rename cypress/{e2e => cyrpress-test-files}/3-advanced-examples/window.cy.js (100%) create mode 100644 cypress/e2e/1-letcode-tests/alert.cy.js diff --git a/cypress/e2e/2-getting-started/todo.cy.js b/cypress/cyrpress-test-files/2-getting-started/todo.cy.js similarity index 100% rename from cypress/e2e/2-getting-started/todo.cy.js rename to cypress/cyrpress-test-files/2-getting-started/todo.cy.js diff --git a/cypress/e2e/3-advanced-examples/actions.cy.js b/cypress/cyrpress-test-files/3-advanced-examples/actions.cy.js similarity index 100% rename from cypress/e2e/3-advanced-examples/actions.cy.js rename to cypress/cyrpress-test-files/3-advanced-examples/actions.cy.js diff --git a/cypress/e2e/3-advanced-examples/aliasing.cy.js b/cypress/cyrpress-test-files/3-advanced-examples/aliasing.cy.js similarity index 100% rename from cypress/e2e/3-advanced-examples/aliasing.cy.js rename to cypress/cyrpress-test-files/3-advanced-examples/aliasing.cy.js diff --git a/cypress/e2e/3-advanced-examples/assertions.cy.js b/cypress/cyrpress-test-files/3-advanced-examples/assertions.cy.js similarity index 100% rename from cypress/e2e/3-advanced-examples/assertions.cy.js rename to cypress/cyrpress-test-files/3-advanced-examples/assertions.cy.js diff --git a/cypress/e2e/3-advanced-examples/connectors.cy.js b/cypress/cyrpress-test-files/3-advanced-examples/connectors.cy.js similarity index 100% rename from cypress/e2e/3-advanced-examples/connectors.cy.js rename to cypress/cyrpress-test-files/3-advanced-examples/connectors.cy.js diff --git a/cypress/e2e/3-advanced-examples/cookies.cy.js b/cypress/cyrpress-test-files/3-advanced-examples/cookies.cy.js similarity index 100% rename from cypress/e2e/3-advanced-examples/cookies.cy.js rename to cypress/cyrpress-test-files/3-advanced-examples/cookies.cy.js diff --git a/cypress/e2e/3-advanced-examples/cypress_api.cy.js b/cypress/cyrpress-test-files/3-advanced-examples/cypress_api.cy.js similarity index 100% rename from cypress/e2e/3-advanced-examples/cypress_api.cy.js rename to cypress/cyrpress-test-files/3-advanced-examples/cypress_api.cy.js diff --git a/cypress/e2e/3-advanced-examples/files.cy.js b/cypress/cyrpress-test-files/3-advanced-examples/files.cy.js similarity index 100% rename from cypress/e2e/3-advanced-examples/files.cy.js rename to cypress/cyrpress-test-files/3-advanced-examples/files.cy.js diff --git a/cypress/e2e/3-advanced-examples/location.cy.js b/cypress/cyrpress-test-files/3-advanced-examples/location.cy.js similarity index 100% rename from cypress/e2e/3-advanced-examples/location.cy.js rename to cypress/cyrpress-test-files/3-advanced-examples/location.cy.js diff --git a/cypress/e2e/3-advanced-examples/misc.cy.js b/cypress/cyrpress-test-files/3-advanced-examples/misc.cy.js similarity index 100% rename from cypress/e2e/3-advanced-examples/misc.cy.js rename to cypress/cyrpress-test-files/3-advanced-examples/misc.cy.js diff --git a/cypress/e2e/3-advanced-examples/navigation.cy.js b/cypress/cyrpress-test-files/3-advanced-examples/navigation.cy.js similarity index 100% rename from cypress/e2e/3-advanced-examples/navigation.cy.js rename to cypress/cyrpress-test-files/3-advanced-examples/navigation.cy.js diff --git a/cypress/e2e/3-advanced-examples/network_requests.cy.js b/cypress/cyrpress-test-files/3-advanced-examples/network_requests.cy.js similarity index 100% rename from cypress/e2e/3-advanced-examples/network_requests.cy.js rename to cypress/cyrpress-test-files/3-advanced-examples/network_requests.cy.js diff --git a/cypress/e2e/3-advanced-examples/querying.cy.js b/cypress/cyrpress-test-files/3-advanced-examples/querying.cy.js similarity index 100% rename from cypress/e2e/3-advanced-examples/querying.cy.js rename to cypress/cyrpress-test-files/3-advanced-examples/querying.cy.js diff --git a/cypress/e2e/3-advanced-examples/spies_stubs_clocks.cy.js b/cypress/cyrpress-test-files/3-advanced-examples/spies_stubs_clocks.cy.js similarity index 100% rename from cypress/e2e/3-advanced-examples/spies_stubs_clocks.cy.js rename to cypress/cyrpress-test-files/3-advanced-examples/spies_stubs_clocks.cy.js diff --git a/cypress/e2e/3-advanced-examples/storage.cy.js b/cypress/cyrpress-test-files/3-advanced-examples/storage.cy.js similarity index 100% rename from cypress/e2e/3-advanced-examples/storage.cy.js rename to cypress/cyrpress-test-files/3-advanced-examples/storage.cy.js diff --git a/cypress/e2e/3-advanced-examples/traversal.cy.js b/cypress/cyrpress-test-files/3-advanced-examples/traversal.cy.js similarity index 100% rename from cypress/e2e/3-advanced-examples/traversal.cy.js rename to cypress/cyrpress-test-files/3-advanced-examples/traversal.cy.js diff --git a/cypress/e2e/3-advanced-examples/utilities.cy.js b/cypress/cyrpress-test-files/3-advanced-examples/utilities.cy.js similarity index 100% rename from cypress/e2e/3-advanced-examples/utilities.cy.js rename to cypress/cyrpress-test-files/3-advanced-examples/utilities.cy.js diff --git a/cypress/e2e/3-advanced-examples/viewport.cy.js b/cypress/cyrpress-test-files/3-advanced-examples/viewport.cy.js similarity index 100% rename from cypress/e2e/3-advanced-examples/viewport.cy.js rename to cypress/cyrpress-test-files/3-advanced-examples/viewport.cy.js diff --git a/cypress/e2e/3-advanced-examples/waiting.cy.js b/cypress/cyrpress-test-files/3-advanced-examples/waiting.cy.js similarity index 100% rename from cypress/e2e/3-advanced-examples/waiting.cy.js rename to cypress/cyrpress-test-files/3-advanced-examples/waiting.cy.js diff --git a/cypress/e2e/3-advanced-examples/window.cy.js b/cypress/cyrpress-test-files/3-advanced-examples/window.cy.js similarity index 100% rename from cypress/e2e/3-advanced-examples/window.cy.js rename to cypress/cyrpress-test-files/3-advanced-examples/window.cy.js diff --git a/cypress/e2e/1-letcode-tests/alert.cy.js b/cypress/e2e/1-letcode-tests/alert.cy.js new file mode 100644 index 0000000..bec3b29 --- /dev/null +++ b/cypress/e2e/1-letcode-tests/alert.cy.js @@ -0,0 +1,46 @@ +/// + +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() + }) + +}) \ No newline at end of file