Skip to content

Commit

Permalink
chore(dev-deps): bump cypress and fix specs (#392)
Browse files Browse the repository at this point in the history
  • Loading branch information
100terres committed Aug 21, 2022
1 parent b990622 commit 26bf701
Show file tree
Hide file tree
Showing 12 changed files with 78 additions and 36 deletions.
13 changes: 13 additions & 0 deletions cypress.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { defineConfig } from 'cypress';

export default defineConfig({
pageLoadTimeout: 10000,
retries: 1,
viewportHeight: 600,
viewportWidth: 800,

e2e: {
baseUrl: 'http://localhost:9002',
specPattern: 'cypress/**/*.spec.ts',
},
});
8 changes: 0 additions & 8 deletions cypress.json

This file was deleted.

3 changes: 3 additions & 0 deletions cypress/integration/reorder-lists.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ describe('reorder lists', () => {
.wait(timings.outOfTheWay * 1000)
.trigger('keydown', { keyCode: keyCodes.space, force: true });

// we must wait before asserting the new order
cy.wait(timings.outOfTheWay * 1000);

// order now 2, 1
// note: not using get aliases as they where returning incorrect results
cy.get('h4').eq(0).should('contain', 'BMO');
Expand Down
3 changes: 3 additions & 0 deletions cypress/integration/reorder-virtual.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ describe('reorder: virtual', () => {
force: true,
});

// we must wait before asserting the new order
cy.wait(timings.outOfTheWay * 1000);

// This is setting up a chain of commands and this test will not wait
// for a 'promise' to resolve. Linting is getting confused by .then
cy.get('@item-id').then((id) => {
Expand Down
3 changes: 3 additions & 0 deletions cypress/integration/reorder.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ describe('reorder', () => {
.wait(timings.outOfTheWay * 1000)
.trigger('keydown', { keyCode: keyCodes.space, force: true });

// we must wait before asserting the new order
cy.wait(timings.outOfTheWay * 1000);

// order now 2, 1
// note: not using get aliases as they where returning incorrect results
cy.get(getHandleSelector()).eq(0).should('contain', 'id:G2');
Expand Down
18 changes: 0 additions & 18 deletions cypress/plugins/index.js

This file was deleted.

2 changes: 2 additions & 0 deletions cypress/support/commands.js → cypress/support/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,5 @@
//
// -- This is will overwrite an existing command --
// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... })

export {};
12 changes: 12 additions & 0 deletions cypress/support/component-index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>Components App</title>
</head>
<body>
<div data-cy-root></div>
</body>
</html>
36 changes: 36 additions & 0 deletions cypress/support/component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// ***********************************************************
// This example support/component.ts is processed and
// loaded automatically before your test files.
//
// This is a great place to put global configuration and
// behavior that modifies Cypress.
//
// You can change the location of this file or turn off
// automatically serving support files with the
// 'supportFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/configuration
// ***********************************************************

import './commands';

import { mount } from 'cypress/react18';

// Augment the Cypress namespace to include type definitions for
// your custom command.
// Alternatively, can be defined in cypress/support/component.d.ts
// with a <reference path="./component" /> at the top of your spec.
declare global {
// eslint-disable-next-line @typescript-eslint/no-namespace
namespace Cypress {
interface Chainable {
mount: typeof mount;
}
}
}

Cypress.Commands.add('mount', mount);

// Example use:
// cy.mount(<MyComponent />);
4 changes: 0 additions & 4 deletions cypress/support/index.js → cypress/support/e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,4 @@
// https://on.cypress.io/configuration
// ***********************************************************

// Import commands.js using ES2015 syntax:
import './commands';

// Alternatively you can use CommonJS syntax:
// require('./commands')
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@
"commitizen": "4.2.4",
"cross-env": "7.0.3",
"csstype": "3.0.11",
"cypress": "9.5.3",
"cypress": "10.6.0",
"dotenv": "16.0.0",
"emotion-theming": "11.0.0",
"eslint": "8.13.0",
Expand Down
10 changes: 5 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 26bf701

Please sign in to comment.