Skip to content
This repository was archived by the owner on Jun 4, 2024. It is now read-only.

3.1 refactor tests #113

Merged
merged 10 commits into from
Sep 27, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 31 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,40 @@ jobs:
command: npm run build:py

- run:
name: Run hosts
name: Run tests
command: |
. venv/bin/activate
npm run test


"visual-test":
docker:
- image: circleci/node:8.11.3-browsers

steps:
- checkout

- restore_cache:
key: deps1-{{ .Branch }}-{{ checksum "npm-shrinkwrap.json" }}-{{ checksum "package.json" }}

- run:
name: Install package.json
command: npm i

- save_cache:
key: deps1-{{ .Branch }}-{{ checksum "npm-shrinkwrap.json" }}-{{ checksum "package.json" }}
paths:
- node_modules

- run:
name: Run build:js
command: npm run build:js

- run:
name: Run visual tests
command: npm run test.visual
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new job for visual tests



"node":
docker:
- image: circleci/node:8.11.3
Expand Down Expand Up @@ -143,3 +172,4 @@ workflows:
- "python-3.6"
- "node"
- "test"
- "visual-test"
2 changes: 1 addition & 1 deletion .config/webpack/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ module.exports = (preprocessor = {}, mode = 'development') => {
},
resolve: {
alias: {
'cypress': path.resolve('./tests/e2e/cypress/src'),
'cypress': path.resolve('./tests/cypress/src'),
'dash-table': path.resolve('./src/dash-table'),
'core': path.resolve('./src/core'),
'tests': path.resolve('./tests')
Expand Down
95 changes: 0 additions & 95 deletions TODO.md

This file was deleted.

12 changes: 6 additions & 6 deletions cypress.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"video": false,
"fixturesFolder": "./tests/e2e/cypress/fixtures",
"integrationFolder": "./tests/e2e/cypress/integration",
"pluginsFile": "./tests/e2e/cypress/plugins/index.js",
"screenshotsFolder": "./tests/e2e/cypress/screenshots",
"supportFile": "./tests/e2e/cypress/support/index.js",
"videoFolder": "./tests/e2e/cypress/videos"
"fixturesFolder": "./tests/cypress/fixtures",
"integrationFolder": "./tests/cypress/tests",
"pluginsFile": "./tests/cypress/plugins/index.js",
"screenshotsFolder": "./tests/cypress/screenshots",
"supportFile": "./tests/cypress/support/index.js",
"videoFolder": "./tests/cypress/videos"
}
2 changes: 1 addition & 1 deletion dash_table/bundle.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dash_table/demo.js

Large diffs are not rendered by default.

9 changes: 4 additions & 5 deletions dash_table/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"preprivate::opentests": "run-s private::wait*",
"preprivate::runtests": "run-s private::wait*",
"private::build": "webpack --display-reasons --bail",
"private::host_dash8081": "python tests/e2e/dash/v_be_page.py",
"private::host_dash8082": "python tests/e2e/dash/v_copy_paste.py",
"private::host_dash8081": "python tests/cypress/dash/v_be_page.py",
"private::host_dash8082": "python tests/cypress/dash/v_copy_paste.py",
"private::host_js": "http-server ./dash_table -c-1 --silent",
"private::wait_dash8081": "wait-on http://localhost:8081",
"private::wait_dash8082": "wait-on http://localhost:8082",
Expand All @@ -17,15 +17,14 @@
"private::lint.ts": "tslint --project . src/**/*.ts",
"private::opentests": "cypress open",
"private::runtests": "cypress run --browser chrome",
"private::test-e2e": "run-p --race private::host* private::runtests",
"private::test-visual": "build-storybook && percy-storybook",
"build.watch": "webpack-dev-server --content-base dash_table --mode development",
"build:js": "run-s \"private::build -- --mode production\"",
"build:js-dev": "run-s \"private::build -- --mode development\"",
"build:js-test": "webpack --display-reasons --bail --config webpack.test.config.js",
"build:py": "./extract-meta src/dash-table/Table.js > dash_table/metadata.json && cp package.json dash_table",
"lint": "run-s private::lint.js private::lint.ts",
"test": "run-s private::test-*",
"test": "run-p --race private::host* private::runtests",
"test.visual": "build-storybook && percy-storybook",
"test.watch": "run-p --race \"build:js-test -- --watch\" --race private::host* private::opentests"
},
"author": "Chris P <[email protected]",
Expand Down
9 changes: 4 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"preprivate::opentests": "run-s private::wait*",
"preprivate::runtests": "run-s private::wait*",
"private::build": "webpack --display-reasons --bail",
"private::host_dash8081": "python tests/e2e/dash/v_be_page.py",
"private::host_dash8082": "python tests/e2e/dash/v_copy_paste.py",
"private::host_dash8081": "python tests/cypress/dash/v_be_page.py",
"private::host_dash8082": "python tests/cypress/dash/v_copy_paste.py",
"private::host_js": "http-server ./dash_table -c-1 --silent",
"private::wait_dash8081": "wait-on http://localhost:8081",
"private::wait_dash8082": "wait-on http://localhost:8082",
Expand All @@ -17,15 +17,14 @@
"private::lint.ts": "tslint --project . src/**/*.ts",
"private::opentests": "cypress open",
"private::runtests": "cypress run --browser chrome",
"private::test-e2e": "run-p --race private::host* private::runtests",
"private::test-visual": "build-storybook && percy-storybook",
"build.watch": "webpack-dev-server --content-base dash_table --mode development",
"build:js": "run-s \"private::build -- --mode production\"",
"build:js-dev": "run-s \"private::build -- --mode development\"",
"build:js-test": "webpack --display-reasons --bail --config webpack.test.config.js",
"build:py": "./extract-meta src/dash-table/Table.js > dash_table/metadata.json && cp package.json dash_table",
"lint": "run-s private::lint.js private::lint.ts",
"test": "run-s private::test-*",
"test": "run-p --race private::host* private::runtests",
"test.visual": "build-storybook && percy-storybook",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new script for visual tests

