diff --git a/packages/components/src/Loader/Loader.tsx b/packages/components/src/Loader/Loader.tsx index 623589abc2..0aeeb8a979 100644 --- a/packages/components/src/Loader/Loader.tsx +++ b/packages/components/src/Loader/Loader.tsx @@ -31,6 +31,7 @@ export const Loader = ({ label }: Props) => { {logo && ( diff --git a/packages/cypress/scripts/start.ts b/packages/cypress/scripts/start.ts index d746aa7bce..1edfe39659 100644 --- a/packages/cypress/scripts/start.ts +++ b/packages/cypress/scripts/start.ts @@ -1,6 +1,7 @@ #!/usr/bin/env ts-node import { spawn, spawnSync } from 'child_process' +import { generateAlphaNumeric } from '../src/utils/TestUtils' import PATHS from './paths' const e2eEnv = require('dotenv').config() @@ -53,7 +54,7 @@ function runTests() { const CYPRESS_ENV = `DUMMY_VAR=1` // use workflow ID so that jobs running in parallel can be assigned to same cypress build // cypress will use this to split tests between parallel runs - const buildId = e.CIRCLE_WORKFLOW_ID || randomString(8) + const buildId = e.CIRCLE_WORKFLOW_ID || generateAlphaNumeric(8) // main testing command, depending on whether running on ci machine or interactive local // call with path to bin as to ensure locally installed used @@ -134,14 +135,3 @@ async function startAppServer() { const timeout = 5 * 60 * 1000 await waitOn({ resources: ['http-get://127.0.0.1:3456'], timeout }) } - -function randomString(length) { - let result = '' - const characters = - 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789' - const charactersLength = characters.length - for (let i = 0; i < length; i++) { - result += characters.charAt(Math.floor(Math.random() * charactersLength)) - } - return result -} diff --git a/packages/cypress/src/integration/howto/write.spec.ts b/packages/cypress/src/integration/howto/write.spec.ts index 2aaf53df79..aa2c86bf64 100644 --- a/packages/cypress/src/integration/howto/write.spec.ts +++ b/packages/cypress/src/integration/howto/write.spec.ts @@ -198,6 +198,7 @@ describe('[How To]', () => { const categoryGuidanceFiles = guidance.moulds.files cy.login(creatorEmail, creatorPassword) + cy.get('[data-cy=loader]').should('not.exist') cy.step('Access the create-how-to') cy.get('[data-cy=create]').click() cy.contains('Create a How-To').should('exist') @@ -326,6 +327,7 @@ describe('[How To]', () => { cy.on('window:confirm', stub) cy.login(creatorEmail, creatorPassword) + cy.get('[data-cy=loader]').should('not.exist') cy.step('Access the create-how-to') cy.get('[data-cy=create]').click() cy.get('[data-cy=intro-title]') diff --git a/packages/cypress/src/integration/questions/write.spec.ts b/packages/cypress/src/integration/questions/write.spec.ts index ea2955a338..464607b1a2 100644 --- a/packages/cypress/src/integration/questions/write.spec.ts +++ b/packages/cypress/src/integration/questions/write.spec.ts @@ -23,6 +23,7 @@ describe('[Question]', () => { cy.login(creatorEmail, creatorPassword) cy.step('Go to create page') + cy.get('[data-cy=loader]').should('not.exist') cy.get('[data-cy=create]').click() cy.get('[data-cy=question-create-title]') diff --git a/packages/cypress/src/integration/research/write.spec.ts b/packages/cypress/src/integration/research/write.spec.ts index b91e712877..7a7ec522ef 100644 --- a/packages/cypress/src/integration/research/write.spec.ts +++ b/packages/cypress/src/integration/research/write.spec.ts @@ -27,6 +27,7 @@ describe('[Research]', () => { it('[By Authenticated]', () => { cy.login(researcherEmail, researcherPassword) cy.step('Create the research article') + cy.get('[data-cy=loader]').should('not.exist') cy.get('[data-cy=create]').click() cy.step('Warn if title is identical to an existing one') cy.get('[data-cy=intro-title]').type('qwerty').blur({ force: true }) @@ -108,6 +109,7 @@ describe('[Research]', () => { cy.login(researcherEmail, researcherPassword) cy.step('Access the create research article') + cy.get('[data-cy=loader]').should('not.exist') cy.get('[data-cy=create]').click() cy.get('[data-cy=intro-title') .clear() diff --git a/shared/mocks/data/index.ts b/shared/mocks/data/index.ts index 702f926b3c..e3bfa2da09 100644 --- a/shared/mocks/data/index.ts +++ b/shared/mocks/data/index.ts @@ -7,3 +7,4 @@ export { questions } from './questions' export { research } from './research' export { tags } from './tags' export { users } from './users' +export { messages } from './messages' diff --git a/shared/mocks/data/messages.ts b/shared/mocks/data/messages.ts new file mode 100644 index 0000000000..3ad46123ca --- /dev/null +++ b/shared/mocks/data/messages.ts @@ -0,0 +1,10 @@ +export const messages = { + '36hWyk3OckrLSH1ehdIE': { + _modified: '2012-10-27T01:47:57.948Z', + _id: '36hWyk3OckrLSH1ehdIE', + email: 'demo_user@example.com', + name: 'Bob', + text: 'Message test', + toUserName: 'settings_machine_new', + }, +}