graphql-engine/console/cypress.config.ts
Daniele Cammareri 5f205a3f7d test: add snapshot check to action e2e test
## Description 🔖

This PR adds snapshot testing to e2e tests. The goal is to avoid regressions that involve metadata by checking:

- the payload of requests sent
- the metadata after modification (only relevant part of the metadata)

![image](https://user-images.githubusercontent.com/8408875/204244610-4486b689-d220-40ab-bc1d-9c7b1a1b232f.png)

We implemented this feature for one test, `actionWithTransform.e2e.test.ts` but this approach can be potentially used for other tests as well.

## Review checklist. 📋

- [ ] Run e2e tests

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7058
Co-authored-by: Varun Choudhary <68095256+Varun-Choudhary@users.noreply.github.com>
GitOrigin-RevId: 618147fad3f7d6849a0815b16c077efddef751ca
2022-12-02 10:03:39 +00:00

41 lines
1023 B
TypeScript

import { defineConfig } from 'cypress';
import * as customTasks from './cypress/support/tasks';
type ConfigOptions = Parameters<typeof defineConfig>[0];
interface MyConfigOptions extends ConfigOptions {
useRelativeSnapshots?: boolean;
}
const myDefineConfig = (config: MyConfigOptions) => defineConfig(config);
export default myDefineConfig({
env: {
TEST_MODE: 'parallel',
MIGRATE_URL: 'http://localhost:9693/apis/migrate',
},
viewportWidth: 1280,
viewportHeight: 720,
chromeWebSecurity: false,
video: false,
projectId: '5yiuic',
numTestsKeptInMemory: 10,
e2e: {
// We've imported your old cypress plugins here.
// You may want to clean this up later by importing these.
setupNodeEvents(on, config) {
on('task', {
...customTasks,
});
return config;
},
baseUrl: 'http://localhost:3000',
specPattern: [
'cypress/e2e/**/*test.{js,jsx,ts,tsx}',
'cypress/support/**/*unit.test.{js,ts}',
],
},
useRelativeSnapshots: true,
});