Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Branding #18717

Merged
merged 32 commits into from
Dec 9, 2022
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
a9d98d4
add branding for ce
jsartisan Dec 6, 2022
fec448d
add ce changes
jsartisan Dec 7, 2022
a47c2fa
update colorpicker ux
jsartisan Dec 7, 2022
b63738d
remove unsued flag
jsartisan Dec 7, 2022
b28e0d7
Add new email templates
sharat87 Dec 7, 2022
689f8df
add local appsmith logo
jsartisan Dec 8, 2022
a4edcec
code review feedback fixes + qa fixes
jsartisan Dec 8, 2022
a64439e
latest pull + review feedback fixes
jsartisan Dec 8, 2022
6a7ee00
remove forward slash in url of favicon
jsartisan Dec 8, 2022
f547139
fix message
jsartisan Dec 8, 2022
c9b5303
Merge branch 'feat/new-email-templates' of github.com:appsmithorg/app…
jsartisan Dec 8, 2022
6633db6
Fix tests
sharat87 Dec 8, 2022
ed00c21
Merge branch 'feat/new-email-templates' of github.com:appsmithorg/app…
jsartisan Dec 8, 2022
104b4a3
update messages
jsartisan Dec 8, 2022
e9f5e7b
Fix tests (again)
sharat87 Dec 8, 2022
38b254a
Merge branch 'feat/branding' of github.com:appsmithorg/appsmith into …
jsartisan Dec 8, 2022
fa75178
update messages
jsartisan Dec 8, 2022
5afae6e
fix cypress tests
jsartisan Dec 8, 2022
9c64f89
fix cypress tests
jsartisan Dec 8, 2022
c4c8c86
skipping app layout test cases
jsartisan Dec 8, 2022
ddc6e38
Merge branch 'release' of github.com:appsmithorg/appsmith into feat/b…
jsartisan Dec 8, 2022
99cf470
fix cypress tests
jsartisan Dec 8, 2022
fe4882b
remove it.only
jsartisan Dec 9, 2022
70c3a3a
Merge branch 'release' into feat/branding
Aishwarya-U-R Dec 9, 2022
2a12ee9
Merge branch 'release' into feat/branding
Aishwarya-U-R Dec 9, 2022
33b4555
try moving test
jsartisan Dec 9, 2022
0f715a4
Merge branch 'feat/branding' of github.com:appsmithorg/appsmith into …
jsartisan Dec 9, 2022
d9ed116
use stable DS version
jsartisan Dec 9, 2022
53ada64
remove __diff
jsartisan Dec 9, 2022
db4939e
Merge branch 'feat/branding' of https://github.com/appsmithorg/appsmi…
Aishwarya-U-R Dec 9, 2022
5c580df
Merge branch 'release' of github.com:appsmithorg/appsmith into feat/b…
jsartisan Dec 9, 2022
fe06121
Merge branch 'feat/branding' of github.com:appsmithorg/appsmith into …
jsartisan Dec 9, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,35 @@ const widgetsPage = require("../../../../../locators/Widgets.json");
const dsl = require("../../../../../fixtures/tabsWidgetReset.json");
const publishPage = require("../../../../../locators/publishWidgetspage.json");

