PromucFlow_constructor/app/client/cypress_ci_custom.config.ts
sharanya-appsmith a1fb4ba197
test: Cypress - Added cypress grep library (#29259)
Leveraging the library

[cypress-grep](https://github.com/cypress-io/cypress/tree/develop/npm/grep).
Using this we can tag testcases with relevant tags and use it to run
specific testcases.

**Command to run in local:** 
`CYPRESS_grepTags=@tag.Binding,@tag.Git npx cypress run
`
Pass the tags to CYPRESS_grepTags argument and only the test cases which
has the
tags passed will be picked to run. ex `@tag.Binding and @tag.Git` are
the tag names here.

**Tags can be added in the description on the test case like** 
`{ tags: ["@tag.Datasource"] }` for a single tag
`{ tags: ["@tag.Datasource", "@tag.Git"] }` for multiple tags 

**How to run In CI**
Single Tag - `/ok-to-test tags=@tag.Binding`
Multiple tag - `/ok-to-test tags=@tag.Binding,@tag.Git`


**TODOs in the next release:** 
- [ ] Add tags.ts file with all needed tags
- [ ] Add tags to remaining spec files. 
- [ ] Fail the PR run if tags added are not from tag.ts and post the
message on the same

#### Type of change
- Chore (housekeeping or task changes that don't impact user perception)
- This change requires a documentation update

#### How Has This Been Tested?
- [x] Manual
- [ ] JUnit
- [ ] Jest
- [x] Cypress

## Checklist:
#### Dev activity
- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [x] I have added tests that prove my fix is effective or that my
feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] PR is being merged under a feature flag


#### QA activity:
- [x] [Speedbreak
features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-)
have been covered
- [ ] Test plan covers all impacted features and [areas of
interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-)
- [ ] Test plan has been peer reviewed by project stakeholders and other
QA members
- [ ] Manually tested functionality on DP
- [ ] We had an implementation alignment call with stakeholders post QA
Round 2
- [ ] Cypress test cases have been added and approved by SDET/manual QA
- [x] Added `Test Plan Approved` label after Cypress tests were reviewed
- [ ] Added `Test Plan Approved` label after JUnit tests were reviewed


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **New Features**
  - Added a search functionality to the app.

- **Enhancements**
- Integrated search bar at the top of the `Hero` component and a
`Search` component to the `App` component.
  - Added styles for the search bar.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Arpit Mohan <arpit@appsmith.com>
2023-12-07 18:23:27 +05:30

71 lines
2.2 KiB
TypeScript

import { defineConfig } from "cypress";
import fs from "fs";
export default defineConfig({
defaultCommandTimeout: 30000,
requestTimeout: 60000,
responseTimeout: 60000,
pageLoadTimeout: 60000,
video: true,
numTestsKeptInMemory: 5,
experimentalMemoryManagement: true,
reporter: "cypress-mochawesome-reporter",
reporterOptions: {
reportDir: "results",
charts: true,
reportPageTitle: "Cypress-report",
videoOnFailOnly: true,
embeddedScreenshots: true,
inlineAssets: true,
saveAllAttempts: true,
},
chromeWebSecurity: false,
viewportHeight: 1200,
viewportWidth: 1400,
scrollBehavior: "center",
retries: {
runMode: 1,
openMode: 0,
},
e2e: {
baseUrl: "http://localhost/",
env: {
grepFilterSpecs: true,
grepOmitFiltered: true,
},
setupNodeEvents(on, config) {
require("cypress-mochawesome-reporter/plugin")(on);
on(
"after:spec",
(spec: Cypress.Spec, results: CypressCommandLine.RunResult) => {
if (results && results.video) {
// Do we have failures for any retry attempts?
const failures = results.tests.some((test) =>
test.attempts.some((attempt) => attempt.state === "failed"),
);
if (!failures) {
// delete the video if the spec passed and no tests retried
fs.unlinkSync(results.video);
}
}
},
);
require("@cypress/grep/src/plugin")(config);
return require("./cypress/plugins/index.js")(on, config);
},
specPattern: "cypress/e2e/**/*.{js,ts}",
testIsolation: false,
excludeSpecPattern: [
"cypress/e2e/**/spec_utility.ts",
"cypress/e2e/Regression/ClientSide/CommunityTemplate/*",
"cypress/e2e/GSheet/**/**/*",
"cypress/e2e/Sanity/Datasources/Airtable_Basic_Spec.ts",
"cypress/e2e/EE/Enterprise/MultipleEnv/ME_airtable_spec.ts",
"cypress/e2e/Regression/ServerSide/Datasources/ElasticSearch_Basic_Spec.ts",
"cypress/e2e/Regression/ServerSide/Datasources/Oracle_Spec.ts",
"cypress/e2e/Regression/ClientSide/Widgets/Others/MapWidget_Spec.ts",
"cypress/e2e/Sanity/Datasources/MsSQL_Basic_Spec.ts",
],
},
});