Skip to content

Commit

Permalink
✨ another big changes
Browse files Browse the repository at this point in the history
  • Loading branch information
depapp committed Aug 30, 2024
1 parent a0ce8b7 commit 9e835cb
Show file tree
Hide file tree
Showing 20 changed files with 373 additions and 132 deletions.
17 changes: 2 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ jobs:

strategy:
matrix:
node-version: [14.x, 20.x, 22.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
node-version: [14.x, 20.x]

steps:
- name: checkout
Expand All @@ -39,23 +38,11 @@ jobs:

- name: install dependencies
run: npm install
continue-on-error: ${{ matrix.node-version == '22.x' }}

- name: check for unsupported engine warning
if: matrix.node-version == '22.x'
run: |
npm install 2>&1 | tee npm-install.log | grep "npm warn EBADENGINE Unsupported engine"
if [ $? -ne 0 ]; then
echo "Expected engine warning not found"
exit 1
fi

- name: symlink using npm-link
run: npm link
if: matrix.node-version != '22.x'

- name: run pusakatest
run: |
node -v
pusakatest -y
if: matrix.node-version != '22.x'
pusakatest -y
13 changes: 11 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 3 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pusakatest",
"version": "2.3.0",
"version": "2.4.0",
"description": "pusakatest is an automation testing tool based on pactum using bdd (cucumber) style",
"main": "index.js",
"bin": "bin/create-project",
Expand All @@ -23,6 +23,7 @@
"dependencies": {
"arg": "^4.1.0",
"chalk": "^2.4.2",
"clear": "^0.1.0",
"esm": "^3.2.25",
"execa": "^1.0.0",
"figlet": "^1.5.2",
Expand Down Expand Up @@ -62,8 +63,5 @@
"test",
"http",
"GraphQL"
],
"engines": {
"node": ">=14 <=20"
}
]
}
4 changes: 2 additions & 2 deletions src/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function parseArgumentsIntoOptions(rawArgs) {
}

