test: add common test methods for RBAC (#18968)
This commit is contained in:
parent
f49db2a90e
commit
a30fbf2c77
|
|
@ -6,12 +6,14 @@
|
|||
"mongo-uri": "mongodb+srv://localhost:localhost@mockdb.net/mock?retryWrites=true&w=majority",
|
||||
|
||||
"postgres-host": "localhost",
|
||||
"postgres-host-fat": "host.docker.internal",
|
||||
"postgres-port": 5432,
|
||||
"postgres-databaseName": "fakeapi",
|
||||
"postgres-username": "docker",
|
||||
"postgres-password": "docker",
|
||||
|
||||
"mysql-host": "localhost",
|
||||
"mysql-host-fat": "host.docker.internal",
|
||||
"mysql-port": 3306,
|
||||
"mysql-databaseName": "fakeapi",
|
||||
"mysql-username": "root",
|
||||
|
|
|
|||
|
|
@ -458,6 +458,7 @@ describe("Git sync apps", function() {
|
|||
cy.get(`.t--entity-item:contains(Child_Page Copy)`).within(() => {
|
||||
cy.get(".t--context-menu").click({ force: true });
|
||||
});
|
||||
cy.wait(2000);
|
||||
cy.selectAction("Hide");
|
||||
|
||||
cy.get(`.t--entity-item:contains(Child_Page)`)
|
||||
|
|
|
|||
|
|
@ -95,4 +95,5 @@ export default {
|
|||
optionsIcon: ".t--options-icon",
|
||||
reconnectDatasourceModal: ".reconnect-datasource-modal",
|
||||
importAppProgressWrapper: ".t-import-app-progress-wrapper",
|
||||
backtoHome: ".t--back-to-home",
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1929,3 +1929,20 @@ Cypress.Commands.add("AddPageFromTemplate", () => {
|
|||
.click({ force: true });
|
||||
cy.get("[data-cy='add-page-from-template']").click();
|
||||
});
|
||||
|
||||
Cypress.Commands.add("LogintoAppTestUser", (uname, pword) => {
|
||||
cy.wait(1000); //waiting for window to load
|
||||
cy.window()
|
||||
.its("store")
|
||||
.invoke("dispatch", { type: "LOGOUT_USER_INIT" });
|
||||
cy.wait("@postLogout");
|
||||
|
||||
cy.visit("/user/login");
|
||||
cy.get(loginPage.username).should("be.visible");
|
||||
cy.get(loginPage.username).type(uname);
|
||||
cy.get(loginPage.password).type(pword, { log: false });
|
||||
cy.get(loginPage.submitBtn).click();
|
||||
cy.wait("@getMe");
|
||||
cy.wait(3000);
|
||||
initLocalstorage();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -549,3 +549,51 @@ Cypress.Commands.add("mockDatasourceDescriptionStyle", (tag) => {
|
|||
.and("have.css", "line-height", "17px")
|
||||
.and("have.css", "letter-spacing", "-0.24px");
|
||||
});
|
||||
Cypress.Commands.add(
|
||||
"fillPostgresDatasourceFormFat",
|
||||
(shouldAddTrailingSpaces = false) => {
|
||||
const hostAddress = shouldAddTrailingSpaces
|
||||
? datasourceFormData["postgres-host-fat"] + " "
|
||||
: datasourceFormData["postgres-host-fat"];
|
||||
const databaseName = shouldAddTrailingSpaces
|
||||
? datasourceFormData["postgres-databaseName"] + " "
|
||||
: datasourceFormData["postgres-databaseName"];
|
||||
|
||||
cy.get(datasourceEditor.host).type(hostAddress);
|
||||
cy.get(datasourceEditor.port).type(datasourceFormData["postgres-port"]);
|
||||
cy.get(datasourceEditor.databaseName)
|
||||
.clear()
|
||||
.type(databaseName);
|
||||
dataSources.ExpandSectionByName(datasourceEditor.sectionAuthentication);
|
||||
cy.get(datasourceEditor.username).type(
|
||||
datasourceFormData["postgres-username"],
|
||||
);
|
||||
cy.get(datasourceEditor.password).type(
|
||||
datasourceFormData["postgres-password"],
|
||||
);
|
||||
},
|
||||
);
|
||||
Cypress.Commands.add(
|
||||
"fillMySQLDatasourceFormFat",
|
||||
(shouldAddTrailingSpaces = false) => {
|
||||
const hostAddress = shouldAddTrailingSpaces
|
||||
? datasourceFormData["mysql-host-fat"] + " "
|
||||
: datasourceFormData["mysql-host-fat"];
|
||||
const databaseName = shouldAddTrailingSpaces
|
||||
? datasourceFormData["mysql-databaseName"] + " "
|
||||
: datasourceFormData["mysql-databaseName"];
|
||||
|
||||
cy.get(datasourceEditor.host).type(hostAddress);
|
||||
cy.get(datasourceEditor.port).type(datasourceFormData["mysql-port"]);
|
||||
cy.get(datasourceEditor.databaseName)
|
||||
.clear()
|
||||
.type(databaseName);
|
||||
dataSources.ExpandSectionByName(datasourceEditor.sectionAuthentication);
|
||||
cy.get(datasourceEditor.username).type(
|
||||
datasourceFormData["mysql-username"],
|
||||
);
|
||||
cy.get(datasourceEditor.password).type(
|
||||
datasourceFormData["mysql-password"],
|
||||
);
|
||||
},
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1106,6 +1106,7 @@ Cypress.Commands.add("Deletepage", (Pagename) => {
|
|||
cy.get(`.t--entity-item:contains(${Pagename})`).within(() => {
|
||||
cy.get(".t--context-menu").click({ force: true });
|
||||
});
|
||||
cy.wait(2000);
|
||||
cy.selectAction("Delete");
|
||||
cy.selectAction("Are you sure?");
|
||||
cy.wait("@deletePage");
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user