-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use dedicated projects for integration tests (#422)
* Use dedicated projects for integration tests * Remove environment variable definitions
- Loading branch information
Showing
128 changed files
with
3,891 additions
and
1,019 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 was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
import assert from "node:assert"; | ||
import { join, relative } from "node:path"; | ||
import { cwd } from "node:process"; | ||
import { describe, it } from "node:test"; | ||
import { runCypress } from "../../sh"; | ||
import { getIntegrationClient } from "../clients"; | ||
import { getCreatedTestExecutionIssueKey } from "../util"; | ||
|
||
// ============================================================================================== // | ||
// https://github.com/Qytera-Gmbh/cypress-xray-plugin/issues/282 | ||
// ============================================================================================== // | ||
|
||
describe(relative(cwd(), __filename), { timeout: 180000 }, async () => { | ||
for (const test of [ | ||
{ | ||
projectDirectory: join(__dirname, "cloud"), | ||
projectKey: "CYP", | ||
scenarioIssueKey: "CYP-756", | ||
service: "cloud", | ||
testIssueKey: "CYP-757", | ||
title: "results upload works for mixed cypress and cucumber projects (cloud)", | ||
}, | ||
{ | ||
projectDirectory: join(__dirname, "server"), | ||
projectKey: "CYPLUG", | ||
scenarioIssueKey: "CYPLUG-165", | ||
service: "server", | ||
testIssueKey: "CYPLUG-166", | ||
title: "results upload works for mixed cypress and cucumber projects (server)", | ||
}, | ||
] as const) { | ||
await it(test.title, async () => { | ||
const output = runCypress(test.projectDirectory, { | ||
includeDefaultEnv: test.service, | ||
}); | ||
|
||
const testExecutionIssueKey = getCreatedTestExecutionIssueKey( | ||
test.projectKey, | ||
output, | ||
"both" | ||
); | ||
|
||
if (test.service === "cloud") { | ||
const searchResult = await getIntegrationClient("jira", test.service).search({ | ||
fields: ["id"], | ||
jql: `issue in (${testExecutionIssueKey})`, | ||
}); | ||
assert.ok(searchResult[0].id); | ||
const testResults = await getIntegrationClient("xray", test.service).getTestResults( | ||
searchResult[0].id | ||
); | ||
assert.deepStrictEqual( | ||
testResults.map((result) => result.jira.key), | ||
[test.testIssueKey, test.scenarioIssueKey] | ||
); | ||
} | ||
|
||
if (test.service === "server") { | ||
const testResults = await getIntegrationClient( | ||
"xray", | ||
test.service | ||
).getTestExecution(testExecutionIssueKey); | ||
assert.deepStrictEqual( | ||
testResults.map((result) => result.key), | ||
[test.testIssueKey, test.scenarioIssueKey] | ||
); | ||
} | ||
}); | ||
} | ||
}); |
5 changes: 5 additions & 0 deletions
5
test/integration/282/cloud/.cypress-cucumber-preprocessorrc.json
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 @@ | ||
{ | ||
"json": { | ||
"enabled": true | ||
} | ||
} |
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 @@ | ||
Feature: Testing a single scenario | ||
|
||
@TestName:CYP-756 | ||
Scenario: Single scenario test | ||
Given Something |
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,56 @@ | ||
const preprocessor = require("@badeball/cypress-cucumber-preprocessor"); | ||
const createEsbuildPlugin = require("@badeball/cypress-cucumber-preprocessor/esbuild"); | ||
const createBundler = require("@bahmutov/cypress-esbuild-preprocessor"); | ||
const { defineConfig } = require("cypress"); | ||
const fix = require("cypress-on-fix"); | ||
const { configureXrayPlugin, syncFeatureFile } = require("cypress-xray-plugin"); | ||
|
||
module.exports = defineConfig({ | ||
video: false, | ||
chromeWebSecurity: false, | ||
e2e: { | ||
supportFile: false, | ||
experimentalStudio: true, | ||
specPattern: "**/*.{feature,cy.js}", | ||
async setupNodeEvents(on, config) { | ||
const fixedOn = fix(on); | ||
await preprocessor.addCucumberPreprocessorPlugin(fixedOn, config); | ||
await configureXrayPlugin(fixedOn, config, { | ||
jira: { | ||
projectKey: "CYP", | ||
testExecutionIssue: { | ||
fields: { | ||
summary: "Integration test 282", | ||
}, | ||
}, | ||
}, | ||
xray: { | ||
uploadResults: true, | ||
testEnvironments: ["DEV"], | ||
status: { | ||
passed: "PASSED", | ||
}, | ||
}, | ||
cucumber: { | ||
featureFileExtension: ".feature", | ||
uploadFeatures: false, | ||
prefixes: { | ||
test: "TestName:", | ||
}, | ||
}, | ||
plugin: { | ||
debug: false, | ||
}, | ||
}); | ||
fixedOn("file:preprocessor", (file) => { | ||
syncFeatureFile(file); | ||
const cucumberPlugin = createBundler({ | ||
plugins: [createEsbuildPlugin.createEsbuildPlugin(config)], | ||
}); | ||
return cucumberPlugin(file); | ||
}); | ||
|
||
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 @@ | ||
import "cypress-xray-plugin/commands"; |
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 @@ | ||
import "./commands"; |
5 changes: 5 additions & 0 deletions
5
test/integration/282/cloud/cypress/support/step_definitions/steps.js
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 @@ | ||
import { Given } from "@badeball/cypress-cucumber-preprocessor"; | ||
|
||
Given("Something", () => { | ||
expect(true, true); | ||
}); |
Oops, something went wrong.