-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tests: Enable cypress to run cucumber tests
Add libraries needed to run cucumber tests with cypress, namely cypress-cucumber-preprocessor and cypress-esbuild-preprocessor in order to translate gherkin steps to cypress executable test. Configure cypress to run the gherkin tests. Signed-off-by: Michal Polovka <mpolovka@redhat.com>
- Loading branch information
Showing
8 changed files
with
9,701 additions
and
13,370 deletions.
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 |
---|---|---|
@@ -1,10 +1,25 @@ | ||
import { defineConfig } from "cypress"; | ||
import createBundler from "@bahmutov/cypress-esbuild-preprocessor"; | ||
import { addCucumberPreprocessorPlugin } from "@badeball/cypress-cucumber-preprocessor"; | ||
import createEsbuildPlugin from "@badeball/cypress-cucumber-preprocessor/esbuild"; | ||
|
||
export default defineConfig({ | ||
e2e: { | ||
baseUrl: "https://server.ipa.demo/ipa/modern_ui/", | ||
}, | ||
hosts: { | ||
"server.ipa.demo": "127.0.0.1", | ||
specPattern: "**/*.feature", | ||
baseUrl: "http://localhost:3000/", | ||
|
||
async setupNodeEvents( | ||
on: Cypress.PluginEvents, | ||
config: Cypress.PluginConfigOptions | ||
): Promise<Cypress.PluginConfigOptions> { | ||
await addCucumberPreprocessorPlugin(on, config); | ||
on( | ||
"file:preprocessor", | ||
createBundler({ | ||
plugins: [createEsbuildPlugin(config)], | ||
}) | ||
); | ||
return config; | ||
}, | ||
}, | ||
}); |
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,5 @@ | ||
const cucumber = require("cypress-cucumber-preprocessor").default; | ||
|
||
module.exports = (on, config) => { | ||
on("file:preprocessor", cucumber()); | ||
}; |
Large diffs are not rendered by default.
Oops, something went wrong.
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,7 @@ | ||
import { When, Then, Given } from "@badeball/cypress-cucumber-preprocessor"; | ||
When("I am on the home page", () => { | ||
cy.visit("/"); | ||
}) | ||
Then("I should be on the page {string}", function(pageName) { | ||
cy.location('pathname').should('contain', pageName); | ||
}); |
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 @@ | ||
Feature: Basic sanity | ||
Teste if the application loads | ||
|
||
Scenario: Load the landing page | ||
When I am on the home page | ||
Then I should be on the page "active-users" |
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