Skip to content
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
Original file line number Diff line number Diff line change
@@ -1,94 +1,94 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`local-json-server test case 1`] = `
"────────────────────────────────────────────────────────────────────────────────

Running workflow local-json-server.yaml / before

✓ GET /items - step get-all-items-before
exports[`local-json-server local-json-server test case 1`] = `
"────────────────────────────────────────────────────────────────────────────────

Running workflow local-json-server.yaml / before

✓ GET /items - step get-all-items-before
    ✓ status code check (Response code 200 matches one of description codes: [200])
    ✓ content-type check
    ✓ schema check

────────────────────────────────────────────────────────────────────────────────

Running workflow local-json-server.yaml / crud-items

✓ POST /items - step add-item

────────────────────────────────────────────────────────────────────────────────

Running workflow local-json-server.yaml / crud-items

✓ POST /items - step add-item
    ✓ success criteria check
    ✓ status code check (Response code 201 matches one of description codes: [201])
    ✓ content-type check
    ✓ schema check

✗ GET /items - step get-all-items-again

✗ GET /items - step get-all-items-again
    ✗ success criteria check
    ✓ status code check (Response code 200 matches one of description codes: [200])
    ✓ content-type check
    ✓ schema check

✓ GET /items/{id} - step get-item-by-id

✓ GET /items/{id} - step get-item-by-id
    ✓ success criteria check
    ✓ success criteria check
    ✓ success criteria check
    ✓ status code check (Response code 200 matches one of description codes: [200, 404])
    ✓ content-type check
    ✓ schema check

✓ DELETE /items/{id} - step drop-item

✓ DELETE /items/{id} - step drop-item
    ✓ success criteria check
    ✓ status code check (Response code 200 matches one of description codes: [200])

✓ GET /items/{id} - step get-after-deleting

✓ GET /items/{id} - step get-after-deleting
    ✓ success criteria check
    ✓ status code check (Response code 404 matches one of description codes: [200, 404])
    ✓ content-type check

────────────────────────────────────────────────────────────────────────────────

Running workflow local-json-server.yaml / auto-inherit

✓ POST /items - step add-item-auto-inherit

────────────────────────────────────────────────────────────────────────────────

Running workflow local-json-server.yaml / auto-inherit

✓ POST /items - step add-item-auto-inherit
    ✓ status code check (Response code 201 matches one of description codes: [201])
    ✓ content-type check
    ✓ schema check

✓ GET /items - step get-all-items

✓ GET /items - step get-all-items
    ✓ status code check (Response code 200 matches one of description codes: [200])
    ✓ content-type check
    ✓ schema check

✓ GET /items/{id} - step get-item-by-id-auto-inherit

✓ GET /items/{id} - step get-item-by-id-auto-inherit
    ✓ status code check (Response code 404 matches one of description codes: [200, 404])
    ✓ content-type check

✓ DELETE /items/{id} - step drop-item-auto-inherit

✓ DELETE /items/{id} - step drop-item-auto-inherit
    ✓ success criteria check
    ✓ status code check (Response code 200 matches one of description codes: [200])




  Failed tests info:

  Workflow name: crud-items

    stepId - get-all-items-again
    ✗ success criteria check
      Checking simple criteria: {"condition":"$response.body#/0/value == 100"}
      

  Workflow name: crud-items

    stepId - get-all-items-again
    ✗ success criteria check
      Checking simple criteria: {"condition":"$response.body#/0/value == 100"}

  Summary for local-json-server.yaml

  Workflows: 2 passed, 1 failed, 3 total
  Steps: 9 passed, 1 failed, 10 total
  Checks: 31 passed, 1 failed, 32 total
  Time: <test>ms


  Time: <test>ms


┌────────────────────────────────────────────────────────────────┬────────────┬─────────┬─────────┬──────────┬─────────┐
│ Filename │ Workflows │ Passed │ Failed │ Warnings │ Skipped │
├────────────────────────────────────────────────────────────────┼────────────┼─────────┼─────────┼──────────┼─────────┤
│ x local-json-server.yaml │ 3 │ 2 │ 1 │ - │ - │
└────────────────────────────────────────────────────────────────┴────────────┴─────────┴─────────┴──────────┴─────────┘


└────────────────────────────────────────────────────────────────┴────────────┴─────────┴─────────┴──────────┴─────────┘



Tests exited with error
"
Expand Down
34 changes: 22 additions & 12 deletions __tests__/respect/local-json-server/local-json-server.test.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,26 @@
// import { getParams, getCommandOutput } from '../utils';
// import { join } from 'path';
import { spawn } from 'child_process';
import { getParams, getCommandOutput } from '../utils';
import { join } from 'path';

// test('local-json-server test case', () => {
// const indexEntryPoint = join(process.cwd(), 'packages/cli/lib/index.js');
// const fixturesPath = join(__dirname, 'local-json-server.yaml');
// const args = getParams(indexEntryPoint, ['respect', fixturesPath]);
describe('local-json-server', () => {
let serverProcess: any;

// const result = getCommandOutput(args);
// expect(result).toMatchSnapshot();
// });
beforeAll(async () => {
// Start json-server
serverProcess = spawn('npm', ['run', 'json-server'], { detached: true });
});

test('local-json-server test case', () => {
//TODO: Remove.Disable this test until json-server is added to the e2e flow.
expect(true).toBe(true);
afterAll(() => {
// Kill the process group to ensure child processes are cleaned up
process.kill(-serverProcess.pid);
});

test('local-json-server test case', () => {
const indexEntryPoint = join(process.cwd(), 'packages/cli/lib/index.js');
const fixturesPath = join(__dirname, 'local-json-server.yaml');
const args = getParams(indexEntryPoint, ['respect', fixturesPath]);

const result = getCommandOutput(args);
expect(result).toMatchSnapshot();
});
});
4 changes: 2 additions & 2 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ module.exports = {
],
coverageThreshold: {
'packages/core/': {
statements: 80,
statements: 84,
branches: 72,
functions: 76,
lines: 80,
lines: 84,
},
'packages/cli/': {
statements: 64,
Expand Down
Loading
Loading