async function promptForMissingOptions(options) {
const defaultTemplate = 'indonesian';
const defaultTemplate = 'english';
if (options.skipPrompts) {
return {
...options,
Expand All @@ -36,7 +36,7 @@ async function promptForMissingOptions(options) {
type: 'list',
name: 'template',
message: 'what language/localisation do you want to use?',
choices: ['indonesian', 'english', 'korean', 'hindi'],
choices: ['english', 'indonesian', 'javanese', 'korean', 'hindi'],
default: defaultTemplate,
});
}
Expand Down
11 changes: 11 additions & 0 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import path from 'path';
import { projectInstall } from 'pkg-install';
import { promisify } from 'util';
import figlet from 'figlet';
import clear from 'clear';

const access = promisify(fs.access);
const writeFile = promisify(fs.writeFile);
Expand Down Expand Up @@ -45,6 +46,14 @@ export async function createProject(options) {
title: 'create project',
task: () => copyTemplateFiles(options),
},
{
title: 'create .gitignore',
task: async () => {
const gitignoreContent = 'node_modules/\ncucumber-report.html';
const gitignorePath = path.join(options.targetDirectory, '.gitignore');
await writeFile(gitignorePath, gitignoreContent);
},
},
{
title: 'install dependencies',
task: () =>
Expand All @@ -59,13 +68,15 @@ export async function createProject(options) {
);

await tasks.run();
clear();
figlet(`pusakatest`, (err, data) => {
console.log((data) + '\n');
console.log(
chalk.white(
` is ready to use. just run `+chalk.green(`npm run test`)
)
);
console.log('');
});
return true;
}
File renamed without changes.
5 changes: 2 additions & 3 deletions templates/english/features/support/steps.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,8 @@ Then(/^I expect response should contain a json$/, function (json) {
})

Then('I log the response body', async function () {
const response = await spec.toss().then((res) => res.json);
console.log(response);
this.attach(JSON.stringify(response, null, 2), 'application/json');
const response = await spec.toss().then((res) => res.json)
this.attach(JSON.stringify(response, null, 2), 'application/json')
});

After(() => {
Expand Down
2 changes: 1 addition & 1 deletion templates/english/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pusakatest",
"version": "2.3.0",
"version": "2.4.0",
"description": "pusakatest is an automation testing tool based on pactum using bdd (cucumber) style",
"main": "index.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion templates/hindi/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pusakatest",
"version": "2.2.3",
"version": "2.4.0",
"description": "pusakatest is an automation testing tool based on pactum using bdd (cucumber) style",
"main": "index.js",
"scripts": {
Expand Down
97 changes: 0 additions & 97 deletions templates/indonesian/features/contoh-autentikasi.feature

This file was deleted.

83 changes: 79 additions & 4 deletions templates/indonesian/features/contoh.feature
Original file line number Diff line number Diff line change
@@ -1,6 +1,81 @@
Fitur: API REQRES.IN
Fitur: DummyJSON API

Skenario: Menampilkan daftar user pada API REQRES.IN
Dengan Saya melakukan metode "GET" request pada "https://reqres.in/api/users"
Otomasi API dengan DummyJSON API

Skenario: Login pengguna menggunakan Kredensial yang Sah
Ketika Saya melakukan metode "POST" request pada "https://dummyjson.com/auth/login"
Dan Saya set data untuk body menggunakan
"""
{
"username": "emilys",
"password": "emilyspass"
}
"""
Ketika Saya menerima sebuah response API
Maka Saya mengharapkan status code response API nya "200"
Dan Saya mengharapkan response API nya berisi json
"""
{
"id": 1,
"email": "[email protected]",
"username": "emilys",
"firstName": "Emily",
"lastName": "Johnson",
"gender": "female"
}
"""

Skenario: Login pengguna menggunakan Kredensial Tidak Sah
Ketika Saya melakukan metode "POST" request pada "https://dummyjson.com/auth/login"
Dan Saya set data untuk body menggunakan
"""
{
"username": "notfounduser",
"password": "invalidpassword"
}
"""
Ketika Saya menerima sebuah response API
Maka Saya mengharapkan status code response API nya "400"
Dan Saya mengharapkan response API nya berisi json
"""
{
"message": "Invalid credentials"
}
"""

Skenario: Tambah Pengguna Baru menggunakan Data yang Sah
Ketika Saya melakukan metode "POST" request pada "https://dummyjson.com/users/add"
Dan Saya set data untuk body menggunakan
"""
{
"firstName": "Ujang",
"lastName": "Tea",
"maidenName": "Jajang",
"age": 17,
"gender": "male",
"email": "[email protected]",
"phone": "+62 812-1234-1234",
"username": "ujangjajang",
"password": "123123123"
}
"""
Ketika Saya menerima sebuah response API
Maka Saya mengharapkan status code response API nya "201"
Dan Saya mencatat isi response body nya

Skenario: Mendapatkan Data Pengguna Tunggal yang Sah
Ketika Saya melakukan metode "GET" request pada "https://dummyjson.com/users/1"
Ketika Saya menerima sebuah response API
Maka Saya mengharapkan status code response API nya "200"
Dan Saya mencatat isi response body nya

Skenario: Mendapatkan Data Pengguna Tunggal yang Tidak Sah
Ketika Saya melakukan metode "GET" request pada "https://dummyjson.com/users/99999"
Ketika Saya menerima sebuah response API
Maka Saya mengharapkan status code response API nya "200"
Maka Saya mengharapkan status code response API nya "404"
Dan Saya mengharapkan response API nya berisi json
"""
{
"message": "User with id '99999' not found"
}
"""
9 changes: 9 additions & 0 deletions templates/indonesian/features/support/steps.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,15 @@ Then(/^Saya mengharapkan response API nya memiliki json pada "(.*)"$/, function
spec.response().should.have.json(path, JSON.parse(value))
})

Then(/^Saya mengharapkan response API nya berisi json$/, function (json) {
spec.response().should.have.jsonLike(JSON.parse(json))
})

Then('Saya mencatat isi response body nya', async function () {
const response = await spec.toss().then((res) => res.json)
this.attach(JSON.stringify(response, null, 2), 'application/json')
});

After(() => {
spec.end()
})
2 changes: 1 addition & 1 deletion templates/indonesian/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pusakatest",
"version": "2.2.3",
"version": "2.4.0",
"description": "pusakatest is an automation testing tool based on pactum using bdd (cucumber) style",
"main": "index.js",
"scripts": {
Expand Down
Loading

0 comments on commit 9e835cb

Please sign in to comment.