Mirror: The highly customizable and versatile GraphQL client with which you add on features like normalized caching as you grow.

chore(workspace): stabilise reliability of e2e (#2748)

* stabilize reliability of e2e

* use delay

authored by

Jovi De Croock and committed by
GitHub
ebcde6e9 024524cf

+76 -3
+1 -1
.github/workflows/ci.yml
··· 50 50 - name: Unit Tests 51 51 run: yarn run test --maxWorkers=2 52 52 - name: Build 53 - run: yarn run build 53 + run: yarn workspace @urql/core build 54 54 - name: e2e tests 🧪 55 55 uses: cypress-io/github-action@v2 56 56 with:
+5
packages/react-urql/cypress/fixtures/example.json
··· 1 + { 2 + "name": "Using fixtures to represent data", 3 + "email": "hello@cypress.io", 4 + "body": "Fixtures are a great way to mock data for responses to routes" 5 + }
+7 -1
packages/react-urql/cypress/plugins/index.js
··· 1 1 // eslint-disable-next-line 2 2 const { startDevServer } = require('@cypress/vite-dev-server'); 3 + // eslint-disable-next-line 4 + const path = require('path'); 3 5 4 6 /** 5 7 * @type {Cypress.PluginConfig} 6 8 */ 7 9 module.exports = (on, _config) => { 8 - on('dev-server:start', options => startDevServer({ options })); 10 + on('dev-server:start', options => 11 + startDevServer({ 12 + options, 13 + }) 14 + ); 9 15 };
+25
packages/react-urql/cypress/support/commands.js
··· 1 + // *********************************************** 2 + // This example commands.js shows you how to 3 + // create various custom commands and overwrite 4 + // existing commands. 5 + // 6 + // For more comprehensive examples of custom 7 + // commands please read more here: 8 + // https://on.cypress.io/custom-commands 9 + // *********************************************** 10 + // 11 + // 12 + // -- This is a parent command -- 13 + // Cypress.Commands.add('login', (email, password) => { ... }) 14 + // 15 + // 16 + // -- This is a child command -- 17 + // Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... }) 18 + // 19 + // 20 + // -- This is a dual command -- 21 + // Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... }) 22 + // 23 + // 24 + // -- This will overwrite an existing command -- 25 + // Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
+20
packages/react-urql/cypress/support/index.js
··· 1 + // *********************************************************** 2 + // This example support/index.js is processed and 3 + // loaded automatically before your test files. 4 + // 5 + // This is a great place to put global configuration and 6 + // behavior that modifies Cypress. 7 + // 8 + // You can change the location of this file or turn off 9 + // automatically serving support files with the 10 + // 'supportFile' configuration option. 11 + // 12 + // You can read more here: 13 + // https://on.cypress.io/configuration 14 + // *********************************************************** 15 + 16 + // Import commands.js using ES2015 syntax: 17 + import './commands'; 18 + 19 + // Alternatively you can use CommonJS syntax: 20 + // require('./commands')
+18 -1
packages/react-urql/e2e-tests/useQuery.spec.tsx
··· 2 2 3 3 import * as React from 'react'; 4 4 import { mount } from '@cypress/react'; 5 - import { Provider, createClient, gql, useQuery } from '../src'; 5 + import { 6 + Provider, 7 + createClient, 8 + gql, 9 + useQuery, 10 + dedupExchange, 11 + cacheExchange, 12 + fetchExchange, 13 + Exchange, 14 + } from '../src'; 15 + import { delay, pipe } from 'wonka'; 16 + 17 + const delayExchange: Exchange = ({ forward }) => { 18 + return ops$ => { 19 + return pipe(ops$, forward, delay(250)); 20 + }; 21 + }; 6 22 7 23 const Boundary = props => { 8 24 return ( ··· 52 68 const client = createClient({ 53 69 url: 'https://trygql.formidable.dev/graphql/basic-pokedex', 54 70 suspense: true, 71 + exchanges: [dedupExchange, cacheExchange, delayExchange, fetchExchange], 55 72 }); 56 73 57 74 // eslint-disable-next-line