Skip to content

Commit

Permalink
implement test cases based on cucumber framework
Browse files Browse the repository at this point in the history
  • Loading branch information
NazarAntoniuk19 committed Feb 9, 2025
1 parent c675193 commit 08d1833
Show file tree
Hide file tree
Showing 24 changed files with 1,798 additions and 309 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules
.DS_Store
.DS_Store
.tmp
27 changes: 20 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ This repository contains end-to-end (E2E) tests for the [SwagLabs](https://www.s
- Automated test execution for key functionalities of SauceDemo
- Uses WebdriverIO with JavaScript
- Page Object Model (POM) for better test structure
- Implements Mocha and Cucumber Frameworks
- Supports parallel execution

## Prerequisites
Expand All @@ -30,23 +31,35 @@ npm install

# Running Tests

Run all tests:
Run tests based on Mocha Framework:

```sh
npx wdio run ./wdio.conf.js
npm run test:mocha
```

Run specific test:
Run tests based on Cucumber Framework:

```sh
npm run test:cucumber
```
Run all tests:

```sh
npx wdio run ./wdio.conf.js --spec test.e8e.js
npm run test
```

# Test Structure

- /specs: Contains test scripts
- /pageobjects: Implements Page Object Model (POM)
- wdio.conf.js: Configuration file for WebdriverIO
## Mocha Framework
- `/test-mocha/specs`: Contains test scripts
- `/test-mocha/pageobjects`: Implements Page Object Model (POM)
- `mocha.conf.js`: WebdriverIO configuration file for Mocha Framework

## Cucumber Framework
- `/test-cucumber/features`: Contains features
- `/test-cucumber/features/step-definitions`: Contains step definitions for features
- `/test-cucumber/features/pageobjects`: Implements Page Object Model (POM)
- `cucumber.conf.js`: WebdriverIO configuration file for Cucumber Framework

# License

Expand Down
39 changes: 39 additions & 0 deletions cucumber.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
export const config = {
runner: 'local',
specs: [
'./test-cucumber/features/**/*.feature'
],
exclude: [
// 'path/to/excluded/files'
],
maxInstances: 10,
capabilities: [{
// capabilities for local browser web tests
browserName: 'chrome' // or "firefox", "microsoftedge", "safari"
}],
logLevel: 'info',
bail: 0,
waitforTimeout: 10000,
connectionRetryTimeout: 120000,
connectionRetryCount: 3,
framework: 'cucumber',
reporters: ['spec',
['cucumberjs-json', {
jsonFolder: '.tmp/json/',
language: 'en',
},
],],
cucumberOpts: {
require: ['./test-cucumber/features/step-definitions/**/*.js'], // Path to step definitions
backtrace: false,
requireModule: [],
dryRun: false,
failFast: false,
snippets: true,
source: true,
strict: true,
tagExpression: '',
timeout: 60000,
ignoreUndefinedDefinitions: true
}
}
24 changes: 24 additions & 0 deletions mocha.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
export const config = {
runner: 'local',
specs: [
'./test-mocha/specs/**/*.js'
],
exclude: [
// 'path/to/excluded/files'
],
maxInstances: 10,
capabilities: [{
browserName: 'chrome' // or "firefox", "microsoftedge", "safari"
}],
logLevel: 'info',
bail: 0,
waitforTimeout: 10000,
connectionRetryTimeout: 120000,
connectionRetryCount: 3,
framework: 'mocha',
reporters: ['spec'],
mochaOpts: {
ui: 'bdd',
timeout: 60000
}
}
Loading

0 comments on commit 08d1833

Please sign in to comment.