Skip to content

Commit

Permalink
[Cypress] Add User-Agent, tidy up dependencies (#946)
Browse files Browse the repository at this point in the history
* Update modules with security vulns, fix linting errors

* Tidying up tests - remove sql commands
  • Loading branch information
cshnimble authored Dec 1, 2023
1 parent 28a573e commit 87a20e4
Show file tree
Hide file tree
Showing 6 changed files with 276 additions and 591 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@ export default defineConfig({
},
baseUrl: 'http://s184d01-acacdnendpoint-ata0dwfremepeff8.z01.azurefd.net/'
},
userAgent: 'PrepareConversions/1.0 Cypress'
})
Original file line number Diff line number Diff line change
Expand Up @@ -16,41 +16,10 @@
/**
* @type {Cypress.PluginConfig}
*/
// eslint-disable-next-line no-unused-vars
const sqlServer = require('cypress-sql-server')

// eslint-disable-next-line no-unused-vars
module.exports = (on, config) => {
// `on` is used to hook into various events Cypress emits
// `config` is the resolved Cypress config
var dbConfig
try {
dbConfig = JSON.parse(process.env.db)
} catch (error) {
console.log(
`The db config is not set. Please set the 'db' environment variable in the following format e.g.
{ "userName": "username", "password": "password", "server": "server", "options": { "database": "database", "rowCollectionOnRequestCompletion" : true }}`)
throw error
}

const tasks = sqlServer.loadDBPlugin(dbConfig)
on('task', tasks)
}
// ***********************************************************

//***Cypress Grep module for filtering tests Any new tags should be added to the examples**
/**
* @example {{tags: '@dev'} : Development
* @example {tags: '@stage'} : Staging
* @example {tags: '@integration'} : Integration
* @example {tags: ['@dev', '@stage']}
*/
module.export = (on, config) => {

require('cypress-grep/src/plugin')(config)
}
// ***********************************************************

module.export = (on, config) => {
require('eslint/src/plugin')(config)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@
// -- This will overwrite an existing command --
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
import 'cypress-localstorage-commands'
import sqlServer from 'cypress-sql-server'
sqlServer.loadDBCommands()

//--Universal

Expand Down Expand Up @@ -84,13 +82,21 @@ Cypress.Commands.add('enterDate', (idSelector, day, month, year) => {
cy.get(`[id*="${idSelector}-month"]`).as('month')
cy.get(`[id*="${idSelector}-year"]`).as('year')

cy.get(`@day`).should('be.visible')
cy.get(`@day`).clear()
cy.get(`@day`).type(day)
cy.get(`@month`).clear()
cy.get(`@month`).type(month)
cy.get(`@year`).clear()
cy.get(`@year`).type(year)
cy.get(`@day`).then((dayLoc) => {
dayLoc.should('be.visible')
dayLoc.clear()
dayLoc.type(day)
})
cy.get(`@month`).then((monthLoc) => {
monthLoc.should('be.visible')
monthLoc.clear()
monthLoc.type(month)
})
cy.get(`@year`).then((yearLoc) => {
yearLoc.should('be.visible')
yearLoc.clear()
yearLoc.type(year)
})
})

// No Radio Btn
Expand Down Expand Up @@ -118,7 +124,6 @@ Cypress.Commands.add('saveContinue', () => {
})

Cypress.Commands.add("excuteAccessibilityTests", () => {
// FUNCTION COURTESY OF FAHAD DARWISH - NIMBLE APPROACH CONFLUENECE
const wcagStandards = ["wcag22aa", "wcag21aa"]
const impactLevel = ["critical", "minor", "moderate", "serious"]
const continueOnFail = false
Expand Down Expand Up @@ -164,4 +169,4 @@ Cypress.Commands.add('callAcademisationApi',
}

return cy.request(requestDefinition)
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@
// ***********************************************************

import './commands'
import registerCypressGrep from '@cypress/grep/src/support'

registerCypressGrep()

// ***********************************************************

beforeEach(() => {
cy.intercept(
Expand All @@ -23,10 +28,6 @@ beforeEach(() => {
(req) => req.headers['AuthorizationRole'] = 'conversions.create'
)
})
// ***********************************************************

//Cypress Grep module for filtering tests
require('cypress-grep')()

// ***********************************************************

Expand Down
Loading

0 comments on commit 87a20e4

Please sign in to comment.