test: Cypress migration to TED GITEA (#18799)
## Description - This PR includes tests for migrating to Local GITEA for running cypress tests so we dont run into timeout issues in Git tests ## Type of change - New Script + Script fixes ## How Has This Been Tested? - Cypress on CI ## Checklist: ### QA activity: - [X] Test plan has been approved by relevant developers - [X] Test plan has been peer reviewed by QA - [X] Cypress test cases have been added and approved by either SDET or manual QA - [X] Organized project review call with relevant stakeholders after Round 1/2 of QA - [X] Added Test Plan Approved label after reveiwing all Cypress test
This commit is contained in:
parent
b9bc9eaf7d
commit
970e4b16a4
1
app/client/cypress/fixtures/DeleteGitRepos.json
Normal file
1
app/client/cypress/fixtures/DeleteGitRepos.json
Normal file
File diff suppressed because one or more lines are too long
|
|
@ -50,6 +50,7 @@
|
|||
"readonly":"readonly",
|
||||
"authenticatedApiUrl": "https://fakeapi.com",
|
||||
"graphqlApiUrl": "https://spacex-production.up.railway.app",
|
||||
"GITHUB_API_BASE_TED" : "localhost",
|
||||
"GITHUB_API_PORT_TED": "5001"
|
||||
"GITEA_API_BASE_TED" : "localhost",
|
||||
"GITEA_API_PORT_TED": "3000",
|
||||
"GITEA_API_URL_TED": "git@host.docker.internal:Cypress"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,8 +5,11 @@ let repoName: any;
|
|||
describe("Git Bugs", function() {
|
||||
before(() => {
|
||||
_.homePage.NavigateToHome();
|
||||
_.homePage.CreateNewWorkspace("GitBugs1 workspace");
|
||||
_.homePage.CreateAppInWorkspace("GitBugs1 workspace");
|
||||
_.agHelper.GenerateUUID();
|
||||
cy.get("@guid").then((uid) => {
|
||||
_.homePage.CreateNewWorkspace("GitBugs" + uid);
|
||||
_.homePage.CreateAppInWorkspace("GitBugs" + uid);
|
||||
});
|
||||
});
|
||||
|
||||
it("1. Bug 16248, When GitSync modal is open, block shortcut action execution", function() {
|
||||
|
|
@ -58,6 +61,16 @@ describe("Git Bugs", function() {
|
|||
_.agHelper.ValidateURL("testQP=Yes"); //Validate we also ve the Query Params from Page1
|
||||
});
|
||||
|
||||
// it.only("4. Import application json and validate headers", () => {
|
||||
// _.homePage.NavigateToHome();
|
||||
// _.homePage.ImportApp("DeleteGitRepos.json");
|
||||
// _.deployMode.DeployApp();
|
||||
// _.agHelper.Sleep(2000);
|
||||
// for (let i = 0; i < 100; i++) {
|
||||
// _.agHelper.ClickButton("Delete");
|
||||
// }
|
||||
// });
|
||||
|
||||
after(() => {
|
||||
_.gitSync.DeleteTestGithubRepo(repoName);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import gitSyncLocators from "../../../../../locators/gitSyncLocators";
|
||||
import homePage from "../../../../../locators/HomePage";
|
||||
import * as _ from "../../../../../support/Objects/ObjectsCore";
|
||||
import datasourceFormData from "../../../../../fixtures/datasources.json";
|
||||
|
||||
const httpsRepoURL = "https://github.com/test/test.git";
|
||||
const invalidURL = "test";
|
||||
|
|
@ -10,7 +11,6 @@ const invalidEmail = "test";
|
|||
const invalidEmailWithAmp = "test@hello";
|
||||
|
||||
const GITHUB_API_BASE = "https://api.github.com";
|
||||
const GITEA_API_BASE = "http://35.154.225.218";
|
||||
|
||||
let repoName;
|
||||
let generatedKey;
|
||||
|
|
@ -61,7 +61,7 @@ describe("Git sync modal: connect tab", function() {
|
|||
cy.get(gitSyncLocators.generateDeployKeyBtn).should("not.exist");
|
||||
|
||||
cy.get(gitSyncLocators.gitRepoInput).type(
|
||||
`{selectAll}git@35.154.225.218:CI-Gitea/${repoName}.git`,
|
||||
`{selectAll}${datasourceFormData["GITEA_API_URL_TED"]}/${repoName}.git`,
|
||||
);
|
||||
cy.contains(Cypress.env("MESSAGES").PASTE_SSH_URL_INFO()).should(
|
||||
"not.exist",
|
||||
|
|
@ -129,7 +129,7 @@ describe("Git sync modal: connect tab", function() {
|
|||
cy.get(gitSyncLocators.connectSubmitBtn).should("be.disabled");
|
||||
|
||||
cy.get(gitSyncLocators.gitRepoInput).type(
|
||||
`{selectAll}git@35.154.225.218:CI-Gitea/${repoName}.git`,
|
||||
`{selectAll}${datasourceFormData["GITEA_API_URL_TED"]}/${repoName}.git`,
|
||||
);
|
||||
cy.contains(Cypress.env("MESSAGES").PASTE_SSH_URL_INFO()).should(
|
||||
"not.exist",
|
||||
|
|
@ -225,9 +225,12 @@ describe("Git sync modal: connect tab", function() {
|
|||
|
||||
cy.get(gitSyncLocators.gitRepoInput)
|
||||
.scrollIntoView()
|
||||
.type(`{selectAll}git@35.154.225.218:CI-Gitea/${repoName}.git`, {
|
||||
force: true,
|
||||
});
|
||||
.type(
|
||||
`{selectAll}${datasourceFormData["GITEA_API_URL_TED"]}/${repoName}.git`,
|
||||
{
|
||||
force: true,
|
||||
},
|
||||
);
|
||||
cy.get(gitSyncLocators.connectSubmitBtn)
|
||||
.scrollIntoView()
|
||||
.click();
|
||||
|
|
@ -240,9 +243,12 @@ describe("Git sync modal: connect tab", function() {
|
|||
|
||||
cy.get(gitSyncLocators.gitRepoInput)
|
||||
.scrollIntoView()
|
||||
.type(`{selectAll}git@35.154.225.218:CI-Gitea/${repoName}.git`, {
|
||||
force: true,
|
||||
});
|
||||
.type(
|
||||
`{selectAll}${datasourceFormData["GITEA_API_URL_TED"]}/${repoName}.git`,
|
||||
{
|
||||
force: true,
|
||||
},
|
||||
);
|
||||
|
||||
// cy.request({
|
||||
// method: "POST",
|
||||
|
|
@ -261,7 +267,7 @@ describe("Git sync modal: connect tab", function() {
|
|||
|
||||
cy.request({
|
||||
method: "POST",
|
||||
url: `${GITEA_API_BASE}:3000/api/v1/repos/CI-Gitea/${repoName}/keys`,
|
||||
url: `${datasourceFormData["GITEA_API_BASE_TED"]}:${datasourceFormData["GITEA_API_PORT_TED"]}/api/v1/repos/Cypress/${repoName}/keys`,
|
||||
headers: {
|
||||
Authorization: `token ${Cypress.env("GITEA_TOKEN")}`,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -5,11 +5,14 @@ const apiwidget = require("../../../../../locators/apiWidgetslocator.json");
|
|||
const pages = require("../../../../../locators/Pages.json");
|
||||
import homePage from "../../../../../locators/HomePage";
|
||||
import * as _ from "../../../../../support/Objects/ObjectsCore";
|
||||
import datasourceFormData from "../../../../../fixtures/datasources.json";
|
||||
|
||||
const pagename = "ChildPage";
|
||||
const tempBranch = "feat/tempBranch";
|
||||
const tempBranch0 = "tempBranch0";
|
||||
const mainBranch = "master";
|
||||
const jsObject = "JSObject1";
|
||||
|
||||
let repoName;
|
||||
|
||||
describe("Git sync Bug #10773", function() {
|
||||
|
|
@ -265,7 +268,6 @@ describe("Git sync Bug #10773", function() {
|
|||
);
|
||||
});
|
||||
_.gitSync.DeleteTestGithubRepo(repoName);
|
||||
//cy.deleteTestGithubRepo(repoName);
|
||||
});
|
||||
});
|
||||
|
||||
|
|
@ -299,7 +301,7 @@ describe("Git sync Bug #10773", function() {
|
|||
`generateKey-${repoName}`,
|
||||
);
|
||||
cy.get(gitSyncLocators.gitRepoInput).type(
|
||||
`{selectAll}git@35.154.225.218:CI-Gitea/${repoName}.git`,
|
||||
`{selectAll}${datasourceFormData["GITEA_API_URL_TED"]}/${repoName}.git`,
|
||||
);
|
||||
// abort git flow after generating key
|
||||
cy.get(gitSyncLocators.closeGitSyncModal).click();
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ describe("Fork a template to the current app", () => {
|
|||
_.agHelper.AssertElementExist(_.gitSync._bottomBarPull);
|
||||
cy.get(gitSyncLocators.commitCommentInput).type("Initial Commit");
|
||||
cy.get(gitSyncLocators.commitButton).click();
|
||||
cy.wait(10000);
|
||||
_.agHelper.AssertElementExist(_.gitSync._bottomBarPull);
|
||||
cy.get(gitSyncLocators.closeGitSyncModal).click();
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -17,10 +17,10 @@ describe("Button Widget Functionality", function() {
|
|||
//creating the Modal and verify Modal name
|
||||
cy.createModal(this.data.ModalName);
|
||||
cy.PublishtheApp();
|
||||
cy.get(publishPage.buttonWidget).should('be.visible')
|
||||
cy.get(publishPage.buttonWidget).should("be.visible");
|
||||
cy.get(publishPage.buttonWidget).click();
|
||||
cy.get("body").then(($ele) => {
|
||||
if ($ele.find(modalWidgetPage.modelTextField).length<=0) {
|
||||
if ($ele.find(modalWidgetPage.modelTextField).length <= 0) {
|
||||
cy.get(publishPage.buttonWidget).click();
|
||||
}
|
||||
});
|
||||
|
|
@ -54,7 +54,7 @@ describe("Button Widget Functionality", function() {
|
|||
// Clicking the button to verify the success message
|
||||
cy.get(publishPage.buttonWidget).click();
|
||||
cy.get("body").then(($ele) => {
|
||||
if ($ele.find(widgetsPage.apiCallToast).length<=0) {
|
||||
if ($ele.find(widgetsPage.apiCallToast).length <= 0) {
|
||||
cy.get(publishPage.buttonWidget).click();
|
||||
}
|
||||
});
|
||||
|
|
@ -102,7 +102,7 @@ describe("Button Widget Functionality", function() {
|
|||
// Clicking the button to verify the success message
|
||||
cy.get(publishPage.buttonWidget).click();
|
||||
cy.get("body").then(($ele) => {
|
||||
if ($ele.find(widgetsPage.apiCallToast).length<=0) {
|
||||
if ($ele.find(widgetsPage.apiCallToast).length <= 0) {
|
||||
cy.get(publishPage.buttonWidget).click();
|
||||
}
|
||||
});
|
||||
|
|
@ -123,7 +123,7 @@ describe("Button Widget Functionality", function() {
|
|||
// Clicking the button to verify the success message
|
||||
cy.get(publishPage.buttonWidget).click();
|
||||
cy.get("body").then(($ele) => {
|
||||
if ($ele.find(widgetsPage.apiCallToast).length<=0) {
|
||||
if ($ele.find(widgetsPage.apiCallToast).length <= 0) {
|
||||
cy.get(publishPage.buttonWidget).click();
|
||||
}
|
||||
});
|
||||
|
|
@ -143,7 +143,7 @@ describe("Button Widget Functionality", function() {
|
|||
// Clicking the button to verify the success message
|
||||
cy.get(publishPage.buttonWidget).click();
|
||||
cy.get("body").then(($ele) => {
|
||||
if ($ele.find(widgetsPage.apiCallToast).length<=0) {
|
||||
if ($ele.find(widgetsPage.apiCallToast).length <= 0) {
|
||||
cy.get(publishPage.buttonWidget).click();
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ describe("Checkbox Widget Functionality", function() {
|
|||
cy.openPropertyPane("checkboxwidget");
|
||||
cy.togglebar(commonlocators.requiredjs + " " + "input");
|
||||
cy.PublishtheApp();
|
||||
cy.wait(1500)
|
||||
cy.wait(1500);
|
||||
cy.get(publish.checkboxWidget).click();
|
||||
cy.get(publish.checkboxWidget).should("not.be.checked");
|
||||
cy.get(widgetsPage.formButtonWidget)
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ describe("Container Widget Functionality", function() {
|
|||
cy.testJsontext("label", `{{currentItem.last_name}}`);
|
||||
cy.addAction("{{currentItem.last_name}}", "onclick");
|
||||
cy.PublishtheApp();
|
||||
cy.wait(1500)
|
||||
cy.wait(1500);
|
||||
// Verify Widget Button by clicking on it
|
||||
cy.get(widgetsPage.widgetBtn)
|
||||
.closest("div")
|
||||
|
|
|
|||
|
|
@ -18,27 +18,6 @@ touch ./docker/dev.appsmith.com.pem ./docker/dev.appsmith.com-key.pem
|
|||
echo "$APPSMITH_SSL_CERTIFICATE" > ./docker/dev.appsmith.com.pem
|
||||
echo "$APPSMITH_SSL_KEY" > ./docker/dev.appsmith.com-key.pem
|
||||
|
||||
# echo "Download & Start TED server"
|
||||
# sudo docker pull nginx:latest
|
||||
# sudo docker pull appsmith/test-event-driver:latest
|
||||
|
||||
# Setup UI environment from docker image for running UI tests and perf tests
|
||||
# sudo docker run --network host --name wildcard-nginx -d -p 80:80 -p 443:443 \
|
||||
# -v `pwd`/docker/nginx-root.conf:/etc/nginx/nginx.conf \
|
||||
# -v `pwd`/docker/nginx.conf:/etc/nginx/conf.d/app.conf \
|
||||
# -v `pwd`/docker/dev.appsmith.com.pem:/etc/certificate/dev.appsmith.com.pem \
|
||||
# -v `pwd`/docker/dev.appsmith.com-key.pem:/etc/certificate/dev.appsmith.com-key.pem \
|
||||
# nginx:latest
|
||||
# sudo mkdir -p git-server/keys
|
||||
# sudo mkdir -p git-server/repos
|
||||
|
||||
# sudo docker run --name TED -d -p 2222:22 -p 5001:5001 -p 3306:3306 \
|
||||
# -p 5432:5432 -p 28017:27017 -p 25:25 --privileged --pid=host --ipc=host --volume /:/host -v ~/git-server/keys:/git-server/keys \
|
||||
# -v ~/git-server/repos:/git-server/repos appsmith/test-event-driver:latest
|
||||
|
||||
# echo "Waiting for test event driver to start"
|
||||
# sleep 50
|
||||
|
||||
echo "Checking if the containers have started"
|
||||
sudo docker ps -a
|
||||
for fcid in $(sudo docker ps -a | awk '/Exited/ { print $1 }'); do
|
||||
|
|
|
|||
|
|
@ -16,5 +16,6 @@ export const gitSync = ObjectsRegistry.GitSync;
|
|||
export const apiPage = ObjectsRegistry.ApiPage;
|
||||
export const dataSources = ObjectsRegistry.DataSources;
|
||||
export const inviteModal = ObjectsRegistry.InviteModal;
|
||||
export const table = ObjectsRegistry.TableV2;
|
||||
export const debuggerHelper = ObjectsRegistry.DebuggerHelper;
|
||||
export const templates = ObjectsRegistry.Templates;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import { ObjectsRegistry } from "../Objects/Registry";
|
||||
const GITHUB_API_BASE = "https://api.github.com";
|
||||
const GITEA_API_BASE = "http://35.154.225.218";
|
||||
//const GITEA_API_BASE = "http://35.154.225.218";
|
||||
|
||||
import datasourceFormData from "../../fixtures/datasources.json";
|
||||
|
||||
export class GitSync {
|
||||
|
|
@ -51,10 +52,21 @@ export class GitSync {
|
|||
});
|
||||
}
|
||||
|
||||
public CreateTestGiteaRepo(repo: string, privateFlag = false) {
|
||||
cy.request({
|
||||
method: "POST",
|
||||
url: `${datasourceFormData["GITEA_API_BASE_TED"]}:${datasourceFormData["GITEA_API_PORT_TED"]}/api/v1/org/Cypress/repos`,
|
||||
headers: {
|
||||
Authorization: `token ${Cypress.env("GITEA_TOKEN")}`,
|
||||
},
|
||||
body: {
|
||||
name: repo,
|
||||
private: privateFlag,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
public AuthorizeKeyToGitea(repo: string, assertConnect = true) {
|
||||
// const testEmail = "test@test.com";
|
||||
// const testUsername = "testusername";
|
||||
const owner = Cypress.env("TEST_GITHUB_USER_NAME");
|
||||
let generatedKey;
|
||||
this.OpenGitSyncModal();
|
||||
cy.intercept("POST", "/api/v1/applications/ssh-keypair/*").as(
|
||||
|
|
@ -68,7 +80,7 @@ export class GitSync {
|
|||
);
|
||||
this.agHelper.TypeText(
|
||||
this._gitRepoInput,
|
||||
`git@35.154.225.218:CI-Gitea/${repo}.git`,
|
||||
`${datasourceFormData["GITEA_API_URL_TED"]}/${repo}.git`,
|
||||
//`git@github.com:${owner}/${repo}.git`,
|
||||
);
|
||||
|
||||
|
|
@ -80,7 +92,7 @@ export class GitSync {
|
|||
// fetch the generated key and post to the github repo
|
||||
cy.request({
|
||||
method: "POST",
|
||||
url: `${GITEA_API_BASE}:3000/api/v1/repos/CI-Gitea/${repo}/keys`,
|
||||
url: `${datasourceFormData["GITEA_API_BASE_TED"]}:${datasourceFormData["GITEA_API_PORT_TED"]}/api/v1/repos/Cypress/${repo}/keys`,
|
||||
headers: {
|
||||
Authorization: `token ${Cypress.env("GITEA_TOKEN")}`,
|
||||
},
|
||||
|
|
@ -100,123 +112,17 @@ export class GitSync {
|
|||
this.agHelper.TypeText(this._gitConfigEmailInput, "test@test.com");
|
||||
this.agHelper.ClickButton("CONNECT");
|
||||
if (assertConnect) {
|
||||
this.agHelper.ValidateNetworkStatus("@connectGitLocalRepo", 200, 40000);//Increasing wait time for GitRepo to create in Gitea
|
||||
this.agHelper.ValidateNetworkStatus("@connectGitLocalRepo");
|
||||
this.agHelper.AssertElementExist(this._bottomBarCommit, 0, 30000);
|
||||
this.CloseGitSyncModal();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private AuthorizeLocalGitSSH(remoteUrl: string, assertConnect = true) {
|
||||
let generatedKey;
|
||||
this.OpenGitSyncModal();
|
||||
this.agHelper.AssertAttribute(
|
||||
this._gitRepoInput,
|
||||
"placeholder",
|
||||
"git@example.com:user/repository.git",
|
||||
);
|
||||
this.agHelper.TypeText(this._gitRepoInput, remoteUrl);
|
||||
|
||||
this.agHelper.ClickButton("Generate key");
|
||||
|
||||
cy.wait(`@generateKey`).then((result: any) => {
|
||||
generatedKey = result.response.body.data.publicKey;
|
||||
generatedKey = generatedKey.slice(0, generatedKey.length - 1);
|
||||
var formdata = new FormData();
|
||||
cy.log("generatedKey is " + generatedKey);
|
||||
formdata.set("sshkey", generatedKey);
|
||||
// fetch the generated key and post to the github repo
|
||||
cy.request({
|
||||
method: "POST",
|
||||
url: `http://${datasourceFormData["GITHUB_API_BASE_TED"]}:${datasourceFormData["GITHUB_API_PORT_TED"]}/v1/gitserver/addgitssh`,
|
||||
//body: formdata,
|
||||
body: {
|
||||
sshkey: generatedKey,
|
||||
},
|
||||
form: true,
|
||||
// headers: {
|
||||
// "Content-Type": "application/x-www-form-urlencoded"
|
||||
// },
|
||||
}).then((response) => {
|
||||
expect(response.status).to.equal(200);
|
||||
});
|
||||
this.agHelper.GetNClick(this._useDefaultConfig); //Uncheck the Use default configuration
|
||||
this.agHelper.TypeText(
|
||||
this._gitConfigNameInput,
|
||||
"testusername",
|
||||
//`{selectall}${testUsername}`,
|
||||
);
|
||||
this.agHelper.TypeText(this._gitConfigEmailInput, "test@test.com");
|
||||
this.agHelper.ClickButton("CONNECT");
|
||||
|
||||
if (assertConnect) {
|
||||
//this.ReplaceForGit("cypress/fixtures/Bugs/GitConnectResponse.json", remoteUrl);
|
||||
//cy.get('@connectGitLocalRepo').its('response.statusCode').should('equal', 200);
|
||||
// cy.intercept("POST", "/api/v1/git/connect/app/*", {
|
||||
// fixture: "/Bugs/GitConnectResponse.json",
|
||||
// });
|
||||
this.agHelper.ValidateNetworkStatus("@connectGitLocalRepo");
|
||||
}
|
||||
this.CloseGitSyncModal();
|
||||
});
|
||||
}
|
||||
|
||||
private ReplaceForGit(fixtureFile: any, remoteUrl: string) {
|
||||
let currentAppId, currentURL;
|
||||
cy.readFile(
|
||||
fixtureFile,
|
||||
// (err: string) => {
|
||||
// if (err) {
|
||||
// return console.error(err);
|
||||
// }}
|
||||
).then((data) => {
|
||||
cy.url().then((url) => {
|
||||
currentURL = url;
|
||||
const myRegexp = /page-1(.*)/;
|
||||
const match = myRegexp.exec(currentURL);
|
||||
cy.log(currentURL + "currentURL from intercept is");
|
||||
currentAppId = match ? match[1].split("/")[1] : null;
|
||||
data.data.id = currentAppId;
|
||||
data.data.gitApplicationMetadata.defaultApplicationId = currentAppId;
|
||||
data.data.gitApplicationMetadata.remoteUrl = remoteUrl;
|
||||
cy.writeFile(fixtureFile, JSON.stringify(data));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
public CreateTestGiteaRepo(repo: string, privateFlag = false) {
|
||||
cy.request({
|
||||
method: "POST",
|
||||
url: `${GITEA_API_BASE}:3000/api/v1/org/CI-Gitea/repos`,
|
||||
headers: {
|
||||
Authorization: `token ${Cypress.env("GITEA_TOKEN")}`,
|
||||
},
|
||||
body: {
|
||||
name: repo,
|
||||
private: privateFlag,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
private CreateLocalGithubRepo(repo: string) {
|
||||
let remoteUrl: string = "";
|
||||
cy.request({
|
||||
method: "GET",
|
||||
url:
|
||||
`http://${datasourceFormData["GITHUB_API_BASE_TED"]}:${datasourceFormData["GITHUB_API_PORT_TED"]}/v1/gitserver/addrepo?reponame=` +
|
||||
repo,
|
||||
}).then((response) => {
|
||||
remoteUrl = JSON.stringify(response.body).replace(/['"]+/g, "");
|
||||
expect(response.status).to.equal(200);
|
||||
//cy.log("remoteUrl is"+ remoteUrl);
|
||||
cy.wrap(remoteUrl).as("remoteUrl");
|
||||
});
|
||||
}
|
||||
|
||||
DeleteTestGithubRepo(repo: any) {
|
||||
cy.request({
|
||||
method: "DELETE",
|
||||
url: `${GITEA_API_BASE}:3000/api/v1/repos/CI-Gitea/${repo}`,
|
||||
url: `${datasourceFormData["GITEA_API_BASE_TED"]}:${datasourceFormData["GITEA_API_PORT_TED"]}/api/v1/repos/Cypress/${repo}`,
|
||||
headers: {
|
||||
Authorization: `token ${Cypress.env("GITEA_TOKEN")}`,
|
||||
},
|
||||
|
|
@ -242,4 +148,100 @@ export class GitSync {
|
|||
cy.wrap(branch + uid).as("gitbranchName");
|
||||
});
|
||||
}
|
||||
|
||||
//#region Unused methods
|
||||
|
||||
private AuthorizeLocalGitSSH(remoteUrl: string, assertConnect = true) {
|
||||
let generatedKey;
|
||||
this.OpenGitSyncModal();
|
||||
this.agHelper.AssertAttribute(
|
||||
this._gitRepoInput,
|
||||
"placeholder",
|
||||
"git@example.com:user/repository.git",
|
||||
);
|
||||
this.agHelper.TypeText(this._gitRepoInput, remoteUrl);
|
||||
|
||||
this.agHelper.ClickButton("Generate key");
|
||||
|
||||
cy.wait(`@generateKey`).then((result: any) => {
|
||||
generatedKey = result.response.body.data.publicKey;
|
||||
generatedKey = generatedKey.slice(0, generatedKey.length - 1);
|
||||
var formdata = new FormData();
|
||||
cy.log("generatedKey is " + generatedKey);
|
||||
formdata.set("sshkey", generatedKey);
|
||||
// fetch the generated key and post to the github repo
|
||||
cy.request({
|
||||
method: "POST",
|
||||
url: `http://${datasourceFormData["GITEA_API_BASE_TED"]}:${datasourceFormData["GITEA_API_PORT_TED"]}/v1/gitserver/addgitssh`,
|
||||
//body: formdata,
|
||||
body: {
|
||||
sshkey: generatedKey,
|
||||
},
|
||||
form: true,
|
||||
// headers: {
|
||||
// "Content-Type": "application/x-www-form-urlencoded"
|
||||
// },
|
||||
}).then((response) => {
|
||||
expect(response.status).to.equal(200);
|
||||
});
|
||||
this.agHelper.GetNClick(this._useDefaultConfig); //Uncheck the Use default configuration
|
||||
this.agHelper.TypeText(
|
||||
this._gitConfigNameInput,
|
||||
"testusername",
|
||||
//`{selectall}${testUsername}`,
|
||||
);
|
||||
this.agHelper.TypeText(this._gitConfigEmailInput, "test@test.com");
|
||||
this.agHelper.ClickButton("CONNECT");
|
||||
|
||||
if (assertConnect) {
|
||||
//this.ReplaceForGit("cypress/fixtures/Bugs/GitConnectResponse.json", remoteUrl);
|
||||
//cy.get('@connectGitLocalRepo').its('response.statusCode').should('equal', 200);
|
||||
// cy.intercept("POST", "/api/v1/git/connect/app/*", {
|
||||
// fixture: "/Bugs/GitConnectResponse.json",
|
||||
// });
|
||||
this.agHelper.ValidateNetworkStatus("@connectGitLocalRepo");
|
||||
}
|
||||
this.CloseGitSyncModal();
|
||||
});
|
||||
}
|
||||
|
||||
private ReplaceForGit(fixtureFile: any, remoteUrl: string) {
|
||||
let currentAppId, currentURL;
|
||||
cy.readFile(
|
||||
fixtureFile,
|
||||
// (err: string) => {
|
||||
// if (err) {
|
||||
// return console.error(err);
|
||||
// }}
|
||||
).then((data) => {
|
||||
cy.url().then((url) => {
|
||||
currentURL = url;
|
||||
const myRegexp = /page-1(.*)/;
|
||||
const match = myRegexp.exec(currentURL);
|
||||
cy.log(currentURL + "currentURL from intercept is");
|
||||
currentAppId = match ? match[1].split("/")[1] : null;
|
||||
data.data.id = currentAppId;
|
||||
data.data.gitApplicationMetadata.defaultApplicationId = currentAppId;
|
||||
data.data.gitApplicationMetadata.remoteUrl = remoteUrl;
|
||||
cy.writeFile(fixtureFile, JSON.stringify(data));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
private CreateLocalGithubRepo(repo: string) {
|
||||
let remoteUrl: string = "";
|
||||
cy.request({
|
||||
method: "GET",
|
||||
url:
|
||||
`http://${datasourceFormData["GITEA_API_BASE_TED"]}:${datasourceFormData["GITEA_API_PORT_TED"]}/v1/gitserver/addrepo?reponame=` +
|
||||
repo,
|
||||
}).then((response) => {
|
||||
remoteUrl = JSON.stringify(response.body).replace(/['"]+/g, "");
|
||||
expect(response.status).to.equal(200);
|
||||
//cy.log("remoteUrl is"+ remoteUrl);
|
||||
cy.wrap(remoteUrl).as("remoteUrl");
|
||||
});
|
||||
}
|
||||
|
||||
//#endregion
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,6 +33,8 @@ export class HomePage {
|
|||
"//div[contains(@class, 'label-container')]//span[1][text()='" +
|
||||
role +
|
||||
"']";
|
||||
private _profileMenu = ".t--profile-menu";
|
||||
private _signout = ".t--logout-icon";
|
||||
|
||||
private _manageUsers = ".manageUsers";
|
||||
private _appHome = "//a[@href='/applications']";
|
||||
|
|
@ -243,6 +245,14 @@ export class HomePage {
|
|||
this.agHelper.Sleep(); //for logout to complete!
|
||||
}
|
||||
|
||||
public Signout() {
|
||||
this.NavigateToHome();
|
||||
this.agHelper.GetNClick(this._profileMenu);
|
||||
this.agHelper.GetNClick(this._signout);
|
||||
this.agHelper.ValidateNetworkStatus("@postLogout")
|
||||
this.agHelper.Sleep(); //for logout to complete!
|
||||
}
|
||||
|
||||
public LogintoApp(
|
||||
uname: string,
|
||||
pswd: string,
|
||||
|
|
|
|||
|
|
@ -6,13 +6,13 @@ require("cypress-file-upload");
|
|||
import gitSyncLocators from "../locators/gitSyncLocators";
|
||||
import homePage from "../locators/HomePage";
|
||||
import { ObjectsRegistry } from "../support/Objects/Registry";
|
||||
import datasourceFormData from "../fixtures/datasources.json";
|
||||
|
||||
let gitSync = ObjectsRegistry.GitSync,
|
||||
agHelper = ObjectsRegistry.AggregateHelper;
|
||||
|
||||
const commonLocators = require("../locators/commonlocators.json");
|
||||
const GITHUB_API_BASE = "https://api.github.com";
|
||||
const GITEA_API_BASE = "http://35.154.225.218";
|
||||
|
||||
Cypress.Commands.add("revokeAccessGit", (appName) => {
|
||||
cy.xpath("//span[text()= `${appName}`]")
|
||||
|
|
@ -294,7 +294,7 @@ Cypress.Commands.add(
|
|||
Cypress.Commands.add("merge", (destinationBranch) => {
|
||||
agHelper.AssertElementExist(gitSync._bottomBarPull);
|
||||
cy.get(gitSyncLocators.bottomBarMergeButton).click();
|
||||
cy.wait(6000); // wait for git status call to finish
|
||||
//cy.wait(6000); // wait for git status call to finish
|
||||
/*cy.wait("@gitStatus").should(
|
||||
"have.nested.property",
|
||||
"response.body.responseMeta.status",
|
||||
|
|
@ -350,7 +350,7 @@ Cypress.Commands.add(
|
|||
);
|
||||
cy.get(gitSyncLocators.gitRepoInput).type(
|
||||
//`git@github.com:${owner}/${repo}.git`,
|
||||
`git@35.154.225.218:CI-Gitea/${repo}.git`,
|
||||
`${datasourceFormData["GITEA_API_URL_TED"]}/${repo}.git`,
|
||||
);
|
||||
cy.get(gitSyncLocators.generateDeployKeyBtn).click();
|
||||
cy.wait(`@generateKey-${repo}`).then((result) => {
|
||||
|
|
@ -373,7 +373,7 @@ Cypress.Commands.add(
|
|||
|
||||
cy.request({
|
||||
method: "POST",
|
||||
url: `${GITEA_API_BASE}:3000/api/v1/repos/CI-Gitea/${repo}/keys`,
|
||||
url: `${datasourceFormData["GITEA_API_BASE_TED"]}:${datasourceFormData["GITEA_API_PORT_TED"]}/api/v1/repos/Cypress/${repo}/keys`,
|
||||
headers: {
|
||||
Authorization: `token ${Cypress.env("GITEA_TOKEN")}`,
|
||||
},
|
||||
|
|
@ -482,7 +482,7 @@ Cypress.Commands.add(
|
|||
|
||||
cy.request({
|
||||
method: "POST",
|
||||
url: `${GITEA_API_BASE}:3000/api/v1/repos/CI-Gitea/${repo}/keys`,
|
||||
url: `${datasourceFormData["GITEA_API_BASE_TED"]}:${datasourceFormData["GITEA_API_PORT_TED"]}/api/v1/repos/Cypress/${repo}/keys`,
|
||||
headers: {
|
||||
Authorization: `token ${Cypress.env("GITEA_TOKEN")}`,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -125,7 +125,7 @@ This error occurs because the node version is not compatible with the app enviro
|
|||
docker pull appsmith/test-event-driver
|
||||
```
|
||||
```
|
||||
docker run --name appsmithted -d -p 2222:22 -p 5001:5001 -p 3306:3306 -p 28017:27017 -p 5432:5432 -p 25:25 -v `pwd`/git-server/keys:/git-server/keys -v `pwd`/git-server/repos:/git-server/repo appsmith/test-event-driver
|
||||
docker run --name appsmithted -d -p 2222:22 -p 5001:5001 -p 3306:3306 -p 28017:27017 -p 5432:5432 -p 25:25 -p 5000:5000 -p 3000:3000 -v `pwd`/git-server/keys:/git-server/keys -v `pwd`/git-server/repos:/git-server/repo appsmith/test-event-driver
|
||||
```
|
||||
Note : You need to have client and server running locally to run TED
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user