-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Jamakase/add cypress #2199
Merged
+2,238
−9
Merged
Jamakase/add cypress #2199
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
63a1b77
Add initial e2e tests
jamakase 1a97b8e
Add data-id to controls
jamakase eeea7fe
Edit tests
jamakase 45efebc
Add e2e test starting
jamakase 202f78e
Update some cypress utils
jamakase 035c53f
Update tests
jamakase 8c02b9b
Update tests
jamakase 40cd664
Remove build for e2e
jamakase 1b7f44a
increase timeout
jamakase 5bd9fd4
Merge branch 'jamakase/add-cypress' of https://github.com/datalineio/…
jamakase 08a6788
Add skip onboarding test
jamakase 41dcea3
Cypress change tests order
jamakase 209ef99
Remove wildcard for cypress tests
jamakase 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# dependencies | ||
/node_modules | ||
/.pnp | ||
.pnp.js | ||
|
||
# testing | ||
/coverage | ||
|
||
# production | ||
/build | ||
|
||
# misc | ||
.DS_Store | ||
.env.local | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
|
||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
*.iml | ||
/.idea | ||
|
||
.npmrc | ||
.env | ||
.env.development | ||
.env.production | ||
|
||
/cypress/screenshots | ||
/cypress/videos | ||
/cypress/fixtures |
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 @@ | ||
## Start Cypress | ||
|
||
### `npm install` | ||
### `npm run cypress:open` | ||
|
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,20 @@ | ||
plugins { | ||
id "base" | ||
id "com.github.node-gradle.node" version "2.2.4" | ||
} | ||
|
||
node { | ||
download = true | ||
version = "14.11.0" | ||
} | ||
|
||
|
||
task e2etest(type: NpmTask) { | ||
dependsOn npmInstall | ||
|
||
args = ['run', 'cypress:ci'] | ||
inputs.files fileTree('cypress') | ||
inputs.file 'package.json' | ||
inputs.file 'package-lock.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,9 @@ | ||
{ | ||
"baseUrl": "http://localhost:3000", | ||
"testFiles": [ | ||
"onboarding.spec.js", | ||
"connection.spec.js", | ||
"destination.spec.js", | ||
"source.spec.js" | ||
] | ||
} |
44 changes: 44 additions & 0 deletions
44
airbyte-e2e-testing/cypress/integration/connection.spec.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,44 @@ | ||
describe("Connection main actions", () => { | ||
it("Create new connection", () => { | ||
cy.createTestConnection("Test connection source cypress", "Test destination cypress"); | ||
|
||
cy.get("div").contains("Test connection source cypress").should("exist"); | ||
cy.get("div").contains("Test destination cypress").should("exist"); | ||
}); | ||
|
||
it("Update connection", () => { | ||
cy.intercept("/api/v1/web_backend/connections/update").as("updateConnection"); | ||
|
||
cy.createTestConnection("Test update connection source cypress", "Test update connection destination cypress"); | ||
|
||
cy.visit("/"); | ||
cy.get("div").contains("Test update connection source cypress").click(); | ||
cy.get("div").contains("Test update connection destination cypress").click(); | ||
|
||
cy.get("div[data-id='settings-step']").click(); | ||
|
||
cy.get("div[role=combobox]").last().click(); | ||
cy.get("div[data-id='5m']").click(); | ||
cy.submit(); | ||
cy.wait("@updateConnection"); | ||
cy.get("span[data-id='success-result']").should("exist"); | ||
|
||
cy.get("div[data-id='status-step']").click(); | ||
cy.get("div").contains("5 min").should("exist"); | ||
}); | ||
|
||
it("Delete connection", () => { | ||
cy.createTestConnection("Test delete connection source cypress", "Test delete connection destination cypress"); | ||
|
||
cy.visit("/"); | ||
cy.get("div").contains("Test delete connection source cypress").click(); | ||
cy.get("div").contains("Test delete connection destination cypress").click(); | ||
|
||
cy.get("div[data-id='settings-step']").click(); | ||
|
||
cy.deleteEntity(); | ||
|
||
cy.deleteSource("Test delete connection source cypress"); | ||
cy.deleteDestination("Test delete connection destination cypress"); | ||
}); | ||
}); |
23 changes: 23 additions & 0 deletions
23
airbyte-e2e-testing/cypress/integration/destination.spec.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,23 @@ | ||
describe("Destination main actions", () => { | ||
it("Create new destination", () => { | ||
cy.createTestDestination("Test destination cypress"); | ||
|
||
cy.url().should("include", `${Cypress.config().baseUrl}/destination/`); | ||
}); | ||
|
||
it("Update destination", () => { | ||
cy.createTestDestination("Test destination cypress for update"); | ||
cy.updateDestination("Test destination cypress for update", "connectionConfiguration.destination_path", "/local/my-json"); | ||
|
||
cy.get("span[data-id='success-result']").should("exist"); | ||
cy.get("input[value='/local/my-json']").should("exist"); | ||
}); | ||
|
||
it("Delete destination", () => { | ||
cy.createTestDestination("Test destination cypress for delete"); | ||
cy.deleteDestination("Test destination cypress for delete"); | ||
|
||
cy.visit("/destination"); | ||
cy.get("div").contains("Test destination cypress for delete").should("not.exist"); | ||
}); | ||
}); |
14 changes: 14 additions & 0 deletions
14
airbyte-e2e-testing/cypress/integration/onboarding.spec.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,14 @@ | ||
describe("Onboarding actions", () => { | ||
it("Skip onboardding", () => { | ||
cy.visit("/"); | ||
cy.url().should("include", `${Cypress.config().baseUrl}/preferences`); | ||
|
||
// cy.fillEmail(""); | ||
cy.submit(); | ||
|
||
cy.url().should("include", `${Cypress.config().baseUrl}/onboarding`); | ||
cy.get("button[data-id='skip-onboarding']").click(); | ||
|
||
cy.url().should("equal", `${Cypress.config().baseUrl}/`); | ||
}); | ||
}); |
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,23 @@ | ||
describe("Source main actions", () => { | ||
it("Create new source", () => { | ||
cy.createTestSource("Test source cypress"); | ||
|
||
cy.url().should("include", `${Cypress.config().baseUrl}/source/`); | ||
}); | ||
|
||
it("Update source", () => { | ||
cy.createTestSource("Test source cypress for update"); | ||
cy.updateSource("Test source cypress for update", "connectionConfiguration.start_date", "2020-11-11"); | ||
|
||
cy.get("span[data-id='success-result']").should("exist"); | ||
cy.get("input[value='2020-11-11']").should("exist"); | ||
}); | ||
|
||
it("Delete source", () => { | ||
cy.createTestSource("Test source cypress for delete"); | ||
cy.deleteSource("Test source cypress for delete"); | ||
|
||
cy.visit("/"); | ||
cy.get("div").contains("Test source cypress for delete").should("not.exist"); | ||
}); | ||
}); |
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,21 @@ | ||
/// <reference types="cypress" /> | ||
// *********************************************************** | ||
// This example plugins/index.js can be used to load plugins | ||
// | ||
// You can change the location of this file or turn off loading | ||
// the plugins file with the 'pluginsFile' configuration option. | ||
// | ||
// You can read more here: | ||
// https://on.cypress.io/plugins-guide | ||
// *********************************************************** | ||
|
||
// This function is called when a project is opened or re-opened (e.g. due to | ||
// the project's config changing) | ||
|
||
/** | ||
* @type {Cypress.PluginConfig} | ||
*/ | ||
module.exports = (on, config) => { | ||
// `on` is used to hook into various events Cypress emits | ||
// `config` is the resolved Cypress 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,70 @@ | ||
Cypress.Commands.add("submit", () => { | ||
cy.get("button[type=submit]").click(); | ||
}) | ||
|
||
Cypress.Commands.add("fillEmail", (email) => { | ||
cy.get("input[name=email]").type(email); | ||
}) | ||
|
||
Cypress.Commands.add("fillTestExchangeForm", (name) => { | ||
cy.intercept("/source_definition_specifications/get").as("getSourceSpecifications"); | ||
|
||
cy.get("input[name=name]").type(name); | ||
cy.get("div[role=combobox]").click(); | ||
cy.get("div").contains("Exchange Rates Api").click(); | ||
|
||
cy.wait("@getSourceSpecifications"); | ||
|
||
cy.get("input[name='connectionConfiguration.base']").type("USD"); | ||
cy.get("input[name='connectionConfiguration.start_date']").type("2020-12-12"); | ||
}) | ||
|
||
Cypress.Commands.add("fillTestLocalJsonForm", (name) => { | ||
cy.intercept("/destination_definition_specifications/get").as("getDestinationSpecifications"); | ||
|
||
cy.get("input[name=name]").type(name); | ||
cy.get("div[role=combobox]").click(); | ||
cy.get("div").contains("Local JSON").click(); | ||
|
||
cy.wait("@getDestinationSpecifications"); | ||
|
||
cy.get("input[name='connectionConfiguration.destination_path']").type("/local"); | ||
}) | ||
|
||
Cypress.Commands.add("openSourcePage", () => { | ||
cy.visit("/"); | ||
cy.intercept("/sources/list").as("getSourcesList"); | ||
cy.wait("@getSourcesList"); | ||
}) | ||
|
||
Cypress.Commands.add("openDestinationPage", () => { | ||
cy.visit("/destination"); | ||
cy.intercept("/destinations/list").as("getDestinationsList"); | ||
cy.wait("@getDestinationsList"); | ||
}) | ||
|
||
Cypress.Commands.add("openNewSourceForm", () => { | ||
cy.openSourcePage(); | ||
cy.get("button[data-id='new-source'").click(); | ||
cy.url().should("eq", `${Cypress.config().baseUrl}/source/new-source`); | ||
}) | ||
|
||
Cypress.Commands.add("openNewDestinationForm", () => { | ||
cy.openDestinationPage(); | ||
cy.get("button[data-id='new-destination'").click(); | ||
cy.url().should("eq", `${Cypress.config().baseUrl}/destination/new-destination`); | ||
}) | ||
|
||
Cypress.Commands.add("updateField", (field, value) => { | ||
cy.get("input[name='" + field + "']").clear().type(value); | ||
}) | ||
|
||
Cypress.Commands.add("openSettingForm", (name) => { | ||
cy.get("div").contains(name).click(); | ||
cy.get("div[data-id='settings-step']").click(); | ||
}) | ||
|
||
Cypress.Commands.add("deleteEntity", () => { | ||
cy.get("button[data-id='open-delete-modal']").click(); | ||
cy.get("button[data-id='delete']").click(); | ||
}) |
24 changes: 24 additions & 0 deletions
24
airbyte-e2e-testing/cypress/support/commands/connection.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,24 @@ | ||
Cypress.Commands.add("createTestConnection", (sourceName, destinationName) => { | ||
cy.intercept("/api/v1/sources/check_connection").as("checkConnectionSource"); | ||
cy.intercept("/api/v1/destinations/check_connection").as("checkConnectionDestination"); | ||
|
||
cy.intercept("/api/v1/sources/discover_schema").as("discoverSchema"); | ||
cy.intercept("/api/v1/connections/create").as("createConnection"); | ||
|
||
cy.createTestSource(sourceName); | ||
cy.createTestDestination(destinationName); | ||
cy.wait(3000); | ||
|
||
cy.get("div[role=combobox]").click(); | ||
cy.get("div").contains(sourceName).click(); | ||
cy.wait("@checkConnectionSource"); | ||
cy.wait("@checkConnectionDestination"); | ||
|
||
cy.wait("@discoverSchema"); | ||
|
||
cy.get("div[role=combobox]").last().click(); | ||
cy.get("div[data-id='manual']").click(); | ||
cy.submit(); | ||
|
||
cy.wait("@createConnection"); | ||
}) |
30 changes: 30 additions & 0 deletions
30
airbyte-e2e-testing/cypress/support/commands/destination.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,30 @@ | ||
Cypress.Commands.add("createTestDestination", (name) => { | ||
cy.intercept("/scheduler/destinations/check_connection").as("checkDestinationConnection"); | ||
cy.intercept("/destinations/create").as("createDestination"); | ||
|
||
cy.openNewDestinationForm(); | ||
cy.fillTestLocalJsonForm(name); | ||
cy.submit(); | ||
|
||
cy.wait("@checkDestinationConnection"); | ||
cy.wait("@createDestination"); | ||
}) | ||
|
||
Cypress.Commands.add("updateDestination", (name, field, value) => { | ||
cy.intercept("/destinations/check_connection_for_update").as("checkDestinationUpdateConnection"); | ||
cy.intercept("/destinations/update").as("updateDestination"); | ||
|
||
cy.openDestinationPage(); | ||
cy.openSettingForm(name); | ||
cy.updateField(field, value); | ||
cy.submit(); | ||
|
||
cy.wait("@checkDestinationUpdateConnection"); | ||
cy.wait("@updateDestination"); | ||
}) | ||
|
||
Cypress.Commands.add("deleteDestination", (name) => { | ||
cy.openDestinationPage(); | ||
cy.openSettingForm(name); | ||
cy.deleteEntity(); | ||
}) |
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 @@ | ||
import "./common"; | ||
import "./source"; | ||
import "./destination"; | ||
import "./connection"; |
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,30 @@ | ||
Cypress.Commands.add("createTestSource", (name) => { | ||
cy.intercept("/scheduler/sources/check_connection").as("checkSourceUpdateConnection"); | ||
cy.intercept("/sources/create").as("createSource"); | ||
|
||
cy.openNewSourceForm(); | ||
cy.fillTestExchangeForm(name); | ||
cy.submit(); | ||
|
||
cy.wait("@checkSourceUpdateConnection"); | ||
cy.wait("@createSource"); | ||
}) | ||
|
||
Cypress.Commands.add("updateSource", (name, field, value) => { | ||
cy.intercept("/sources/check_connection_for_update").as("checkSourceConnection"); | ||
cy.intercept("/sources/update").as("updateSource"); | ||
|
||
cy.openSourcePage(); | ||
cy.openSettingForm(name); | ||
cy.updateField(field, value); | ||
cy.submit(); | ||
|
||
cy.wait("@checkSourceConnection"); | ||
cy.wait("@updateSource"); | ||
}) | ||
|
||
Cypress.Commands.add("deleteSource", (name) => { | ||
cy.openSourcePage(); | ||
cy.openSettingForm(name); | ||
cy.deleteEntity(); | ||
}) |
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,3 @@ | ||
// Import commands.js using ES2015 syntax: | ||
import './commands' | ||
|
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.
each test depends on the state created by the previous test? am i reading that right? is there a reasonable way to not have this be the case. we generally try to make it so that the state of each test is totally isolated from one another.