From 27f53f0d8d20856ef2dd0b74919f3855cf4aa4f3 Mon Sep 17 00:00:00 2001 From: alex <44968616+nderkim@users.noreply.github.com> Date: Fri, 21 Oct 2022 17:02:09 +1100 Subject: [PATCH] Fix PR --- cypress.config.ts | 9 ++++++++ cypress.json | 4 ---- .../multi-select.cy.ts} | 8 +++---- .../single-select.cy.ts} | 22 +++++++++---------- 4 files changed, 24 insertions(+), 19 deletions(-) create mode 100644 cypress.config.ts delete mode 100644 cypress.json rename cypress/{integration/multi-select.spec.ts => e2e/multi-select.cy.ts} (95%) rename cypress/{integration/single-select.spec.ts => e2e/single-select.cy.ts} (96%) diff --git a/cypress.config.ts b/cypress.config.ts new file mode 100644 index 0000000000..0cce5ccb49 --- /dev/null +++ b/cypress.config.ts @@ -0,0 +1,9 @@ +import { defineConfig } from 'cypress'; + +export default defineConfig({ + e2e: { + baseUrl: 'http://localhost:8000/cypress-tests', + supportFile: false, + }, + video: false, +}); diff --git a/cypress.json b/cypress.json deleted file mode 100644 index db4974eedf..0000000000 --- a/cypress.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "baseUrl": "http://localhost:8000/cypress-tests", - "video": false -} diff --git a/cypress/integration/multi-select.spec.ts b/cypress/e2e/multi-select.cy.ts similarity index 95% rename from cypress/integration/multi-select.spec.ts rename to cypress/e2e/multi-select.cy.ts index eab428c3ce..8afa9d682e 100644 --- a/cypress/integration/multi-select.spec.ts +++ b/cypress/e2e/multi-select.cy.ts @@ -1,5 +1,4 @@ import selector from '../fixtures/selectors.json'; -import cypressJson from '../../cypress.json'; const setup = [ { width: 1440, height: 900, viewport: 'macbook-15', device: 'Laptop' }, @@ -9,12 +8,13 @@ const setup = [ describe('Multi Select', () => { before(() => { - cy.visit(cypressJson.baseUrl); + cy.visit(Cypress.config('baseUrl')!); cy.title().should('equal', 'React-Select'); cy.get('h1').should('contain', 'Test Page for Cypress'); }); + beforeEach(() => { - cy.reload(); + cy.reload(true); }); for (let config of setup) { @@ -34,7 +34,7 @@ describe('Multi Select', () => { expect($defaultValue.eq(0)).to.contain('Red'); }) .get(selector.menuMulti) - .should('not.be.visible'); + .should('not.exist'); }); it(`Should be able to remove values on keyboard actions in view: ${viewport}`, () => { diff --git a/cypress/integration/single-select.spec.ts b/cypress/e2e/single-select.cy.ts similarity index 96% rename from cypress/integration/single-select.spec.ts rename to cypress/e2e/single-select.cy.ts index d4700dc154..55f4b6c91d 100644 --- a/cypress/integration/single-select.spec.ts +++ b/cypress/e2e/single-select.cy.ts @@ -1,5 +1,4 @@ import selector from '../fixtures/selectors.json'; -import cypressJson from '../../cypress.json'; const setup = [ { @@ -14,7 +13,7 @@ const setup = [ describe('Single Select', () => { before(() => { - cy.visit(cypressJson.baseUrl); + cy.visit(Cypress.config('baseUrl')!); cy.title().should('equal', 'React-Select'); cy.get('h1').should('contain', 'Test Page for Cypress'); }); @@ -28,7 +27,7 @@ describe('Single Select', () => { }); beforeEach(() => { - cy.reload(); + cy.reload(true); }); // TODO: @@ -46,6 +45,7 @@ describe('Single Select', () => { .get(selector.menuSingle) .should('not.be.visible'); }); + it(`Should display a default value in view: ${viewport}`, () => { cy.get(selector.singleBasicSelect) .find(selector.singleValue) @@ -138,7 +138,7 @@ describe('Single Select', () => { .type('{backspace}', { force: true }) .get(selector.singleBasicSelect) .find(selector.placeholder) - .should('not.be.visible'); + .should('not.exist'); }); }); @@ -148,7 +148,7 @@ describe('Single Select', () => { }); beforeEach(() => { - cy.reload(); + cy.reload(true); }); it(`Should display a default value in view: ${viewport}`, () => { @@ -194,7 +194,7 @@ describe('Single Select', () => { }); beforeEach(() => { - cy.reload(); + cy.reload(true); }); it(`Should display a default value in view: ${viewport}`, () => { @@ -251,14 +251,14 @@ describe('Single Select', () => { .type('{esc}', { force: true }) .get(selector.singleClearableSelect) .find(selector.menu) - .should('not.be.visible') + .should('not.exist') // Clear the value, verify menu doesn't pop .get(selector.singleClearableSelect) .find('input') .type('{backspace}', { force: true }) .get(selector.singleClearableSelect) .find(selector.menu) - .should('not.be.visible'); + .should('not.exist'); }); it(`Should clear the value when escape is pressed if escapeClearsValue and menu is closed in view: ${viewport}`, () => { @@ -271,14 +271,14 @@ describe('Single Select', () => { .type('{esc}', { force: true }) .get(selector.singleBasicSelect) .find(selector.menu) - .should('not.be.visible') + .should('not.exist') // Escape again to verify value is not cleared .get(selector.singleClearableSelect) .find('input') .type('{esc}', { force: true }) .get(selector.singleClearableSelect) .find(selector.placeholder) - .should('not.be.visible') + .should('not.exist') // Enable escapeClearsValue and try again, it should clear the value .get(selector.singleClearable) .find(selector.checkboxEscapeClearsValue) @@ -290,7 +290,7 @@ describe('Single Select', () => { .type('{esc}', { force: true }) .get(selector.singleBasicSelect) .find(selector.menu) - .should('not.be.visible') + .should('not.exist') // Escape again to clear value .get(selector.singleClearableSelect) .find('input')