Skip to content
This repository has been archived by the owner on Jan 31, 2023. It is now read-only.

Commit

Permalink
Created skeleton transaction web view
Browse files Browse the repository at this point in the history
Signed-off-by: Erin Hughes <Erin.Hughes@ibm.com>
  • Loading branch information
erin-hughes committed Oct 10, 2019
1 parent f9e2104 commit 044a5f6
Show file tree
Hide file tree
Showing 28 changed files with 1,041 additions and 425 deletions.
60 changes: 60 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,68 @@ stages:
- template: azure-templates/setup-steps.yml
- template: azure-templates/cucumber-steps.yml

- stage: jestTest
condition: ne(variables['Build.Reason'], 'Schedule')
dependsOn: []
jobs:
- job: jest
strategy:
matrix:
linux:
imageName: 'ubuntu-16.04'
VERSION: '1.35.1'
MODULES: '64'
ELECTRON: '3.0'
TARGET: '3.0.0'
mac:
imageName: 'macos-10.14'
VERSION: '1.35.1'
MODULES: '64'
ELECTRON: '3.0'
TARGET: '3.0.0'
pool:
vmImage: $(imageName)

steps:
- template: azure-templates/setup-steps.yml
- template: azure-templates/rebuild-steps.yml
- template: azure-templates/jest-test-steps.yml

- stage: cypressTest
condition: ne(variables['Build.Reason'], 'Schedule')
dependsOn: []
jobs:
- job: cypress
strategy:
matrix:
linux:
imageName: 'ubuntu-16.04'
VERSION: '1.35.1'
MODULES: '64'
ELECTRON: '3.0'
TARGET: '3.0.0'
mac:
imageName: 'macos-10.14'
VERSION: '1.35.1'
MODULES: '64'
ELECTRON: '3.0'
TARGET: '3.0.0'
pool:
vmImage: $(imageName)

steps:
- template: azure-templates/setup-steps.yml
- template: azure-templates/rebuild-steps.yml
- template: azure-templates/cypress-steps.yml



- stage: buildPackage
dependsOn:
- unitTest
- cucumberTest
- jestTest
- cypress
jobs:
- job: buildPackage

Expand Down Expand Up @@ -93,6 +151,8 @@ stages:
dependsOn:
- unitTest
- cucumberTest
- jestTest
- cypressTest
- buildPackage
jobs:
- job:
Expand Down
19 changes: 19 additions & 0 deletions azure-templates/cypress-steps.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at

# http://www.apache.org/licenses/LICENSE-2.0

# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

steps:
- bash: |
npm run cypressCli
env:
DISPLAY: ':99.0'
displayName: Run jest tests
condition: succeeded()
19 changes: 19 additions & 0 deletions azure-templates/jest-test-steps.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at

# http://www.apache.org/licenses/LICENSE-2.0

# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

steps:
- bash: |
npm run jestTest
env:
DISPLAY: ':99.0'
displayName: Run jest tests
condition: succeeded()
16 changes: 6 additions & 10 deletions cypress/integration/init.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,14 @@ chai.should();
describe('Cypress', () => {
it('is working', () => {
cy.visit('build/index.html').then((window) => {
window.postMessage('/one', '*'); // This is needed to trigger the `window.addEventListener`
window.postMessage('/transaction', '*'); // This is needed to trigger the `window.addEventListener`
});

cy.get('#checkboxOne').then((checkbox: any) => {
const label: any[] = checkbox.siblings('label');
label.should.have.text('checkboxOne Label');
});

cy.get('#buttonOne').contains('Do Nothing').click();

cy.focused().should('have.id', 'buttonOne').and('have.class', 'bx--btn--primary');
cy.focused().should('have.css', 'border-color').and('eq', 'rgb(255, 255, 255)');
cy.get('#create-button').click();
cy.focused().should('have.id', 'create-button');

cy.get('#import-button').click();
cy.focused().should('have.id', 'import-button');
});

});
29 changes: 29 additions & 0 deletions enzyme/tests/TransactionViewPage.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import React from 'react';
import renderer from 'react-test-renderer';
import TransactionViewPage from '../../src/components/TransactionViewPage/TransactionViewPage';
import chai from 'chai';
import sinon from 'sinon';
import sinonChai from 'sinon-chai';
chai.should();
chai.use(sinonChai);