"test.watch": "run-p --race \"build:js-test -- --watch\" --race private::host* private::opentests"
},
"author": "Chris P <[email protected]",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const wp = require('@cypress/webpack-preprocessor')

module.exports = (on) => {
const options = {
webpackOptions: require('../../../../webpack.test.config.js'),
webpackOptions: require('../../../webpack.test.config.js'),
}

on('file:preprocessor', wp(options))
Expand Down
File renamed without changes.
File renamed without changes.
18 changes: 18 additions & 0 deletions tests/cypress/tests/server/delete_row_test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import DashTable from 'cypress/DashTable';

describe('delete', () => {
beforeEach(() => cy.visit('http://localhost:8081'));

it('can delete row', () => {
DashTable.getCell(0, 0).within(() => cy.get('.dash-cell-value').should('have.html', '0'));
DashTable.getDelete(0).click();
DashTable.getCell(0, 0).within(() => cy.get('.dash-cell-value').should('have.html', '1'));
});

it('can delete row when sorted', () => {
cy.get('tr th.column-0 .sort').click({ force: true });
DashTable.getCell(0, 0).within(() => cy.get('.dash-cell-value').should('have.html', '28155'));
DashTable.getDelete(0).click();
DashTable.getCell(0, 0).within(() => cy.get('.dash-cell-value').should('have.html', '28154'));
});
});
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved the test involving a dash server into its own file under /server

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import DashTable from 'cypress/DashTable';

describe('delete', () => {
describe('select row', () => {
describe('be pagination & sort', () => {
beforeEach(() => cy.visit('http://localhost:8081'));

Expand All @@ -22,26 +22,4 @@ describe('delete', () => {
DashTable.getSelect(0).within(() => cy.get('input').should('not.be.checked'));
});
});

describe('fe pagination & sort', () => {
beforeEach(() => cy.visit('http://localhost:8080'));

it('can select row', () => {
DashTable.getSelect(0).within(() => cy.get('input').click());
DashTable.getSelect(0).within(() => cy.get('input').should('be.checked'));
});

it('can select row when sorted', () => {
cy.get('tr th.column-0 .sort').click({ force: true });
DashTable.getSelect(0).within(() => cy.get('input').click());
DashTable.getSelect(0).within(() => cy.get('input').should('be.checked'));
});

it('select, sort, new row is not selected', () => {
DashTable.getSelect(0).within(() => cy.get('input').click());
DashTable.getSelect(0).within(() => cy.get('input').should('be.checked'));
cy.get('tr th.column-0 .sort').click({ force: true });
DashTable.getSelect(0).within(() => cy.get('input').should('not.be.checked'));
});
});
});
18 changes: 18 additions & 0 deletions tests/cypress/tests/standalone/delete_row_test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import DashTable from 'cypress/DashTable';

describe('delete', () => {
beforeEach(() => cy.visit('http://localhost:8080'));

it('can delete row', () => {
DashTable.getCell(0, 0).within(() => cy.get('.dash-cell-value').should('have.html', '1'));
DashTable.getDelete(0).click();
DashTable.getCell(0, 0).within(() => cy.get('.dash-cell-value').should('have.html', '2'));
});

it('can delete row when sorted', () => {
cy.get('tr th.column-0 .sort').click({ force: true });
DashTable.getCell(0, 0).within(() => cy.get('.dash-cell-value').should('have.html', '4999'));
DashTable.getDelete(0).click();
DashTable.getCell(0, 0).within(() => cy.get('.dash-cell-value').should('have.html', '4998'));
});
});
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved standalone (no dash server) test under /standalone

25 changes: 25 additions & 0 deletions tests/cypress/tests/standalone/select_row_test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import DashTable from 'cypress/DashTable';

describe('select row', () => {
describe('fe pagination & sort', () => {
beforeEach(() => cy.visit('http://localhost:8080'));

it('can select row', () => {
DashTable.getSelect(0).within(() => cy.get('input').click());
DashTable.getSelect(0).within(() => cy.get('input').should('be.checked'));
});

it('can select row when sorted', () => {
cy.get('tr th.column-0 .sort').click({ force: true });
DashTable.getSelect(0).within(() => cy.get('input').click());
DashTable.getSelect(0).within(() => cy.get('input').should('be.checked'));
});

it('select, sort, new row is not selected', () => {
DashTable.getSelect(0).within(() => cy.get('input').click());
DashTable.getSelect(0).within(() => cy.get('input').should('be.checked'));
cy.get('tr th.column-0 .sort').click({ force: true });
DashTable.getSelect(0).within(() => cy.get('input').should('not.be.checked'));
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as R from 'ramda';

import derivedViewportDataframe from 'dash-table/derived/viewportDataframe';

describe.only('derived viewport', () => {
describe('derived viewport', () => {
const viewportDataframe = derivedViewportDataframe();

describe('virtual dataframe <= page size', () => {
Expand Down Expand Up @@ -48,7 +48,7 @@ describe.only('derived viewport', () => {
});
});
});

describe('virtual dataframe > page size', () => {
describe('with fe pagination', () => {
it('returns slice of dataframe', () => {
Expand All @@ -68,4 +68,4 @@ describe.only('derived viewport', () => {
});
});
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"compilerOptions": {
"allowJs": true,
"allowSyntheticDefaultImports": true,
"baseUrl": "./..",
"baseUrl": ".",
"emitDecoratorMetadata": false,
"experimentalDecorators": true,
"lib": ["esnext", "dom"],
Expand All @@ -12,7 +12,7 @@
"noUnusedLocals": true,
"noUnusedParameters": true,
"paths": {
"cypress/*": ["cypress/src/*"],
"cypress/*": ["./src/*"],
"core/*": ["./../../src/core/*"],
"dash-table/*": ["./../../src/dash-table/*"]

Expand Down
Loading