-
Notifications
You must be signed in to change notification settings - Fork 255
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cypress tests and e2e github action flow (#5896)
* test: welcome test, dashboard test, explore browser test * test: snapshot testing * feat: adding testing snapshots * chore: update unmet peer dependency * fix: name of dropdown toggle * test: connecting to influxdb * fix: remove unnecessary influxdb-onboarding.sh script. * chore: updated go 1.17.1 for cypress tests * refactor: remove unnecessary influxdb-onboarding command from Makefile * refactor: remove unnecessary influxdb-onboarding command from circleci config * test: initialising database by using environment properties (in Makefile) * chore: fixing cypress tests * test: deleting connection to influxd1 * tests: optimize build, reuse workspace * tests: optimize build * test: remove unused code * fix: remove unuse dashboard * chore(e2e-pipeline): add pipeline for chrono cypress tests * chore: run action on push * chore: fix e2e pipeline * chore: add yarn install * chore: add log upload * chore: show logs to see what is going on with chronograf * chore: fix log cats * chore: add sleep * fix: chronograf run command * chore(ui): regenerate yarn.lock after rebase * test: welcome test, dashboard test, explore browser test * test: snapshot testing * feat: adding testing snapshots * chore(e2e): local script for influxdb enterprise deployment * chore(e2e): update cert-manager in actions pipeline * chore: fix coredns issue * chore: fix certmanager deployment * test: welcome test, dashboard test, explore browser test * test: snapshot testing * feat: adding testing snapshots * chore: update unmet peer dependency * test(cypress): add cypress env, and commands * test(cypress): add basic InfluxDB setup connection test * fix: temporary commented out the file as it uses non existing functions * test(cypress): add dashboard create, rename and delelete test * test(cypress): add routes * chore: regenerate yarn.lock * chore: remove unused file * chore: comment out code * chore: comment out code * fix: remove calling non-existent function * fix: createConnection uses unsafe SSL * turns on flux * test(cypress): rewritten Query Builder tests using _internal.monitor * chore: yarn prettier * fix: add missing custom window period * fix: remove it.only * Add flux-enable to a workflow file * fix: github actions workflow file flux-enabled * fix: force restart by deleing pod * fix: restart a container to apply a new configmap * fix: restart container * chore: flux-enabled is now true by default * fix: selecting correct elements * chore: update e2e pipeline * chore: add scheduled action run once a working day * chore: remove commented code * chore: change file extenction to .ts and adjust code accordingly * chore: pipeline fixes * chore: clean up e2e:influxdb2 references * fix: yarn installation, no risky changes in make clean * chore: update changelog Co-authored-by: Iszy-Ami <[email protected]> Co-authored-by: Iszy-Ami <[email protected]> Co-authored-by: Robert Hajek <[email protected]> Co-authored-by: Pavel Zavora <[email protected]> Co-authored-by: k3yi0 <[email protected]> Co-authored-by: k3yi0 <[email protected]>
- Loading branch information
1 parent
b6626af
commit 08743e4
Showing
46 changed files
with
1,870 additions
and
232 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
version: 2.1 | ||
orbs: | ||
browser-tools: circleci/[email protected] | ||
|
||
|
||
workflows: | ||
version: 2 | ||
main: | ||
|
@@ -29,7 +34,6 @@ workflows: | |
tags: | ||
only: /^[0-9]+(\.[0-9]+)*$/ | ||
|
||
version: 2 | ||
jobs: | ||
build: | ||
environment: | ||
|
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,16 @@ | ||
name: 'chronograf/cypress/report' | ||
on: | ||
workflow_run: | ||
workflows: ['chronograf/cypress'] | ||
types: | ||
- completed | ||
jobs: | ||
report: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: dorny/test-reporter@v1 | ||
with: | ||
artifact: test-results | ||
name: Cypress Tests | ||
path: "*.xml" | ||
reporter: java-junit |
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,92 @@ | ||
name: "chronograf/cypress" | ||
|
||
on: | ||
pull_request: | ||
schedule: | ||
- cron: '30 5 * * 1-5' | ||
|
||
jobs: | ||
e2e: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 30 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 1 | ||
|
||
- name: Setup Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: '1.16.4' | ||
|
||
- uses: actions/setup-node@v2 | ||
with: | ||
node-version: '14.15.0' | ||
- run: if [ ! -x "$(command -v yarn)" ]; then npm install -g yarn; fi | ||
- run: yarn node --version | ||
|
||
- name: Setup Helm | ||
uses: azure/setup-helm@v1 | ||
with: | ||
version: v3.6.3 | ||
|
||
- name: Create kind cluster | ||
uses: helm/[email protected] | ||
with: | ||
cluster_name: "chronograf-testing" | ||
config: .github/workflows/resources/kind-config.yaml | ||
|
||
- name: Create Enterprise Test Resources | ||
run: | | ||
helm repo add jetstack https://charts.jetstack.io | ||
helm repo add influxdata https://helm.influxdata.com/ | ||
helm repo update | ||
helm upgrade --wait --install \ | ||
cert-manager jetstack/cert-manager \ | ||
--namespace cert-manager \ | ||
--create-namespace \ | ||
--version v1.5.4 \ | ||
--set prometheus.enabled=false \ | ||
--set webhook.timeoutSeconds=30 \ | ||
--set installCRDs=true | ||
kubectl apply -f .github/workflows/resources/test-resources.yaml | ||
kubectl create secret generic influxdb-license --from-literal=INFLUXDB_ENTERPRISE_LICENSE_KEY=${INFLUXDB_ENTERPRISE_LICENSE_KEY} | ||
helm upgrade --install influxdb influxdata/influxdb-enterprise --namespace default --set-string envFromSecret=influxdb-license --set-string data.service.type=NodePort | ||
kubectl patch svc influxdb-influxdb-enterprise-data --type=json -p '[{"op":"replace","path":"/spec/ports/0/nodePort","value":30086}]' | ||
env: | ||
INFLUXDB_ENTERPRISE_LICENSE_KEY: "${{ secrets.INFLUXDB_ENTERPRISE_LICENSE_KEY }}" | ||
|
||
- name: Chronograf | ||
run: | | ||
make | ||
RUNNER_TRACKING_ID="" && (nohup ./chronograf > out.log 2>&1 &) | ||
sleep 10 | ||
- name: Chronograf test url | ||
run: | | ||
echo "InfluxDB data node status: $(curl -Isk "https://localhost:8086/ping" | head -n 1)" | ||
echo "Chronograf status: $(curl -Isk "http://localhost:8888" | head -n 1)" | ||
cat out.log || true | ||
- name: Cypress | ||
uses: addnab/docker-run-action@v3 | ||
with: | ||
image: cypress/browsers:node16.14.0-slim-chrome99-ff97 | ||
options: -i -v ${{ github.workspace }}:/chronograf -w /chronograf/ui --add-host=host.docker.internal:host-gateway | ||
shell: sh | ||
run: | | ||
apt update | ||
apt install -y build-essential | ||
yarn install --frozen-lockfile | ||
yarn run cypress run --browser chrome --config baseUrl=http://host.docker.internal:8888 --reporter junit --reporter-options 'mochaFile=cypress/results/results-[hash].xml' | ||
- name: Upload Artifact | ||
uses: actions/upload-artifact@v2 | ||
if: success() || failure() | ||
with: | ||
name: results | ||
path: | | ||
out.log | ||
ui/cypress/results/results-*.xml | ||
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,11 @@ | ||
--- | ||
kind: Cluster | ||
apiVersion: kind.x-k8s.io/v1alpha4 | ||
nodes: | ||
- role: control-plane | ||
image: kindest/node:v1.21.1@sha256:69860bda5563ac81e3c0057d654b5253219618a22ec3a346306239bba8cfa1a6 | ||
extraPortMappings: | ||
- containerPort: 30086 | ||
hostPort: 8086 | ||
listenAddress: "0.0.0.0" | ||
--- |
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,16 @@ | ||
--- | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: influxdb-auth | ||
stringData: | ||
username: admin | ||
password: admin | ||
--- | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: influxdb-shared-secret | ||
stringData: | ||
secret: MY RANDOM STRING | ||
--- |
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
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,13 @@ | ||
{ | ||
"$schema": "https://on.cypress.io/cypress.schema.json", | ||
"baseUrl": "http://localhost:8888", | ||
"video": false, | ||
"env": { | ||
"ALLOW_SCREENSHOT": true, | ||
"url": "https://localhost:8086", | ||
"username": "admin", | ||
"password": "admin", | ||
"connectionName": "E1M1", | ||
"insecureSkipVerify": 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,6 @@ | ||
{ | ||
"dashboards": "/dashboards", | ||
"hosts": "/hosts", | ||
"explorer": "/data-explorer", | ||
"config": "/manage-sources" | ||
} |
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,22 @@ | ||
/* eslint @typescript-eslint/no-unused-vars: "off" */ | ||
import 'jest' | ||
|
||
import { | ||
getByTestID, | ||
cutConnections, | ||
createConnection, | ||
createDashboard, | ||
deleteDashboards, | ||
} from './support/commands' | ||
|
||
declare global { | ||
namespace Cypress { | ||
interface Chainable { | ||
getByTestID: typeof getByTestID | ||
cutConnections: typeof cutConnections | ||
createConnection: typeof createConnection | ||
createDashboard: typeof createDashboard | ||
deleteDashboards: typeof deleteDashboards | ||
} | ||
} | ||
} |
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 @@ | ||
describe('dashboards', () => { | ||
beforeEach(() => { | ||
cy.deleteDashboards() | ||
cy.cutConnections() | ||
cy.createConnection() | ||
cy.get('@connections').then(connections => { | ||
cy.fixture('routes').then(({dashboards}) => { | ||
cy.visit(`/sources/${connections[0].id}${dashboards}`) | ||
}) | ||
}) | ||
}) | ||
|
||
it('create, rename and delete a dashboard', () => { | ||
// create a dashboard | ||
cy.get('button').contains('Create Dashboard').click() | ||
|
||
const newName = 'DashboardQA' | ||
|
||
// rename the dashboard | ||
cy.get('.rename-dashboard') | ||
.should('have.text', 'Name This Dashboard') | ||
.type(`${newName}{enter}`) | ||
.should('have.text', newName) | ||
|
||
// delete the dashboard | ||
cy.get('@connections').then(connections => { | ||
cy.fixture('routes').then(({dashboards}) => { | ||
cy.visit(`/sources/${connections[0].id}${dashboards}`) | ||
}) | ||
}) | ||
|
||
// DOM Element where the dashboard resides | ||
cy.get('.panel-body > table > tbody') | ||
.should('exist') | ||
.within(() => { | ||
// delete button | ||
cy.get('.confirm-button--confirmation').click({force: true}) | ||
}) | ||
.should('not.exist') | ||
}) | ||
}) |
Oops, something went wrong.