describe('TransactionViewPage component', () => {

let mySandBox: sinon.SinonSandbox;

beforeEach(async () => {
mySandBox = sinon.createSandbox();
});

afterEach(async () => {
mySandBox.restore();
});

it('should render the expected snapshot', async () => {
const component: any = renderer
.create(<TransactionViewPage activeSmartContract="penguinContract@0.0.1"/>)
.toJSON();
expect(component).toMatchSnapshot();
});

});
29 changes: 29 additions & 0 deletions enzyme/tests/TransactionViewSidebar.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import React from 'react';
import renderer from 'react-test-renderer';
import TransactionViewSidebar from '../../src/components/TransactionViewSidebar/TransactionViewSidebar';
import chai from 'chai';
import sinon from 'sinon';
import sinonChai from 'sinon-chai';
chai.should();
chai.use(sinonChai);

describe('TransactionViewSidebar component', () => {

let mySandBox: sinon.SinonSandbox;

beforeEach(async () => {
mySandBox = sinon.createSandbox();
});

afterEach(async () => {
mySandBox.restore();
});

it('should render the expected snapshot', async () => {
const component: any = renderer
.create(<TransactionViewSidebar/>)
.toJSON();
expect(component).toMatchSnapshot();
});

});
58 changes: 58 additions & 0 deletions enzyme/tests/TransactionViewSidebarPanel.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import React from 'react';
import renderer from 'react-test-renderer';
import { mount } from 'enzyme';
import SidebarPanel from '../../src/components/TransactionViewSidebarPanel/TransactionViewSidebarPanel';
import chai from 'chai';
import sinon from 'sinon';
import sinonChai from 'sinon-chai';
chai.should();
chai.use(sinonChai);

describe('SidebarPanel component', () => {

let mySandBox: sinon.SinonSandbox;

beforeEach(async () => {
mySandBox = sinon.createSandbox();
});

afterEach(async () => {
mySandBox.restore();
});

it('should render the expected snapshot when panelType = \`buttons\`', async () => {
const component: any = renderer
.create(<SidebarPanel panelType={'buttons'}></SidebarPanel>)
.toJSON();
expect(component).toMatchSnapshot();
});

it('should render the expected snapshot when panelType = \`filters\`', async () => {
const component: any = renderer
.create(<SidebarPanel panelType={'filters'}></SidebarPanel>)
.toJSON();
expect(component).toMatchSnapshot();
});

it('should render the expected snapshot when panelType = \`log\`', async () => {
const component: any = renderer
.create(<SidebarPanel panelType={'log'}></SidebarPanel>)
.toJSON();
expect(component).toMatchSnapshot();
});

it('will one day allow a user to create a new transaction', async() => {
const createTxnSpy: sinon.SinonSpy = sinon.spy(SidebarPanel.prototype, 'createTxn');
const component: any = mount(<SidebarPanel panelType='buttons'></SidebarPanel>);
component.find('button[id=\'create-button\']').simulate('click');
createTxnSpy.should.have.been.called;
});

it('will one day allow a user to create a new transaction', async() => {
const importTxnSpy: sinon.SinonSpy = sinon.spy(SidebarPanel.prototype, 'importTxn');
const component: any = mount(<SidebarPanel panelType='buttons'></SidebarPanel>);
component.find('button[id=\'import-button\']').simulate('click');
importTxnSpy.should.have.been.called;
});

});
Loading

0 comments on commit 044a5f6

Please sign in to comment.