-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add Hindi localization * 📖 hindi translation progress * 📖 complete feature example localization
- Loading branch information
Showing
7 changed files
with
258 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"default": { | ||
"language": "hi", | ||
"format": ["summary", "html:cucumber-report.html"] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
रूप लेख: प्रमाणीकरण चालू ADEQUATESHOP API | ||
|
||
प्रमाणीकरण उदाहरण के साथ एपीआई ऑटोमेशन | ||
|
||
परिदृश्य: पंजीकृत डेटा का उपयोग कर उपयोगकर्ता पंजीकरण | ||
अगर मैं एक बनाता हूँ "POST" का अनुरोध "http://restapi.adequateshop.com/api/authaccount/registration" | ||
और मैंने शरीर को पर सेट किया है | ||
""" | ||
{ | ||
"name": "PactumJS 01", | ||
"email": "[email protected]", | ||
"password": 123456 | ||
} | ||
""" | ||
जब मुझे एक प्रतिक्रिया मिलती है | ||
तब मुझे उम्मीद है कि प्रतिक्रिया की स्थिति होनी चाहिए "200" | ||
और मुझे उम्मीद है कि प्रतिक्रिया में एक जेसन होना चाहिए | ||
""" | ||
{ | ||
"code": 1, | ||
"message": "The email address you have entered is already registered", | ||
"data": null | ||
} | ||
""" | ||
|
||
परिदृश्य: अमान्य डेटा का उपयोग कर उपयोगकर्ता पंजीकरण | ||
अगर मैं एक बनाता हूँ "POST" का अनुरोध "http://restapi.adequateshop.com/api/authaccount/registration" | ||
और मैंने शरीर को पर सेट किया है | ||
""" | ||
{ | ||
"name": "PactumJS XXX", | ||
"email": "pactumjsxxx", | ||
"password": 123456 | ||
} | ||
""" | ||
जब मुझे एक प्रतिक्रिया मिलती है | ||
तब मुझे उम्मीद है कि प्रतिक्रिया की स्थिति होनी चाहिए "400" | ||
और मुझे उम्मीद है कि प्रतिक्रिया में एक जेसन होना चाहिए "ModelState" | ||
""" | ||
{ | ||
"User.email": [ | ||
"Enter valid email address" | ||
] | ||
} | ||
""" | ||
|
||
परिदृश्य: वैध डेटा का उपयोग करके उपयोगकर्ता लॉगिन | ||
अगर मैं एक बनाता हूँ "POST" का अनुरोध "http://restapi.adequateshop.com/api/authaccount/login" | ||
और मैंने शरीर को पर सेट किया है | ||
""" | ||
{ | ||
"email": "[email protected]", | ||
"password": 123456 | ||
} | ||
""" | ||
जब मुझे एक प्रतिक्रिया मिलती है | ||
तब मुझे उम्मीद है कि प्रतिक्रिया की स्थिति होनी चाहिए "200" | ||
और मुझे उम्मीद है कि प्रतिक्रिया में एक जेसन स्कीमा होना चाहिए "data" | ||
""" | ||
{ | ||
"type": "object", | ||
"properties": { | ||
"Id": { | ||
"type": "integer" | ||
}, | ||
"Name": { | ||
"type": "string" | ||
}, | ||
"Email": { | ||
"type": "string" | ||
}, | ||
"Token": { | ||
"type": "string" | ||
} | ||
} | ||
} | ||
""" | ||
|
||
परिदृश्य: अमान्य डेटा का उपयोग करके उपयोगकर्ता लॉगिन | ||
अगर मैं एक बनाता हूँ "POST" का अनुरोध "http://restapi.adequateshop.com/api/authaccount/login" | ||
और मैंने शरीर को पर सेट किया है | ||
""" | ||
{ | ||
"email": "[email protected]", | ||
"password": 111222333 | ||
} | ||
""" | ||
जब मुझे एक प्रतिक्रिया मिलती है | ||
तब मुझे उम्मीद है कि प्रतिक्रिया की स्थिति होनी चाहिए "200" | ||
और मुझे उम्मीद है कि प्रतिक्रिया में एक जेसन होना चाहिए | ||
""" | ||
{ | ||
"code": 1, | ||
"message": "invalid username or password", | ||
"data": null | ||
} | ||
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
const { faker } = require('@faker-js/faker') | ||
|
||
const randomData = { | ||
name: faker.name.fullName(), | ||
email: faker.internet.email(), | ||
password: faker.internet.password() | ||
} | ||
|
||
module.exports = { | ||
randomData | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
const { request, settings } = require('pactum') | ||
const { Before } = require('@cucumber/cucumber') | ||
|
||
Before(() => { | ||
settings.setReporterAutoRun(false) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
const pactum = require('pactum') | ||
const { Given, When, Then, Before, After } = require('@cucumber/cucumber') | ||
const { randomData } = require('./data') | ||
|
||
let spec = pactum.spec() | ||
let fakerData = { | ||
"name": randomData.name, | ||
"email": randomData.email, | ||
"password": randomData.password | ||
} | ||
|
||
Before(() => { | ||
spec = pactum.spec() | ||
}) | ||
|
||
Given(/^मैं एक बनाता हूँ "(.*)" का अनुरोध "(.*)"$/, function (method, endpoint) { | ||
spec[method.toLowerCase()](endpoint) | ||
}) | ||
|
||
Given(/^I set path param "(.*)" to "(.*)"$/, function (key, value) { | ||
spec.withPathParams(key, value) | ||
}) | ||
|
||
Given(/^I set query param "(.*)" to "(.*)"$/, function (key, value) { | ||
spec.withQueryParams(key, value) | ||
}) | ||
|
||
Given(/^I set basic authentication credentials "(.*)" and "(.*)"$/, function (username, password) { | ||
spec.withAuth(username, password) | ||
}) | ||
|
||
Given(/^I set header "(.*)" to "(.*)"$/, function (key, value) { | ||
spec.withHeaders(key, value) | ||
}) | ||
|
||
Given(/मैंने शरीर को पर सेट किया है/, function (body) { | ||
try { | ||
spec.withJson(JSON.parse(body)) | ||
} catch(error) { | ||
spec.withBody(body) | ||
} | ||
}) | ||
|
||
Given('मैं खाता बनाने के लिए यादृच्छिक परीक्षण डेटा का उपयोग करता हूं', function () { | ||
console.log(fakerData) | ||
spec.withJson(fakerData) | ||
}) | ||
|
||
Given(/^मैं यहाँ पर फ़ाइल अपलोड करता हूँ "(.*)"$/, function (filePath) { | ||
spec.withFile(filePath) | ||
}) | ||
|
||
Given(/^मैंने बहु-भाग प्रपत्र परम सेट किया है "(.*)" to "(.*)"$/, function (key, value) { | ||
spec.withMultiPartFormData(key, value) | ||
}) | ||
|
||
When('मुझे एक प्रतिक्रिया मिलती है', async function () { | ||
await spec.toss() | ||
}) | ||
|
||
Then('मुझे उम्मीद है कि प्रतिक्रिया की स्थिति होनी चाहिए "{int}"', function (code) { | ||
spec.response().should.have.status(code) | ||
}) | ||
|
||
Then(/^I expect response header "(.*)" should be "(.*)"$/, function (key, value) { | ||
spec.response().should.have.header(key, value) | ||
}) | ||
|
||
Then(/^I expect response header "(.*)" should have "(.*)"$/, function (key, value) { | ||
spec.response().should.have.headerContains(key, value) | ||
}) | ||
|
||
Then(/^मुझे उम्मीद है कि प्रतिक्रिया में एक जेसन होना चाहिए$/, function (json) { | ||
spec.response().should.have.json(JSON.parse(json)) | ||
}) | ||
|
||
Then(/^मुझे उम्मीद है कि प्रतिक्रिया में एक जेसन होना चाहिए "(.*)"$/, function (path, value) { | ||
spec.response().should.have.json(path, JSON.parse(value)) | ||
}) | ||
|
||
Then(/^I expect response should have a json like$/, function (json) { | ||
spec.response().should.have.jsonLike(JSON.parse(json)) | ||
}) | ||
|
||
Then(/^I expect response should have a json like at "(.*)"$/, function (path, value) { | ||
spec.response().should.have.jsonLike(path, JSON.parse(value)) | ||
}) | ||
|
||
Then(/^I expect response should have a json schema$/, function (json) { | ||
spec.response().should.have.jsonSchema(JSON.parse(json)) | ||
}) | ||
|
||
Then(/^मुझे उम्मीद है कि प्रतिक्रिया में एक जेसन स्कीमा होना चाहिए "(.*)"$/, function (path, value) { | ||
spec.response().should.have.jsonSchema(path, JSON.parse(value)) | ||
}) | ||
|
||
Then(/^I expect response should have a body$/, function (body) { | ||
spec.response().should.have.body(body) | ||
}) | ||
|
||
Then('मुझे उम्मीद है कि प्रतिक्रिया होनी चाहिए "{string}"', function (handler) { | ||
spec.response().should.have._(handler) | ||
}) | ||
|
||
Then(/^I store response at "(.*)" as "(.*)"$/, function (path, name) { | ||
spec.stores(name, path) | ||
}) | ||
|
||
After(() => { | ||
spec.end() | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
"name": "pusakatest", | ||
"version": "2.0.1", | ||
"description": "pusakatest is an automation testing tool based on pactum using bdd (cucumber) style", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "cucumber-js --config config/cucumber.json", | ||
"test-publish": "cucumber-js --config config/cucumber.json --publish" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/depapp/pusakatest.git" | ||
}, | ||
"author": "@depapp", | ||
"license": "ISC", | ||
"bugs": { | ||
"url": "https://github.com/depapp/pusakatest/issues" | ||
}, | ||
"homepage": "https://github.com/depapp/pusakatest#readme", | ||
"devDependencies": { | ||
"@cucumber/cucumber": "latest", | ||
"@faker-js/faker": "latest", | ||
"mocha": "latest", | ||
"pactum": "latest" | ||
} | ||
} |