PromucFlow_constructor/app/client/cypress/support/Objects/DataManager.ts
Shrikant Sharat Kandula cd22fc1087
test: Some cleanup for Git Cypress tests (#32836)
1. Change usage of ports bound to 3000, 5000 and 8000 to 4200, which
will be the canonical port for TED in the future.
2. Switch to using TED's native git repo management APIs, instead of the
Gitea compatibility layer.
3. Remove code from GitHub ages.


/ok-to-test tags="@tag.Sanity, @tag.Git"<!-- This is an auto-generated
comment: Cypress test results -->
> [!TIP]
> 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/8785291879>
> Commit: b38f4eb388716f7fcfc2a032d788c2ebb951568b
> Cypress dashboard url: <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=8785291879&attempt=2"
target="_blank">Click here!</a>

<!-- end of auto-generated comment: Cypress test results  -->





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

## Summary by CodeRabbit

- **Refactor**
- Enhanced Git integration by shifting from GitHub to Gitea for
repository operations in test environments.
- Updated URLs and endpoints across various test scripts and data
fixtures to align with new configurations.
- **Tests**
- Modified test scenarios to reflect changes in Git operations and URL
configurations.
- **Chores**
- Updated CI workflows by replacing old secrets with new ones for better
configuration management.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-04-23 10:01:14 +05:30

254 lines
8.9 KiB
TypeScript

export class DataManager {
environments = ["Production", "Staging"];
defaultEnviorment = this.environments[0];
GIT_API_BASE = "localhost:4200";
GIT_CLONE_URL = "git@host.docker.internal:Cypress";
dsValues: Record<string, any> = {
Production: {
mongo_authenticationAuthtype: "SCRAM-SHA-1",
mongo_host: "host.docker.internal",
mongo_port: 28017,
mongo_databaseName: "mongo_prod",
postgres_host: "host.docker.internal",
postgres_port: 5432,
postgres_databaseName: "fakeapi",
postgres_username: "docker",
postgres_password: "docker",
mysql_host: "host.docker.internal",
mysql_port: 3306,
mysql_databaseName: "fakeapi",
mysql_username: "root",
mysql_password: "root",
mssql_host: "host.docker.internal",
mssql_port: 1433,
mssql_databaseName: "fakeapi",
mssql_username: "SA",
mssql_password: "Root@123",
arango_host: "host.docker.internal",
arango_port: 8529,
arango_databaseName: "_system",
arango_username: "root",
arango_password: "Arango",
elastic_host: "http://host.docker.internal",
elastic_port: 9200,
elastic_username: "elastic",
elastic_password: "docker",
redshift_host: "localhost",
redshift_port: 543,
redshift_databaseName: "fakeapi",
redshift_username: "root",
redshift_password: "Redshift$123",
smtp_host: "host.docker.internal",
smtp_port: "25",
smtp_username: "root",
smtp_password: "root",
oracle_host: Cypress.env("ORACLE_HOST"),
oracle_port: 1521,
oracle_service: Cypress.env("ORACLE_SERVICE"),
oracle_username: Cypress.env("ORACLE_USERNAME"),
oracle_password: Cypress.env("ORACLE_PASSWORD"),
redis_host: "host.docker.internal",
redis_port: "6379",
OAuth_Username: "testuser@appsmith.com",
OAuth_Host: "http://localhost:6001",
OAuth_ApiUrl: "http://host.docker.internal:6001",
OAUth_AccessTokenUrl: "http://host.docker.internal:6001/oauth/token",
OAuth_AuthUrl: "http://localhost:6001/oauth/authorize",
OAuth_RedirectUrl: "http://localhost/api/v1/datasources/authorize",
AirtableBase: "appubHrVbovcudwN6",
AirtableTable: "tblsFCQSskVFf7xNd",
mockApiUrl: "http://host.docker.internal:5001/v1/mock-api?records=10",
mockGenderAge:
"http://host.docker.internal:5001/v1/genderize_agify?name=",
mockGzipApi: "http://host.docker.internal:5001/v1/gzip",
mockApiObjectUrl:
"http://host.docker.internal:5001/v1/mock-api-object?records=10",
echoApiUrl: "http://host.docker.internal:5001/v1/mock-api/echo",
randomCatfactUrl: "http://host.docker.internal:5001/v1/catfact/random",
randomTrumpApi:
"http://host.docker.internal:5001/v1/whatdoestrumpthink/random",
mockHttpCodeUrl: "http://host.docker.internal:5001/v1/mock-http-codes/",
flowerImageUrl1:
"http://host.docker.internal:4200/photo-1503469432756-4aae2e18d881.jpeg",
flowerImageUrl2:
"http://host.docker.internal:4200/photo-1492529029602-33e53698f407.jpeg",
AirtableBaseForME: "appubHrVbovcudwN6",
AirtableTableForME: "tblsFCQSskVFf7xNd",
ApiUrlME: "http://host.docker.internal:5001/v1/production",
firestore_database_url: "https://appsmith-22e8b.firebaseio.com",
firestore_projectID: "appsmith-22e8b",
firestore_serviceaccountkey: Cypress.env("FIRESTORE_PRIVATE_KEY"),
restapi_url: "https://my-json-server.typicode.com/typicode/demo/posts",
connection_type: "Replica set",
mockHostAddress: "fake_api.cvuydmurdlas.us-east-1.rds.amazonaws.com",
mockDatabaseName: "fakeapi",
mockDatabaseUsername: "fakeapi",
mockDatabasePassword: "LimitedAccess123#",
readonly: "readonly",
authenticatedApiUrl: "https://fakeapi.com",
GraphqlApiUrl_TED: "http://host.docker.internal:4200/graphql",
twilio_username: "random-username",
twilio_password: "random-password",
},
Staging: {
mongo_authenticationAuthtype: "SCRAM-SHA-1",
mongo_host: "host.docker.internal",
mongo_port: 28017,
mongo_databaseName: "mongo_staging",
postgres_host: "host.docker.internal",
postgres_port: 5432,
postgres_databaseName: "stagingdb",
postgres_username: "dockerstaging",
postgres_password: "dockerstaging",
mysql_host: "host.docker.internal",
mysql_port: 3306,
mysql_databaseName: "fakeapi",
mysql_username: "root",
mysql_password: "root",
mssql_host: "host.docker.internal",
mssql_port: 1433,
mssql_databaseName: "fakeapi",
mssql_username: "SA",
mssql_password: "Root@123",
arango_host: "host.docker.internal",
arango_port: 8529,
arango_databaseName: "_system",
arango_username: "root",
arango_password: "Arango",
elastic_host: "http://host.docker.internal",
elastic_port: 9200,
elastic_username: "elastic",
elastic_password: "docker",
redshift_host: "localhost",
redshift_port: 543,
redshift_databaseName: "fakeapi",
redshift_username: "root",
redshift_password: "Redshift$123",
smtp_host: "host.docker.internal",
smtp_port: "25",
smtp_username: "root",
smtp_password: "root",
oracle_host: "random-data",
oracle_port: 40,
oracle_service: "random-name",
oracle_username: "random-username",
oracle_password: "random-password",
redis_host: "host.docker.internal",
redis_port: "6379",
OAuth_Username: "testuser@appsmith.com",
OAuth_Host: "http://localhost:6001",
OAuth_ApiUrl: "http://host.docker.internal:6001",
OAUth_AccessTokenUrl: "http://host.docker.internal:6001/oauth/token",
OAuth_AuthUrl: "http://localhost:6001/oauth/authorize",
OAuth_RedirectUrl: "http://localhost/api/v1/datasources/authorize",
AirtableBase: "appubHrVbovcudwN6",
AirtableTable: "tblsFCQSskVFf7xNd",
mockApiUrl: "http://host.docker.internal:5001/v1/mock-api?records=10",
echoApiUrl: "http://host.docker.internal:5001/v1/mock-api/echo",
randomCatfactUrl: "http://host.docker.internal:5001/v1/catfact/random",
mockHttpCodeUrl: "http://host.docker.internal:5001/v1/mock-http-codes/",
AirtableBaseForME: "appubHrVbovcudwN6",
AirtableTableForME: "tblsFCQSskVFf7xNd",
ApiUrlME: "http://host.docker.internal:5001/v1/staging",
firestore_database_url: "https://staging-sample.firebaseio.com",
firestore_projectID: "appsmith-dummy",
firestore_serviceaccountkey: "dummy_service_creds_key",
restapi_url: "https://my-json-server.typicode.com/typicode/demo/posts",
connection_type: "Replica set",
mockHostAddress: "fake_api.cvuydmurdlas.us-east-1.rds.amazonaws.com",
mockDatabaseName: "fakeapi",
mockDatabaseUsername: "fakeapi",
mockDatabasePassword: "LimitedAccess123#",
readonly: "readonly",
authenticatedApiUrl: "https://fakeapi.com",
GraphqlApiUrl_TED: "http://host.docker.internal:4200/graphql",
twilio_username: "random-username",
twilio_password: "random-password",
},
};
paginationUrl = (records = 20, page = 4, size = 3) => {
return `http://host.docker.internal:5001/v1/mock-api?records=${records}&page=${page}&size=${size}`;
};
mongo_uri = (environment = this.defaultEnviorment) => {
return `mongodb://${this.dsValues[environment].mongo_host}:${this.dsValues[environment].mongo_port}/${this.dsValues[environment].mongo_databaseName}`;
};
mssql_docker = (
containerName: string,
environment = this.defaultEnviorment,
) => {
return `docker run --name=${containerName} -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=${
this.dsValues[environment].mssql_password
}" -p ${this.dsValues[environment].mssql_port.toString()}:${this.dsValues[
environment
].mssql_port.toString()} -d mcr.microsoft.com/azure-sql-edge`;
};
arango_docker = (
containerName: string,
environment = this.defaultEnviorment,
) => {
return `docker run --name ${containerName} -e ARANGO_USERNAME=${
this.dsValues[environment].arango_username
} -e ARANGO_ROOT_PASSWORD=${
this.dsValues[environment].arango_password
} -p ${this.dsValues[environment].arango_port.toString()}:${this.dsValues[
environment
].arango_port.toString()} -d arangodb`;
};
elastic_docker = (
containerName: string,
environment = this.defaultEnviorment,
) => {
return `docker run --name ${containerName} -d -p ${this.dsValues[
environment
].elastic_port.toString()}:${this.dsValues[
environment
].elastic_port.toString()} -e "discovery.type=single-node" -e "ELASTIC_USERNAME=${
this.dsValues[environment].elastic_username
}" -e "ELASTIC_PASSWORD=${
this.dsValues[environment].elastic_password
}" -e "xpack.security.enabled=true" docker.elastic.co/elasticsearch/elasticsearch:7.16.2`;
};
}