Skip to content
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

chore: runnign e2e locally #8

Draft
wants to merge 29 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
65ad004
test: new buckets tests
Cubone21 Sep 21, 2020
aae33da
test: filtering and sorting scrapers
Cubone21 Sep 21, 2020
a07301f
test: new tokens tests
Cubone21 Sep 21, 2020
7865535
test: new telegraf tests
Cubone21 Sep 22, 2020
cc752db
test: new dashboards tests
Cubone21 Sep 22, 2020
16f4592
test: new tasks tests
Cubone21 Sep 24, 2020
919f143
Merge pull request #1 from Cubone21/bonitoo_krcil_buckets
Cubone21 Sep 29, 2020
e928979
Merge pull request #2 from Cubone21/bonitoo_krcil_dashboards
Cubone21 Sep 29, 2020
2cd1814
Merge pull request #3 from Cubone21/bonitoo_krcil_scrapers
Cubone21 Sep 29, 2020
0fcb2d2
Merge pull request #4 from Cubone21/bonitoo_krcil_tasks
Cubone21 Sep 29, 2020
4661de0
Merge pull request #5 from Cubone21/bonitoo_krcil_telegraf
Cubone21 Sep 29, 2020
b04bca5
Merge pull request #6 from Cubone21/bonitoo_krcil_tokens
Cubone21 Sep 29, 2020
ba8e0f9
test: Sn tests missing in Cypress added (#7)
Sciator Sep 29, 2020
92c8adf
chore: runnign e2e locally
Sciator Oct 6, 2020
93dfcb7
refactor: removed unused reference
Sciator Oct 8, 2020
013c3bc
chore: circleci e2e
Sciator Oct 8, 2020
2c3e9e3
chore: circleci e2e
Sciator Oct 8, 2020
02c0296
Merge branch 'test-e2e-oss-testing' of https://github.com/bonitoo-io/…
Sciator Oct 8, 2020
3a00599
chore: circleci e2e
Sciator Oct 8, 2020
dc72331
Merge branch 'test-e2e-oss-testing' of https://github.com/bonitoo-io/…
Sciator Oct 8, 2020
0fec35d
fix: yarn.lock updated
Sciator Oct 8, 2020
626cb0a
chore: enable output for building influxdb
Sciator Oct 8, 2020
276cb4f
chore: enable output for building influxdb
Sciator Oct 8, 2020
f53e697
Merge branch 'test-e2e-oss-testing' of https://github.com/bonitoo-io/…
Sciator Oct 8, 2020
040159a
Merge branch 'test-e2e-oss-testing' of https://github.com/bonitoo-io/…
Sciator Oct 8, 2020
a65a61d
Merge branch 'test-e2e-oss-testing' of https://github.com/bonitoo-io/…
Sciator Oct 8, 2020
8f37522
Merge branch 'test-e2e-oss-testing' of https://github.com/bonitoo-io/…
Sciator Oct 8, 2020
a163bd0
Merge branch 'test-e2e-oss-testing' of https://github.com/bonitoo-io/…
Sciator Oct 8, 2020
41f3e01
chore: create symlink as fake ui build
Sciator Oct 9, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,35 @@
version: 2.1

commands:
init-app-dependencies:
steps:
- restore_cache:
name: Restore Yarn Package Cache
keys:
- yarn-packages-{{ checksum "yarn.lock" }}
- run:
name: Install Dependencies
command: |
yarn install --frozen-lockfile
- save_cache:
name: Save Yarn Package Cache
key: yarn-packages-{{ checksum "yarn.lock" }}
paths:
- ~/.cache/yarn
install_rust_compiler:
description: >
This will install the rust compiler with the rust tools.
steps:
- run:
name: Install clang
command: sudo apt-get update && sudo apt-get install -y --no-install-recommends clang musl-tools
- run:
name: Install rust compiler
command: |
curl https://sh.rustup.rs -sSf | \
sh -s -- --default-toolchain stable -y
echo 'source $HOME/.cargo/env' >> $BASH_ENV

jobs:
cloud-e2e:
machine:
Expand Down Expand Up @@ -105,6 +135,33 @@ jobs:
name: "Save Yarn Package Cache"
paths:
- ~/.cache/yarn
oss-e2e:
docker:
- image: circleci/golang:1.15-node-browsers
steps:
- checkout
- init-app-dependencies
- run: sudo apt-get update
- run: sudo apt-get install -y netcat-openbsd
- run: sudo apt-get install -y bzr
- install_rust_compiler
- run:
name: Build UI
command: |
yarn build
- run:
name: Clone and 'make' influxdb from master
command: |
yarn script db:get
- run:
name: Start influxdb
command: |
yarn script db:run
background: true
- run:
name: Run e2e tests
command: |
yarn test:e2e

workflows:
version: 2
Expand All @@ -115,3 +172,4 @@ workflows:
e2e:
jobs:
- cloud-e2e
- oss-e2e
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ build
coverage
node_modules
vendor
temp
cypress/screenshots
cypress/videos
junit-results

# files
cypress.env.json
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ From the ui directory. Build the javascript with
To run Cypress locally
`$ yarn cy:dev`

### Run against influxdb master
1. `yarn build`
1. `yarn script db:get` clone database with git and build it
1. `yarn script db:run` starts database (don't close terminal)
1. `yarn cy` with ui or `yarn test:e2e` only run tests

## Starting Dev Server

Running `/ui` locally depends on `monitor-ci`. [See the monitor-ci Quickstart](https://github.com/influxdata/monitor-ci#quickstart-for-local-development)
163 changes: 146 additions & 17 deletions cypress/e2e/buckets.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,31 @@ describe('Buckets', () => {
cy.getByTestID('inline-labels--empty').should('exist')
})

it('can create a bucket with retention', () => {
const newBucket = '🅱️ucket'
cy.getByTestID(`bucket-card ${newBucket}`).should('not.exist')

//create bucket with retention
cy.getByTestID('Create Bucket').click()
cy.getByTestID('overlay--container').within(() => {
cy.getByInputName('name').type(newBucket)
cy.getByTestID('retention-intervals--button').click()
cy.getByTestID('duration-selector--button').click()
cy.getByTestID('duration-selector--12h')
.click()
.then(() => {
cy.getByTestID('bucket-form-submit').click()
})
})

//assert bucket with retention
cy.getByTestID(`bucket-card ${newBucket}`)
.should('exist')
.within(() => {
cy.getByTestID('bucket-retention').should('contain', '12 hours')
})
})

it("can update a bucket's retention rules", () => {
cy.get<Bucket>('@bucket').then(({name}: Bucket) => {
cy.getByTestID(`bucket-settings`).click()
Expand Down Expand Up @@ -131,30 +156,42 @@ describe('Buckets', () => {
expect(testID).to.include(retentionAsc[index])
})
})

cy.getByTestID('search-widget').type('tasks')
cy.get('.cf-resource-card').should('have.length', 1)
})
})

// Currently producing a false negative
it.skip('can delete a bucket', () => {
const bucket1 = 'newbucket1'
cy.get<Organization>('@org').then(({id, name}: Organization) => {
cy.createBucket(id, name, bucket1)
})
it('can filter buckets', () => {
//assert buckets amount
cy.get('.cf-resource-card').should('have.length', 3)

cy.getByTestID(`context-delete-menu ${bucket1}`).click()
cy.getByTestID(`context-delete-bucket ${bucket1}`).click()
//filter a bucket
cy.getByTestID('search-widget').type('def')
cy.get('.cf-resource-card')
.should('have.length', 1)
.should('contain', 'defbuck')

// normally we would assert for empty state here
// but we cannot because of the default system buckets
// since cypress selectors are so fast, that sometimes a bucket
// that is deleted will be selected before it gets deleted
cy.wait(10000)
//clear filter and assert all buckets are visible
cy.getByTestID('search-widget').clear()
cy.get('.cf-resource-card').should('have.length', 3)
})
})

cy.getByTestID(`bucket--card--name ${bucket1}`).should('not.exist')
// Currently producing a false negative
it.skip('can delete a bucket', () => {
const bucket1 = 'newbucket1'
cy.get<Organization>('@org').then(({id, name}: Organization) => {
cy.createBucket(id, name, bucket1)
})

cy.getByTestID(`context-delete-menu ${bucket1}`).click()
cy.getByTestID(`context-delete-bucket ${bucket1}`).click()

// normally we would assert for empty state here
// but we cannot because of the default system buckets
// since cypress selectors are so fast, that sometimes a bucket
// that is deleted will be selected before it gets deleted
cy.wait(10000)

cy.getByTestID(`bucket--card--name ${bucket1}`).should('not.exist')
})

// skipping until feature flag feature is removed for deleteWithPredicate
Expand Down Expand Up @@ -394,5 +431,97 @@ describe('Buckets', () => {
// mymeasurement comes from fixtures/data.txt
cy.getByTestID('selector-list mymeasurement').should('exist')
})

it('create scraper', () => {
//click "add data" and choose Scrape Metrics
cy.getByTestID('add-data--button').click()
cy.get('.bucket-add-data--option')
.contains('Scrape Metrics')
.click()

//fill out name and assert default bucket
cy.getByTitle('Name')
.clear()
.type('Scraper from bucket')
cy.getByTestID('bucket-dropdown--button').should('contain', 'defbuck')
cy.getByTestID('create-scraper--submit').click()

//assert notification
cy.getByTestID('notification-success').should(
'contain',
'Scraper was created successfully'
)

//assert created scraper's parameters
cy.getByTestID('tabs--tab')
.contains('Scrapers')
.click()

cy.getByTestID('resource-card')
.first()
.within(() => {
cy.getByTestID('resource-editable-name').should(
'contain',
'Scraper from bucket'
)
cy.getByTestID('resource-list--meta').should('contain', 'defbuck')
})
})

it('configure telegraf agent', () => {
//click "add data" and choose Configure Telegraf Agent
cy.getByTestID('add-data--button').click()
cy.get('.bucket-add-data--option')
.contains('Configure Telegraf Agent')
.click()

//assert default bucket
cy.getByTestID('bucket-dropdown--button').should('contain', 'defbuck')

//filter plugins and choose system
cy.getByTestID('input-field')
.type('sys')
.then(() => {
cy.getByTestID('square-grid--card').should('have.length', 1)
cy.getByTestID('input-field')
.clear()
.then(() => {
cy.getByTestID('square-grid--card').should('have.length', 5)
})
})
cy.getByTestID('telegraf-plugins--System').click()
cy.getByTestID('next').click()

//add telegraf name and description
cy.getByTitle('Telegraf Configuration Name')
.clear()
.type('Telegraf from bucket')
cy.getByTitle('Telegraf Configuration Description')
.clear()
.type('This is a telegraf description')
cy.getByTestID('next').click()

//assert notifications
cy.getByTestID('notification-success').should(
'contain',
'Your configurations have been saved'
)
cy.getByTestID('notification-success').should(
'contain',
'Successfully created dashboards for telegraf plugin: system.'
)
cy.getByTestID('next').click()

//assert telegraf card parameters
cy.getByTestID('collector-card--name').should(
'contain',
'Telegraf from bucket'
)
cy.getByTestID('resource-list--editable-description').should(
'contain',
'This is a telegraf description'
)
cy.getByTestID('bucket-name').should('contain', 'defbuck')
})
})
})
Loading