Skip to content

Commit

Permalink
Replace route2 to intercept command in Cypress tests
Browse files Browse the repository at this point in the history
Signed-off-by: Rodolfo Martínez Vega <rodomar@outlook.com>
  • Loading branch information
ramrodo committed Jan 6, 2021
1 parent 32f39ac commit a9fee3a
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 13 deletions.
3 changes: 1 addition & 2 deletions provider-ui/cypress.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{
"baseUrl": "http://localhost:3001",
"experimentalNetworkStubbing": true
"baseUrl": "http://localhost:3001"
}
2 changes: 1 addition & 1 deletion provider-ui/cypress/integration/provider-ui_spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
describe('Provider UI', () => {
beforeEach(() => {
cy.route2('GET', '/api/providers', { fixture: 'providers.json' }).as('getProviders')
cy.intercept('GET', '/api/providers', { fixture: 'providers.json' }).as('getProviders')
cy.visit('/')
cy.wait('@getProviders')
})
Expand Down
3 changes: 1 addition & 2 deletions ui/cypress.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{
"baseUrl": "http://localhost:3000",
"experimentalNetworkStubbing": true
"baseUrl": "http://localhost:3000"
}
10 changes: 5 additions & 5 deletions ui/cypress/integration/e2e/userpreference_spec.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
describe('User Preferences', () => {
describe('Analytics and Improvement Program', () => {
beforeEach(() => {
cy.route2('GET', '/api/user/stats').as('getUserStats')
cy.intercept('GET', '/api/user/stats').as('getUserStats')

cy.selectProviderNone()

Expand All @@ -11,31 +11,31 @@ describe('User Preferences', () => {
})

it('deactivates "Send Anonymous Usage Statistics"', () => {
cy.route2('POST', '/api/user/stats').as('postUserStats')
cy.intercept('POST', '/api/user/stats').as('postUserStats')

cy.get('[data-cy="UsageStatsPreference"]').click()
cy.wait('@postUserStats')
cy.get('[data-cy="UsageStatsPreference"]').should('not.have.class', 'Mui-checked')
})

it('activates "Send Anonymous Usage Statistics"', () => {
cy.route2('POST', '/api/user/stats').as('postUserStats')
cy.intercept('POST', '/api/user/stats').as('postUserStats')

cy.get('[data-cy="UsageStatsPreference"]').click()
cy.wait('@postUserStats')
cy.get('[data-cy="UsageStatsPreference"]').should('have.class', 'Mui-checked')
})

it('deactivates "Send Anonymous Performance Results"', () => {
cy.route2('POST', '/api/user/stats').as('postUserStats')
cy.intercept('POST', '/api/user/stats').as('postUserStats')

cy.get('[data-cy="PerfResultPreference"]').click()
cy.wait('@postUserStats')
cy.get('[data-cy="PerfResultPreference"]').should('not.have.class', 'Mui-checked')
})

it('activates "Send Anonymous Performance Results"', () => {
cy.route2('POST', '/api/user/stats').as('postUserStats')
cy.intercept('POST', '/api/user/stats').as('postUserStats')

cy.get('[data-cy="PerfResultPreference"]').click()
cy.wait('@postUserStats')
Expand Down
6 changes: 3 additions & 3 deletions ui/cypress/integration/integration/userpreference_spec.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
describe('User Preferences', () => {
describe('Analytics and Improvement Program', () => {
beforeEach(() => {
cy.route2('GET', '/api/user/stats', { fixture: 'stats.json' }).as('getUserStats')
cy.intercept('GET', '/api/user/stats', { fixture: 'stats.json' }).as('getUserStats')

cy.visit('/user/preferences')
cy.get('.MuiFormLabel-root').should('have.text', 'Analytics and Improvement Program')
cy.wait('@getUserStats')
})

it('deactivates "Send Anonymous Usage Statistics"', () => {
cy.route2('POST', '/api/user/stats', { fixture: 'stats.json' }).as('postUserStats')
cy.intercept('POST', '/api/user/stats', { fixture: 'stats.json' }).as('postUserStats')

cy.get('[data-cy="UsageStatsPreference"]').click()
cy.wait('@postUserStats')
cy.get('[data-cy="UsageStatsPreference"]').should('not.have.class', 'Mui-checked')
})

it('deactivates "Send Anonymous Performance Results"', () => {
cy.route2('POST', '/api/user/stats', { fixture: 'stats.json' }).as('postUserStats')
cy.intercept('POST', '/api/user/stats', { fixture: 'stats.json' }).as('postUserStats')

cy.get('[data-cy="PerfResultPreference"]').click()
cy.wait('@postUserStats')
Expand Down

0 comments on commit a9fee3a

Please sign in to comment.