mirror of
https://github.com/SecurityBrewery/catalyst.git
synced 2025-12-16 12:12:45 +01:00
Setup cypress (#112)
This commit is contained in:
39
ui/cypress/fixtures/user_demo.json
Normal file
39
ui/cypress/fixtures/user_demo.json
Normal file
@@ -0,0 +1,39 @@
|
||||
{
|
||||
"apikey": false,
|
||||
"blocked": false,
|
||||
"id": "demo",
|
||||
"roles": [
|
||||
"admin:backup:read",
|
||||
"admin:backup:restore",
|
||||
"admin:dashboard:write",
|
||||
"admin:group:write",
|
||||
"admin:job:read",
|
||||
"admin:job:write",
|
||||
"admin:log:read",
|
||||
"admin:settings:write",
|
||||
"admin:ticket:delete",
|
||||
"admin:user:write",
|
||||
"admin:userdata:read",
|
||||
"admin:userdata:write",
|
||||
"analyst:automation:read",
|
||||
"analyst:currentsettings:write",
|
||||
"analyst:currentuser:read",
|
||||
"analyst:currentuserdata:read",
|
||||
"analyst:dashboard:read",
|
||||
"analyst:file",
|
||||
"analyst:group:read",
|
||||
"analyst:playbook:read",
|
||||
"analyst:rule:read",
|
||||
"analyst:settings:read",
|
||||
"analyst:template:read",
|
||||
"analyst:ticket:read",
|
||||
"analyst:ticket:write",
|
||||
"analyst:tickettype:read",
|
||||
"analyst:user:read",
|
||||
"engineer:automation:write",
|
||||
"engineer:playbook:write",
|
||||
"engineer:rule:write",
|
||||
"engineer:template:write",
|
||||
"engineer:tickettype:write"
|
||||
]
|
||||
}
|
||||
5
ui/cypress/fixtures/userdata_demo.json
Normal file
5
ui/cypress/fixtures/userdata_demo.json
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"email": "demo@example.org",
|
||||
"id": "demo",
|
||||
"name": "Demo"
|
||||
}
|
||||
32
ui/cypress/integration/catalyst.js
Normal file
32
ui/cypress/integration/catalyst.js
Normal file
@@ -0,0 +1,32 @@
|
||||
describe('user', () => {
|
||||
it('open ticket', () => {
|
||||
cy.visit('/');
|
||||
|
||||
// login
|
||||
cy.get("#username").type("bob");
|
||||
cy.get("#password").type("bob");
|
||||
cy.get("#kc-login").click();
|
||||
|
||||
cy.intercept('GET', '/api/userdata/demo', { fixture: 'userdata_demo.json' })
|
||||
cy.intercept('GET', '/api/users/demo', { fixture: 'user_demo.json' })
|
||||
|
||||
cy.origin('http://localhost', () => {
|
||||
cy.visit('/tickets');
|
||||
|
||||
// clear caql
|
||||
cy.get("#app > div > main > div > div > div > div > header > div > div.v-input.v-input--hide-details.v-input--is-label-active.v-input--is-dirty.v-input--dense.theme--light.v-text-field.v-text-field--single-line.v-text-field--solo.v-text-field--solo-flat.v-text-field--is-booted.v-text-field--enclosed.v-text-field--placeholder > div > div > div:nth-child(2) > div > button")
|
||||
.click();
|
||||
|
||||
// open ticket
|
||||
cy.get("#app > div > main > div > div > div > div > div > div.v-data-table__wrapper > table > tbody > tr:nth-child(1) > td > a")
|
||||
.click()
|
||||
|
||||
// assert url
|
||||
cy.url().should('eq', "http://localhost/tickets/8123")
|
||||
|
||||
// assert title
|
||||
cy.get("#\\38 123 > div > div > div:nth-child(3) > div:nth-child(2) > div:nth-child(2) > div > div.col-lg-8.col-12 > h1")
|
||||
.should("have.text", " Incident #8123: live zebra ")
|
||||
})
|
||||
})
|
||||
})
|
||||
20
ui/cypress/support/commands.js
Normal file
20
ui/cypress/support/commands.js
Normal file
@@ -0,0 +1,20 @@
|
||||
// ***********************************************
|
||||
// custom commands
|
||||
// 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 will overwrite an existing command --
|
||||
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
|
||||
6
ui/cypress/support/index.js
Normal file
6
ui/cypress/support/index.js
Normal file
@@ -0,0 +1,6 @@
|
||||
// ***********************************************************
|
||||
// global configuration
|
||||
// https://on.cypress.io/configuration
|
||||
// ***********************************************************
|
||||
|
||||
import './commands'
|
||||
Reference in New Issue
Block a user