From f4a503a5930795885068348bcc80ec65e5c86d63 Mon Sep 17 00:00:00 2001 From: Anderson Ceci Date: Sat, 6 May 2023 00:25:30 +0200 Subject: [PATCH 1/2] Created this test to check focus on diffrent resolutions --- .../e2e/automatically-focus-on-editor.cy.js | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 cypress/e2e/automatically-focus-on-editor.cy.js diff --git a/cypress/e2e/automatically-focus-on-editor.cy.js b/cypress/e2e/automatically-focus-on-editor.cy.js new file mode 100644 index 00000000..77ad9248 --- /dev/null +++ b/cypress/e2e/automatically-focus-on-editor.cy.js @@ -0,0 +1,23 @@ + describe('it will check if the focus is on editor on desktop and not in mobiles', () => { + context('720p resolution', () => { + beforeEach(() => { + cy.visit("/"); + cy.viewport(1280, 720) + }) + + it('tests on resolution 1280-720 (desktop)', () => { + cy.focused().should('have.attr', 'id', 'editor'); + }) + }) + + context('iphone-7', () => { + beforeEach(() => { + cy.visit("/"); + cy.viewport('iphone-7') + }) + + it('tests on iphone 7 resolution 375-667', () => { + cy.focused().should('not.have.attr', 'id', 'editor'); + }) + }) + }) \ No newline at end of file From d4dd5aa0b8da9e730a4263d0ccbe28f96f208ab2 Mon Sep 17 00:00:00 2001 From: Anderson Ceci Date: Sat, 6 May 2023 00:48:05 +0200 Subject: [PATCH 2/2] fixed the bug and ready to merge --- .../e2e/automatically-focus-on-editor.cy.js | 42 +++++++++---------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/cypress/e2e/automatically-focus-on-editor.cy.js b/cypress/e2e/automatically-focus-on-editor.cy.js index 77ad9248..258148ea 100644 --- a/cypress/e2e/automatically-focus-on-editor.cy.js +++ b/cypress/e2e/automatically-focus-on-editor.cy.js @@ -1,23 +1,23 @@ - describe('it will check if the focus is on editor on desktop and not in mobiles', () => { - context('720p resolution', () => { - beforeEach(() => { +describe("it will check if the focus is on editor on desktop and not in mobiles", () => { + context("720p resolution", () => { + beforeEach(() => { + cy.viewport(1280, 720); cy.visit("/"); - cy.viewport(1280, 720) - }) - - it('tests on resolution 1280-720 (desktop)', () => { - cy.focused().should('have.attr', 'id', 'editor'); - }) - }) - - context('iphone-7', () => { - beforeEach(() => { + }); + + it("tests on resolution 1280-720 (desktop)", () => { + cy.focused().should("have.attr", "id", "editor"); + }); + }); + + context("iphone-7", () => { + beforeEach(() => { + cy.viewport("iphone-7"); cy.visit("/"); - cy.viewport('iphone-7') - }) - - it('tests on iphone 7 resolution 375-667', () => { - cy.focused().should('not.have.attr', 'id', 'editor'); - }) - }) - }) \ No newline at end of file + }); + + it("tests on iphone 7 resolution 375-667", () => { + cy.focused().should("not.exist"); + }); + }); +});