Ayush
02/24/2022, 11:01 AMAyush
02/24/2022, 11:01 AM"use strict"
const { Pact } = require("@pact-foundation/pact")
const path = require('path');
const {eachLike} = require("@pact-foundation/pact/src/dsl/matchers");
const Constant = require("../src/Constant");
const API_HOST = "<http://localhost:7000/dev/>"
const provider = new Pact({
consumer: 'portal-ui',
provider: 'portal',
port: 7000,
log: path.resolve(process.cwd(), 'logs', 'pact.log'),
dir: path.resolve(process.cwd(), 'pacts'),
logLevel: 'DEBUG',
});
describe('SiteSpeed Details Service', () => {
describe('Wanted to get SiteSpeed Details', () => {
beforeAll(() =>
provider.setup().then(() => {
provider.addInteraction({
uponReceiving: 'a request to list sitespeed details',
withRequest: {
method: 'GET',
path: API_HOST+'portal/v1/sitespeed/pages?executionId=4660',
},
willRespondWith: {
status: 200,
body: eachLike(
{
execution_id: 4660,
execution_page_id: 8207,
first_contentful_paint_median: 6791,
},
{ min: 1 }
),
},
});
})
);
it('should return the correct data', async() => {
const sitespeed = await fetch(API_HOST+'sitespeed/pages?executionId=4660');
const response = await sitespeed.json();
expect(response[0].execution_id).toBe(4660);
expect(response[0].execution_page_id).toBe(8207);
});
afterEach(() => provider.verify());
afterAll(() => provider.finalize());
});
});
Matt (pactflow.io / pact-js / pact-go)
pact.log
and terminal output? It should show us there why it’s not workingMatt (pactflow.io / pact-js / pact-go)
query
Matt (pactflow.io / pact-js / pact-go)
Ayush
02/24/2022, 11:10 AMI, [2022-02-24T16:27:48.550621 #29652] INFO -- : Verifying - interactions matched
I, [2022-02-24T16:27:48.552026 #29652] INFO -- : Registered expected interaction GET <http://localhost:7000/dev/sitespeed/pages?executionId=4660>
D, [2022-02-24T16:27:48.552434 #29652] DEBUG -- : {
"description": "a request to list sitespeed details",
"request": {
"method": "GET",
"path": "<http://localhost:7000/dev/sitespeed/pages?executionId=4660>"
},
"response": {
"status": 200,
"headers": {
},
"body": {
"json_class": "Pact::ArrayLike",
"contents": {
"execution_id": 4660,
"execution_page_id": 8207,
"first_contentful_paint_median": 6791,
},
"min": 1
}
},
"metadata": null
}
I, [2022-02-24T16:27:48.558270 #29652] INFO -- : Cleared interactions
Matt (pactflow.io / pact-js / pact-go)
Matt (pactflow.io / pact-js / pact-go)
Ayush
02/24/2022, 11:19 AM[2022-02-24 11:17:53.297 +0000] INFO (32372 on C02YQC2LLVCG): pact-node@10.17.1: Creating Pact Server with options:
{"timeout":30000,"consumer":"qe-portal-ui","cors":false,"dir":"/Users/athaper/Repo/qe-portal-ui/pacts","host":"127.0.0.1","log":"/Users/athaper/Repo/qe-portal-ui/logs/pact.log","logLevel":"INFO","pactfileWriteMode":"overwrite","provider":"qe-portal","spec":2,"ssl":false,"port":7000,"pactFileWriteMode":"overwrite"}
[2022-02-24 11:17:54.873 +0000] INFO (32372 on C02YQC2LLVCG): pact@9.17.2: Setting up Pact with Consumer "qe-portal-ui" and Provider "qe-portal"
using mock service on Port: "7000"
[2022-02-24 11:17:54.901 +0000] INFO (32372 on C02YQC2LLVCG): pact@9.17.2: Pact File Written
[2022-02-24 11:17:54.902 +0000] INFO (32372 on C02YQC2LLVCG): pact-node@10.17.1: Removing Pact process with PID: 32539
[2022-02-24 11:17:54.910 +0000] INFO (32372 on C02YQC2LLVCG): pact-node@10.17.1: Deleting Pact Server with options:
{"timeout":30000,"consumer":"qe-portal-ui","cors":false,"dir":"/Users/athaper/Repo/qe-portal-ui/pacts","host":"127.0.0.1","log":"/Users/athaper/Repo/qe-portal-ui/logs/pact.log","logLevel":"INFO","pactfileWriteMode":"overwrite","provider":"qe-portal","spec":2,"ssl":false,"port":7000,"pactFileWriteMode":"overwrite"}
Ayush
02/24/2022, 11:25 AM/Users/athaper/.asdf/shims/node --require /Applications/WebStorm.app/Contents/plugins/JavaScriptLanguage/helpers/jest-intellij/lib/jest-intellij-stdin-fix.js /Users/athaper/Repo/qe-portal-ui/node_modules/jest/bin/jest.js --colors --reporters /Applications/WebStorm.app/Contents/plugins/JavaScriptLanguage/helpers/jest-intellij/lib/jest-intellij-reporter.js --verbose --testNamePattern=^SiteSpeed Details Service --runTestsByPath /Users/athaper/Repo/qe-portal-ui/contract_tests/sitespeed_execution.spec.js
[2022-02-24 11:20:16.971 +0000] INFO (32777 on C02YQC2LLVCG): pact-node@10.17.1: Creating Pact Server with options:
{"timeout":30000,"consumer":"qe-portal-ui","cors":false,"dir":"/Users/athaper/Repo/qe-portal-ui/pacts","host":"127.0.0.1","log":"/Users/athaper/Repo/qe-portal-ui/logs/pact.log","logLevel":"DEBUG","pactfileWriteMode":"overwrite","provider":"qe-portal","spec":2,"ssl":false,"port":7000,"pactFileWriteMode":"overwrite"}
[2022-02-24 11:20:16.993 +0000] DEBUG (32777 on C02YQC2LLVCG): pact-node@10.17.1: Starting pact binary '/Users/athaper/Repo/qe-portal-ui/node_modules/@pact-foundation/pact-node/standalone/darwin-1.88.81/pact/bin/pact-mock-service', with arguments [service --consumer qe-portal-ui --cors false --pact_dir /Users/athaper/Repo/qe-portal-ui/pacts --host 127.0.0.1 --log /Users/athaper/Repo/qe-portal-ui/logs/pact.log --log-level DEBUG --provider qe-portal --pact_specification_version 2 --ssl false --port 7000 --pact-file-write-mode overwrite]
[2022-02-24 11:20:17.002 +0000] DEBUG (32777 on C02YQC2LLVCG): pact-node@10.17.1: Created '/Users/athaper/Repo/qe-portal-ui/node_modules/@pact-foundation/pact-node/standalone/darwin-1.88.81/pact/bin/pact-mock-service' process with PID: 32945
[2022-02-24 11:20:17.803 +0000] DEBUG (32777 on C02YQC2LLVCG): pact-node@10.17.1: INFO WEBrick 1.3.1
INFO ruby 2.2.2 (2015-04-13) [x86_64-darwin13]
[2022-02-24 11:20:17.803 +0000] DEBUG (32777 on C02YQC2LLVCG): pact-node@10.17.1: INFO WEBrick::HTTPServer#start: pid=32945 port=7000
[2022-02-24 11:20:18.049 +0000] INFO (32777 on C02YQC2LLVCG): pact@9.17.2: Setting up Pact with Consumer "qe-portal-ui" and Provider "qe-portal"
using mock service on Port: "7000"
[2022-02-24 11:20:18.078 +0000] INFO (32777 on C02YQC2LLVCG): pact@9.17.2: Pact File Written
[2022-02-24 11:20:18.078 +0000] INFO (32777 on C02YQC2LLVCG): pact-node@10.17.1: Removing Pact process with PID: 32945
[2022-02-24 11:20:18.083 +0000] DEBUG (32777 on C02YQC2LLVCG): pact-node@10.17.1: INFO going to shutdown ...
INFO WEBrick::HTTPServer#start done.
[2022-02-24 11:20:18.084 +0000] INFO (32777 on C02YQC2LLVCG): pact-node@10.17.1: Deleting Pact Server with options:
{"timeout":30000,"consumer":"qe-portal-ui","cors":false,"dir":"/Users/athaper/Repo/qe-portal-ui/pacts","host":"127.0.0.1","log":"/Users/athaper/Repo/qe-portal-ui/logs/pact.log","logLevel":"DEBUG","pactfileWriteMode":"overwrite","provider":"qe-portal","spec":2,"ssl":false,"port":7000,"pactFileWriteMode":"overwrite"}
Matt (pactflow.io / pact-js / pact-go)
/Users/athaper/Repo/qe-portal-ui/pacts
is empty?Ayush
02/24/2022, 11:39 AMMatt (pactflow.io / pact-js / pact-go)
Matt (pactflow.io / pact-js / pact-go)
ps -ef | grep ruby
Ayush
02/24/2022, 11:44 AMAyush
02/24/2022, 11:59 AM"@testing-library/jest-dom": "^5.14.1",
"@testing-library/react": "^12.0.0",
"autoprefixer": "^6.7.2",
"babel-core": "^7.0.0-bridge.0",
"babel-jest": "^23.4.2",
"babel-loader": "^8.0.0",
"c3": "^0.4.23",
"css-loader": "^0.26.1",
"file-loader": "^0.10.1",
"group-array": "^0.3.3",
"history": "^5.0.0",
"immutable": "^4.0.0-rc.12",
"jest": "^27.0.6",
"jest-pact": "^0.9.1",