-
-
Notifications
You must be signed in to change notification settings - Fork 267
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
411 additions
and
538 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,7 +1,7 @@ | ||
version: 2.1 | ||
|
||
orbs: | ||
cypress: cypress-io/cypress@1.29.0 | ||
cypress: cypress-io/cypress@3 | ||
|
||
executors: | ||
default: | ||
|
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 was deleted.
Oops, something went wrong.
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,32 @@ | ||
import { defineConfig } from 'cypress'; | ||
import cypressCodeCoverage from '@cypress/code-coverage/task'; | ||
import cypressCodeUseBabelrc from '@cypress/code-coverage/use-babelrc'; | ||
|
||
export default defineConfig({ | ||
projectId: 'dbquo6', | ||
viewportWidth: 1600, | ||
viewportHeight: 1200, | ||
requestTimeout: 10000, | ||
env: { | ||
RETRIES: 2, | ||
codeCoverage: { | ||
url: '/api/__coverage__', | ||
}, | ||
}, | ||
retries: { | ||
runMode: 2, | ||
openMode: 2, | ||
}, | ||
e2e: { | ||
setupNodeEvents(on, config) { | ||
if (!!process.env.CI) { | ||
cypressCodeCoverage(on, config); | ||
on('file:preprocessor', cypressCodeUseBabelrc); | ||
} | ||
|
||
return config; | ||
}, | ||
baseUrl: 'http://localhost:3000', | ||
specPattern: './**/*.spec.cy.ts', | ||
}, | ||
}); |
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
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,60 @@ | ||
/// <reference types="cypress" /> | ||
import '@testing-library/cypress/add-commands'; | ||
import existingUser from '../../test-utils/mocks/existingUser'; | ||
import { apiUrl } from '../../common/config/environment'; | ||
|
||
Cypress.Commands.add('visitAndWaitFor', path => { | ||
cy.visit(path); | ||
cy.findByTestId('Desktop Nav').should('exist').and('be.visible'); | ||
cy.url().should('contain', path); | ||
}); | ||
|
||
// Use `cy.login()` to quickly login for testing authenticated routes | ||
Cypress.Commands.add('login', () => { | ||
cy.request({ | ||
method: 'POST', | ||
url: `${apiUrl}/auth/login/`, | ||
body: { | ||
...existingUser, | ||
}, | ||
}).then(({ body: { token } }) => { | ||
cy.setCookie('token', token); | ||
}); | ||
}); | ||
|
||
Cypress.Commands.add('checkCustomDataAttribute', (attribute, value) => { | ||
const attributeWithoutBrackets = attribute.replace(/[[\]]/g, ''); | ||
|
||
cy.get(attribute).invoke('attr', attributeWithoutBrackets).should('contain', value); | ||
}); | ||
|
||
Cypress.Commands.add('findSelectByLabelText', (label, options = {}) => { | ||
cy.findByText(label) | ||
.invoke('attr', 'for') | ||
.then(name => { | ||
if (options.edit) { | ||
cy.get(`input#react-select-${name}-input`); | ||
} else { | ||
cy.get(`input[name="${name}"]`); | ||
} | ||
}); | ||
}); | ||
|
||
/* eslint-disable @typescript-eslint/no-namespace */ | ||
declare global { | ||
namespace Cypress { | ||
interface Chainable { | ||
/** Visit a page safely by validating the URL only after a layout-specific test ID has been found. */ | ||
visitAndWaitFor(path: string): void; | ||
|
||
/** Login with a predefined user */ | ||
login(): void; | ||
|
||
/** Check a custom data attribute */ | ||
checkCustomDataAttribute(attribute: string, value: string): void; | ||
|
||
/** Find a select input by its label */ | ||
findSelectByLabelText(label: string, options?: { edit?: boolean }): void; | ||
} | ||
} | ||
} |
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 was deleted.
Oops, something went wrong.
Oops, something went wrong.