-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate existing Cypress tests to Cypress + Cucumber #56970
Closed
Closed
Changes from 20 commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
699eea4
chore: move gitignore to the cypress directory
mdelapenya 70930c0
chore: ignore more test files
mdelapenya dc5e03b
fix: do not check the Loading Message
mdelapenya 2205b6d
chore: use cypres + webpack + cucumber scaffolding
mdelapenya d75e0ef
chore: add eslint and prettier for code linting
mdelapenya 4050a76
feat: convert existing Cypress test into BDD style
mdelapenya 0a65007
feat: add support for using proper Node version in MacOSX
mdelapenya 7d9fcbf
chore: use tslint
mdelapenya 687b796
chore: use old layout
mdelapenya 5e39f14
chore: remove prelint script meanwhile we fix TS lint
mdelapenya f781eb5
chore: move test results to a specific directory
mdelapenya 7eec1dc
chore: rename variable following old code
mdelapenya dfd1cbc
chore: remove non-needed lints, as we are going to use kibana build
mdelapenya 7d4b9d6
chore: import snapshot function from cypress
mdelapenya 446c9e6
chore: add readFile utils back from a bad removal
mdelapenya 6cfadf1
chore: change format of JSON spec file
mdelapenya e35d28e
chore: move CI directory to the proper layout in order for Jenkins to…
mdelapenya cffc9be
chore: store test-results from proper dir on Jenkins
mdelapenya 8f1deee
chore: store artifacts properly on Jenkins
mdelapenya db14dba
Merge branch 'master' into cypress-cucumber
elasticmachine 03442fd
Fix type issues
dgieselaar 031910e
Merge branch 'master' into cypress-cucumber
elasticmachine f7b5871
Merge branch 'master' into cypress-cucumber
mdelapenya 53fd242
chore: move APM UI tests dependencies to x-pack dir
mdelapenya ef117c8
Merge branch 'master' into cypress-cucumber
elasticmachine 46777c0
Merge branch 'master' into cypress-cucumber
mdelapenya 90ae2ad
fix: Remove duplicated dependency
mdelapenya 6eb7776
chore: update yarn.lock
mdelapenya eff893f
fix: update renovate.json5
mdelapenya 6d7a878
Merge branch 'master' into cypress-cucumber
elasticmachine File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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,4 @@ | ||
cypress/ingest-data/events.json | ||
cypress/screenshots/* | ||
|
||
cypress/test-results |
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
File renamed without changes.
File renamed without changes.
9 changes: 9 additions & 0 deletions
9
x-pack/legacy/plugins/apm/cypress/cypress/integration/apm.feature
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,9 @@ | ||
Feature: APM | ||
|
||
Background: | ||
Given a user browses the APM UI application | ||
When the user inspects the opbeans-go service | ||
|
||
Scenario: Transaction duration charts | ||
Then should redirect to correct path with correct params | ||
And should have correct y-axis ticks | ||
File renamed without changes.
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
31 changes: 31 additions & 0 deletions
31
x-pack/legacy/plugins/apm/cypress/cypress/support/commands.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,31 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
// *********************************************** | ||
// This example commands.js shows you how to | ||
// create various custom commands and overwrite | ||
// existing commands. | ||
// | ||
// For more comprehensive examples of custom | ||
// commands please read more here: | ||
// https://on.cypress.io/custom-commands | ||
// *********************************************** | ||
// | ||
// | ||
// -- This is a parent command -- | ||
// Cypress.Commands.add("login", (email, password) => { ... }) | ||
// | ||
// | ||
// -- This is a child command -- | ||
// Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... }) | ||
// | ||
// | ||
// -- This is a dual command -- | ||
// Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, options) => { ... }) | ||
// | ||
// | ||
// -- This is will overwrite an existing command -- | ||
// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... }) |
9 changes: 9 additions & 0 deletions
9
...k/legacy/plugins/apm/cypress/cypress.d.ts → ...ns/apm/cypress/cypress/support/index.d.ts
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
31 changes: 31 additions & 0 deletions
31
x-pack/legacy/plugins/apm/cypress/cypress/support/index.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,31 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
// *********************************************************** | ||
// This example support/index.js is processed and | ||
// loaded automatically before your test files. | ||
// | ||
// This is a great place to put global configuration and | ||
// behavior that modifies Cypress. | ||
// | ||
// You can change the location of this file or turn off | ||
// automatically serving support files with the | ||
// 'supportFile' configuration option. | ||
// | ||
// You can read more here: | ||
// https://on.cypress.io/configuration | ||
// *********************************************************** | ||
|
||
// Import commands.js using ES2015 syntax: | ||
import './commands'; | ||
|
||
// Alternatively you can use CommonJS syntax: | ||
// require('./commands') | ||
|
||
// @ts-ignore | ||
import { register } from '@cypress/snapshot'; | ||
|
||
register(); |
48 changes: 48 additions & 0 deletions
48
x-pack/legacy/plugins/apm/cypress/cypress/support/step_definitions/apm.ts
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,48 @@ | ||
/// <reference types="Cypress" /> | ||
|
||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { loginAndWaitForPage } from '../../integration/helpers'; | ||
|
||
const { Given, When, Then } = require('cypress-cucumber-preprocessor/steps'); | ||
|
||
Given(`a user browses the APM UI application`, () => { | ||
// open service overview page | ||
loginAndWaitForPage(`/app/apm#/services`); | ||
}); | ||
|
||
When(`the user inspects the opbeans-go service`, () => { | ||
// click opbeans-go service | ||
cy.get(':contains(opbeans-go)') | ||
.last() | ||
.click({ force: true }); | ||
}); | ||
|
||
Then(`should redirect to correct path with correct params`, () => { | ||
cy.url().should('contain', `/app/apm#/services/opbeans-go/transactions`); | ||
cy.url().should('contain', `transactionType=request`); | ||
}); | ||
|
||
Then(`should have correct y-axis ticks`, () => { | ||
const yAxisTick = | ||
'[data-cy=transaction-duration-charts] .rv-xy-plot__axis--vertical .rv-xy-plot__axis__tick__text'; | ||
|
||
cy.get(yAxisTick) | ||
.eq(2) | ||
.invoke('text') | ||
.snapshot(); | ||
|
||
cy.get(yAxisTick) | ||
.eq(1) | ||
.invoke('text') | ||
.snapshot(); | ||
|
||
cy.get(yAxisTick) | ||
.eq(0) | ||
.invoke('text') | ||
.snapshot(); | ||
}); |
41 changes: 41 additions & 0 deletions
41
x-pack/legacy/plugins/apm/cypress/cypress/webpack.config.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,41 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
module.exports = { | ||
resolve: { | ||
extensions: ['.ts', '.js'] | ||
}, | ||
node: { fs: 'empty', child_process: 'empty', readline: 'empty' }, | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.ts$/, | ||
exclude: [/node_modules/], | ||
use: [ | ||
{ | ||
loader: 'ts-loader' | ||
} | ||
] | ||
}, | ||
{ | ||
test: /\.feature$/, | ||
use: [ | ||
{ | ||
loader: 'cypress-cucumber-preprocessor/loader' | ||
} | ||
] | ||
}, | ||
{ | ||
test: /\.features$/, | ||
use: [ | ||
{ | ||
loader: 'cypress-cucumber-preprocessor/lib/featuresLoader' | ||
} | ||
] | ||
} | ||
] | ||
} | ||
}; |
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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @MadameSheema, I'd would love to get your insights about this spec 🙏 😊