describe("Tabs widget on change of selection navigation usecases", function () {
before(() => {
cy.addDsl(dsl);
});
describe("Tabs widget on change of selection navigation usecases", function() {
before(() => {
cy.addDsl(dsl);
});

it("1.On change of tab selection Navigate to a URL", function () {
cy.openPropertyPane("tabswidget");
cy.get(".code-highlight")
.children()
.contains("No action")
.last()
.click({ force: true })
.selectOnClickOption("Navigate to");
cy.wait(5000);
cy.get("#switcher--url").click({ force: true });
cy.testCodeMirrorWithIndex("www.appsmith.com", 1);
cy.wait(5000);
});

it("2.Publish the app and validate the navigation change on tab selection.", function () {
cy.PublishtheApp();
cy.wait(5000);
cy.get(".t--page-switch-tab:contains('Tab 3')").click({force: true},{ multiple: true });
cy.url().should('include', 'appsmith');
cy.go('back');
cy.get(".t--page-switch-tab:contains('Tab 3')").should("be.visible");
//cy.get(publishPage.backToEditor).click({ force: true });
});
it("1.On change of tab selection Navigate to a URL", function() {
cy.openPropertyPane("tabswidget");
cy.get(".code-highlight")
.children()
.contains("No action")
.last()
.click({ force: true })
.selectOnClickOption("Navigate to");
cy.wait(5000);
cy.get("#switcher--url").click({ force: true });
cy.testCodeMirrorWithIndex("www.appsmith.com", 1);
cy.wait(5000);
});

it("2.Publish the app and validate the navigation change on tab selection.", function() {
cy.PublishtheApp();
cy.wait(5000);
cy.get(".t--page-switch-tab:contains('Tab 3')").click(
{ force: true },
{ multiple: true },
);
cy.url().should("include", "appsmith");
cy.go("back");
cy.get(".t--page-switch-tab:contains('Tab 3')").should("be.visible");
//cy.get(publishPage.backToEditor).click({ force: true });
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,205 @@
const commonlocators = require("../../../../locators/commonlocators.json");

const locators = {
AdminSettingsEntryLink: ".admin-settings-menu-option",
LeftPaneBrandingLink: ".t--settings-category-branding",
AdminSettingsColorInput: ".t--settings-brand-color-input input[type=text]",
AdmingSettingsLogoInput: ".t--settings-brand-logo-input input[type=file]",
AdmingSettingsLogoInputImage: ".t--settings-brand-logo-input img",
AdmingSettingsFaviconInput:
".t--settings-brand-favicon-input input[type=file]",
AdmingSettingsFaviconInputImage: ".t--settings-brand-favicon-input img",
BrandingBg: ".t--branding-bg",
BrandingLogo: ".t--branding-logo",
BrandingFavicon: "img.t--branding-favicon",
BrandingFaviconHead: "link.t--branding-favicon",
dashboardAppTab: ".t--apps-tab",
createNewAppButton: ".t--new-button",
loginContainer: ".t--login-container",
signupLink: ".t--signup-link",
authContainer: ".t--auth-container",
submitButton: "button[type='submit']",
appsmithLogo: ".t--appsmith-logo",
appsmithLogoImg: ".t--appsmith-logo img",
AdminSettingsColorInputShades: ".t--color-input-shades",
};

describe("Branding", () => {
let logo;
let favicon;
let shades = {};

it("super user can access branding page", () => {
cy.LogOut();
cy.LoginFromAPI(Cypress.env("USERNAME"), Cypress.env("PASSWORD"));
cy.visit("/applications");
cy.get(locators.AdminSettingsEntryLink).should("be.visible");
cy.get(locators.AdminSettingsEntryLink).click();
cy.url().should("contain", "/settings/general");
cy.get(locators.LeftPaneBrandingLink).should("be.visible");
cy.get(locators.LeftPaneBrandingLink).click();
cy.wait(2000);

cy.get("h2").contains(
Cypress.env("MESSAGES").ADMIN_BRANDING_SETTINGS_TITLE(),
);
cy.get("h2 + div").contains(
Cypress.env("MESSAGES").ADMIN_BRANDING_SETTINGS_SUBTITLE(),
);
});

it("should test that changing logo,favicon and color changes the preview", () => {
// branding color
cy.get(locators.AdminSettingsColorInput)
.focus()
.clear()
.type("red");

cy.get(".t--branding-bg").should(
"have.css",
"background-color",
"rgb(255, 0, 0)",
);

// branding logo
cy.get(locators.AdmingSettingsLogoInput).attachFile("appsmithlogo.png");
cy.wait(1000);
cy.get(locators.AdmingSettingsLogoInputImage).should("be.visible");
cy.get(locators.BrandingLogo)
.invoke("attr", "src")
.then((src) => {
cy.get(locators.AdmingSettingsLogoInputImage)
.invoke("attr", "src")
.should("equal", src);
});

// branding favicon
cy.get(locators.AdmingSettingsFaviconInput).attachFile("appsmithlogo.png");
cy.wait(1000);
cy.get(locators.AdmingSettingsFaviconInputImage).should("be.visible");
cy.get(locators.BrandingFavicon)
.invoke("attr", "src")
.then((src) => {
cy.get(locators.AdmingSettingsFaviconInputImage)
.invoke("attr", "src")
.should("equal", src);
});

// validations - logo
cy.get(locators.AdmingSettingsLogoInput).attachFile("testFile.mov");
cy.wait(1000);
cy.get(commonlocators.toastMsg).contains(
Cypress.env("MESSAGES").ADMIN_BRANDING_LOGO_FORMAT_ERROR(),
);

// validations - favicon
cy.get(locators.AdmingSettingsFaviconInput).attachFile("testFile.mov");
cy.wait(1000);
cy.get(commonlocators.toastMsg).contains(
Cypress.env("MESSAGES").ADMIN_BRANDING_FAVICON_FORMAT_ERROR(),
);
});

it("checks if the form can be submitted", () => {
if (Cypress.env("Edition") === 0) {
cy.get(locators.submitButton).should("be.disabled");
}

if (Cypress.env("Edition") === 1) {
// click on submit button
cy.get(locators.submitButton).click();
cy.wait(2000);

cy.get(commonlocators.toastMsg).contains("Successfully Saved");

// grab the favicon value
cy.get(locators.AdmingSettingsFaviconInputImage)
.invoke("attr", "src")
.then((src) => {
favicon = src;
});

// grab the logo value
cy.get(locators.AdmingSettingsLogoInputImage)
.invoke("attr", "src")
.then((src) => {
logo = src;
});

// grap the shades
let currentColor;
cy.get(locators.AdminSettingsColorInputShades)
.find("div")
.each(($el) => {
cy.wrap($el)
.invoke("css", "background-color")
.then((color) => {
currentColor = color;

cy.wrap($el)
.invoke("data", "id")
.then((id) => {
shades[id] = currentColor;
});
});
});
}
});

it("checks branding on dashboard", () => {
if (Cypress.env("Edition") === 1) {
// naivagae to dashboard
cy.get(locators.appsmithLogo).click();

// check logo
cy.get(locators.appsmithLogoImg)
.invoke("attr", "src")
.should("eq", logo);

// check favicon
cy.get(locators.BrandingFaviconHead)
.invoke("attr", "href")
.should("eq", favicon);

// check the apps tab border bottom
cy.get(locators.dashboardAppTab).should(
"have.css",
"border-bottom-color",
shades.primary,
);

// check the button bg
cy.get(locators.createNewAppButton).should(
"have.css",
"background-color",
shades.primary,
);
}
});

it("checks branding colors on login page", () => {
if (Cypress.env("Edition") === 1) {
// logout user
cy.window()
.its("store")
.invoke("dispatch", { type: "LOGOUT_USER_INIT" });
cy.wait("@postLogout");

cy.wait(2000);

cy.get(locators.loginContainer).should(
"have.css",
"border-top-color",
shades.primary,
);

cy.get(locators.signupLink).should("have.css", "color", shades.primary);

cy.get(locators.authContainer).should(
"have.css",
"background-color",
shades.background,
);
}
});
});
3 changes: 1 addition & 2 deletions app/client/cypress/support/widgetCommands.js
Original file line number Diff line number Diff line change
Expand Up @@ -431,8 +431,7 @@ Cypress.Commands.add("updateComputedValueV2", (value) => {
cy.wait(1000);
});


Cypress.Commands.add("testCodeMirrorWithIndex", (value,index) => {
Cypress.Commands.add("testCodeMirrorWithIndex", (value, index) => {
cy.EnableAllCodeEditors();
cy.get(".CodeMirror textarea")
.eq(index)
Expand Down
2 changes: 1 addition & 1 deletion app/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"cypress-log-to-output": "^1.1.2",
"dayjs": "^1.10.6",
"deep-diff": "^1.0.2",
"design-system": "npm:@appsmithorg/[email protected]",
"design-system": "npm:@appsmithorg/[email protected]-alpha.1",
"downloadjs": "^1.4.7",
"draft-js": "^0.11.7",
"exceljs-lightweight": "^1.14.0",
Expand Down
4 changes: 1 addition & 3 deletions app/client/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@

<head>
<meta charset="utf-8" />
<link rel="shortcut icon"
href="https://res.cloudinary.com/dwpfockn8/image/upload/v1597920848/favicons/favicon-orange_pxfmdc.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<title>Appsmith</title>
<style>
Expand All @@ -13,7 +11,7 @@
left: 0;
top: 0;
height: 4px;
background: #D36500;
background: #D7D7D7;
transition: all ease-in 0.3s;
}
</style>
Expand Down
2 changes: 1 addition & 1 deletion app/client/public/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "Appsmith Client Web UI",
"icons": [
{
"src": "favicon-orange.ico",
"src": "static/img/favicon-orange.ico",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
}
Expand Down
19 changes: 19 additions & 0 deletions app/client/public/static/img/appsmith-logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 4 additions & 1 deletion app/client/src/AppRouter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import LandingScreen from "./LandingScreen";
import UserAuth from "pages/UserAuth";
import Users from "pages/users";
import ErrorPage from "pages/common/ErrorPage";
import PageNotFound from "pages/common/PageNotFound";
import PageNotFound from "pages/common/ErrorPages/PageNotFound";
import PageLoadingBar from "pages/common/PageLoadingBar";
import ErrorPageHeader from "pages/common/ErrorPageHeader";
import { getCurrentThemeDetails, ThemeMode } from "selectors/themeSelectors";
Expand Down Expand Up @@ -64,6 +64,7 @@ import { getCurrentTenant } from "@appsmith/actions/tenantActions";
import { getDefaultAdminSettingsPath } from "@appsmith/utils/adminSettingsHelpers";
import { getCurrentUser as getCurrentUserSelector } from "selectors/usersSelectors";
import { getTenantPermissions } from "@appsmith/selectors/tenantSelectors";
import useBrandingTheme from "utils/hooks/useBrandingTheme";

/*
We use this polyfill to show emoji flags
Expand Down Expand Up @@ -116,6 +117,8 @@ function AppRouter(props: {
changeAppBackground(props.currentTheme);
}, [props.currentTheme]);

useBrandingTheme();

const user = useSelector(getCurrentUserSelector);
const tenantPermissions = useSelector(getTenantPermissions);

Expand Down
2 changes: 1 addition & 1 deletion app/client/src/LandingScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { ANONYMOUS_USERNAME, User } from "constants/userConstants";
import { Redirect } from "react-router";
import { APPLICATIONS_URL, AUTH_LOGIN_URL, BASE_URL } from "constants/routes";
import PageLoadingBar from "pages/common/PageLoadingBar";
import ServerUnavailable from "pages/common/ServerUnavailable";
import ServerUnavailable from "pages/common/ErrorPages/ServerUnavailable";

type Props = {
user?: User;
Expand Down
7 changes: 5 additions & 2 deletions app/client/src/ce/actions/settingsAction.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import { ReduxActionTypes } from "@appsmith/constants/ReduxActionConstants";

export const saveSettings = (settings: Record<string, string>) => ({
export const saveSettings = (settings: any, needsRestart = true) => ({
type: ReduxActionTypes.SAVE_ADMIN_SETTINGS,
payload: settings,
payload: {
settings,
needsRestart,
},
});

export const retryServerRestart = () => ({
Expand Down
Loading