Skip to content

Commit

Permalink
Merge pull request #542 from sanger/x1034_msw_update
Browse files Browse the repository at this point in the history
Added node option --openssl-legacy-provider
  • Loading branch information
seenanair authored Jan 26, 2024
2 parents d50f8a1 + 7e846cb commit e507d51
Show file tree
Hide file tree
Showing 125 changed files with 3,811 additions and 4,687 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ README.md
.github
.storybook
.prettierignore
jest.polyfills.js
14 changes: 6 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on:
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+*'

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
Expand All @@ -15,20 +14,19 @@ jobs:
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- uses: actions/checkout@v4
name: Checkout
- name: Export node version
id: node_version
run: echo ::set-output name=NODE_VERSION::$(cat .nvmrc)
- name: Setup node
uses: actions/setup-node@v2
uses: actions/setup-node@v4
with:
node-version: ${{ steps.node_version.outputs.NODE_VERSION }}
node-version-file: '.nvmrc'
cache: 'yarn'
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: >-
echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v2
echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
- uses: actions/cache@v4
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/deploy-storybook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
name: Checkout
- name: Export node version
id: node_version
run: echo ::set-output name=NODE_VERSION::$(cat .nvmrc)
- name: Setup node
uses: actions/setup-node@v2
uses: actions/setup-node@v4
with:
node-version: ${{ steps.node_version.outputs.NODE_VERSION }}
node-version-file: '.nvmrc'
cache: 'yarn'
env:
NODE_OPTIONS: "--openssl-legacy-provider"
- name: Build storybook
run: |
yarn --frozen-lockfile --silent
Expand Down
25 changes: 13 additions & 12 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,23 @@ jobs:
cypress:
name: Run cypress tests
runs-on: ubuntu-latest
container:
container:
image: cypress/browsers:node18.12.0-chrome106-ff106

options: --user 1001
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
name: Checkout
- name: Setup node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'yarn'
- name: Install dependencides
run: >-
yarn install
- name: Cypress run
uses: cypress-io/github-action@v5
uses: cypress-io/github-action@v4
with:
install-command: yarn --frozen-lockfile --silent
build: yarn build
Expand All @@ -48,7 +49,7 @@ jobs:
name: Run snyk tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Run Snyk to check for vulnerabilities
uses: snyk/actions/node@master #Pre-created container
continue-on-error: true #To make sure that SARIF upload gets called and also not to block CI run on snyk test failure
Expand All @@ -66,7 +67,7 @@ jobs:
name: Run snyk monitor
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Run Snyk to check for vulnerabilities
uses: snyk/actions/node@master #Pre-created container
with:
Expand All @@ -78,9 +79,9 @@ jobs:
name: Run unit tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'yarn'
Expand All @@ -95,9 +96,9 @@ jobs:
name: Check format with prettier
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'yarn'
Expand All @@ -112,9 +113,9 @@ jobs:
name: Lint with ESLint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'yarn'
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v16.15.1
v20.11.0
2 changes: 2 additions & 0 deletions cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ export default defineConfig({
video: false,
defaultCommandTimeout: 15000,
retries: 2,
numTestsKeptInMemory: 0,
experimentalMemoryManagement: true,
e2e: {
// We've imported your old cypress plugins here.
// You may want to clean this up later by importing these.
Expand Down
67 changes: 34 additions & 33 deletions cypress/e2e/pages/aliquoting.cy.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { AliquotMutation, AliquotMutationVariables } from '../../../src/types/sdk';
import { selectSGPNumber } from '../shared/customReactSelect.cy';
import { HttpResponse } from 'msw';

function scanInLabware() {
cy.get('#labwareScanInput').type('STAN-011{enter}');
Expand Down Expand Up @@ -42,39 +43,6 @@ describe('Aliquoting', () => {
});
});

context('when aliquoting fails', () => {
before(() => {
cy.visit('/lab/aliquoting');

cy.msw().then(({ worker, graphql }) => {
worker.use(
graphql.mutation<AliquotMutation, AliquotMutationVariables>('Aliquot', (req, res, ctx) => {
return res.once(
ctx.errors([
{
message: 'Exception while fetching data (/aliquot) : Failed to aliquot'
}
])
);
})
);
});

scanInLabware();
selectSGPNumber('SGP1008');
enterNumberOfDestinationTubes('4');
cy.findByText('Aliquot').click();
});

it("doesn't disable the Aliquot button", () => {
cy.findByRole('button', { name: 'Aliquot' }).should('not.be.disabled');
});

it('shows an error message', () => {
cy.findByText('Failed to aliquot').should('be.visible');
});
});

context('when aliquoting is successful', () => {
before(() => {
cy.visit('/lab/aliquoting');
Expand Down Expand Up @@ -133,4 +101,37 @@ describe('Aliquoting', () => {
cy.url().should('be.equal', 'http://localhost:3000/store');
});
});

context('when aliquoting fails', () => {
before(() => {
cy.visit('/lab/aliquoting');
cy.msw().then(({ worker, graphql }) => {
worker.use(
graphql.mutation<AliquotMutation, AliquotMutationVariables>('Aliquot', () => {
return HttpResponse.json({
errors: [
{
message: 'Exception while fetching data (/aliquot) : Failed to aliquot'
}
]
});
})
);
});

scanInLabware();
selectSGPNumber('SGP1008');
enterNumberOfDestinationTubes('4');
cy.findByText('Aliquot').click();
});

it("doesn't disable the Aliquot button", () => {
cy.findByRole('button', { name: 'Aliquot' }).should('not.be.disabled');
});

it('shows an error message', () => {
cy.findByText('Failed to aliquot').should('be.visible');
});
after(() => {});
});
});
21 changes: 11 additions & 10 deletions cypress/e2e/pages/blockProcessing.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { selectOption, selectSGPNumber } from '../shared/customReactSelect.cy';
import { sampleFactory, tissueFactory } from '../../../src/lib/factories/sampleFactory';
import { slotFactory } from '../../../src/lib/factories/slotFactory';
import { createLabwareFromParams } from '../../../src/mocks/handlers/labwareHandlers';
import { HttpResponse } from 'msw';

describe('Block Processing', () => {
shouldDisplyProjectAndUserNameForWorkNumber('/lab/original_sample_processing?type=block');
Expand Down Expand Up @@ -255,15 +256,15 @@ describe('Block Processing', () => {
worker.use(
graphql.mutation<PerformTissueBlockMutation, PerformTissueBlockMutationVariables>(
'PerformTissueBlock',
(req, res, ctx) => {
return res(
ctx.data({
() => {
return HttpResponse.json({
data: {
performTissueBlock: {
labware: newLabware,
operations: []
}
})
);
}
});
}
)
);
Expand Down Expand Up @@ -323,16 +324,16 @@ describe('Block Processing', () => {
worker.use(
graphql.mutation<PerformTissueBlockMutation, PerformTissueBlockMutationVariables>(
'PerformTissueBlock',
(req, res, ctx) => {
return res.once(
ctx.errors([
() => {
return HttpResponse.json({
errors: [
{
extensions: {
problems: ['This thing went wrong', 'This other thing went wrong']
}
}
])
);
]
});
}
)
);
Expand Down
Loading

0 comments on commit e507d51

Please sign in to comment.