Skip to content

Commit

Permalink
Merge branch 'dev' into luis/playwright
Browse files Browse the repository at this point in the history
  • Loading branch information
luisecm authored Jun 28, 2024
2 parents 65fcebd + 527d993 commit 3018970
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 51 deletions.
82 changes: 36 additions & 46 deletions cypress/e2e/07-settings-customization.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,41 @@ import settingsProfile from "./PageObjects/Settings/SettingsProfile";
describe("Settings - Customization", () => {
const username = faker.internet.userName();
const status = faker.lorem.sentence(3);
const pin = "1234";

beforeEach(() => {
loginPinPage.loginWithPin("1234");
// Login and setup user before each test
loginPinPage.loginWithPin(pin);
authNewAccount.createRandomUser(username, status);
chatsMain.validateChatsMainPageIsShown();
chatsMain.goToSettings();
settingsProfile.buttonCustomization.click();
});

it("K1 - Language dropdown should display English", () => {
const assertLabelAndText = (
label: any,
text: any,
labelDescription: string,
textDescription: string,
) => {
cy.assertText(
settingsCustomizations.appLanguageSectionLabel,
"App Language",
"App Language label should be present",
label,
labelDescription,
`${labelDescription} label should be present`,
);
cy.assertText(
text,
textDescription,
`${textDescription} text should be present`,
);
};

it("K1 - Language dropdown should display English", () => {
assertLabelAndText(
settingsCustomizations.appLanguageSectionLabel,
settingsCustomizations.appLanguageSectionText,
"App Language",
"Change language.",
"App Language text should be present",
);
settingsCustomizations.appLanguageSectionSelectorOption.should(
"have.length",
Expand Down Expand Up @@ -56,15 +72,11 @@ describe("Settings - Customization", () => {
"PoiretOne",
"OpenDyslexic",
];
cy.assertText(
assertLabelAndText(
settingsCustomizations.fontSectionLabel,
"Font",
"Font label should be present",
);
cy.assertText(
settingsCustomizations.fontSectionText,
"Font",
"Change the font used in the app.",
"Font text should be present",
);
settingsCustomizations.fontSectionSelectorOption.should(
"have.length",
Expand All @@ -74,40 +86,35 @@ describe("Settings - Customization", () => {
});

it("K3 - Selected Fonts should be applied everywhere throughout the app", () => {
settingsCustomizations.selectFont("JosefinSans");
const selectedFont = "JosefinSans";
settingsCustomizations.selectFont(selectedFont);
settingsCustomizations.fontSectionText.should(
"have.css",
"font-family",
"JosefinSans",
selectedFont,
);
settingsCustomizations.goToChat();
cy.contains("Let's get something started!").should(
"have.css",
"font-family",
"JosefinSans",
selectedFont,
);
});

it.skip("K4 - Clicking OpenFolder should open the Fonts folder", () => {});

// Skipped since a new bug was introduced for this test and font size is not refreshing after changing the font
it.skip("K5 - Font size should have a minimum of .82", () => {
cy.assertText(
assertLabelAndText(
settingsCustomizations.fontScalingSectionLabel,
"Font Scaling",
"Font Scaling label should be present",
);
cy.assertText(
settingsCustomizations.fontScalingSectionText,
"Font Scaling",
"Scale the font size up or down to your liking.",
"Font Scaling text should be present",
);
settingsCustomizations.fontScalingSectionInput.should("have.value", "1.00");

for (let i = 0; i < 10; i++) {
settingsCustomizations.fontScalingSectionDecreaseButton.click();
}

settingsCustomizations.fontScalingSectionInput.should("have.value", "0.82");
settingsCustomizations.fontScalingSectionText.should(
"have.css",
Expand All @@ -119,11 +126,9 @@ describe("Settings - Customization", () => {
// Skipped since a new bug was introduced for this test and font size is not refreshing after changing the font
it.skip("K6, K7 - Font size should have a maximum of 1.50 and can be applied correctly everywhere through the app", () => {
settingsCustomizations.fontScalingSectionInput.should("have.value", "1.00");

for (let i = 0; i < 20; i++) {
settingsCustomizations.fontScalingSectionIncreaseButton.click();
}

settingsCustomizations.fontScalingSectionInput.should("have.value", "1.50");
settingsCustomizations.fontScalingSectionText.should(
"have.css",
Expand All @@ -142,15 +147,11 @@ describe("Settings - Customization", () => {

it("K9 - Themes dropdown should display Default", () => {
const expectedThemes = ["Default"];
cy.assertText(
assertLabelAndText(
settingsCustomizations.themeSectionLabel,
"Theme",
"Theme label should be present",
);
cy.assertText(
settingsCustomizations.themeSectionText,
"Theme",
"Change the theme of the app.",
"Theme text should be present",
);
settingsCustomizations.themeSectionSelectorOption.should("have.length", 1);
settingsCustomizations.validateThemes(expectedThemes);
Expand All @@ -172,15 +173,11 @@ describe("Settings - Customization", () => {
"Apple Valley",
"Pencil Lead",
];
cy.assertText(
assertLabelAndText(
settingsCustomizations.primaryColorSectionLabel,
"Primary Color",
"Primary Color label should be present",
);
cy.assertText(
settingsCustomizations.primaryColorSectionText,
"Primary Color",
"Change the primary color of the app.",
"Primary Color text should be present",
);
settingsCustomizations.primaryColorSectionColorSwatchButton.should(
"have.length",
Expand All @@ -207,14 +204,12 @@ describe("Settings - Customization", () => {
"background-color",
"rgb(77, 77, 255)",
);

settingsCustomizations.selectColorSwatch("Traffic Cone");
settingsCustomizations.buttonCustomization.should(
"have.css",
"background-color",
"rgb(255, 60, 0)",
);

settingsCustomizations.goToChat();
chatsMain.buttonAddFriends.should(
"have.css",
Expand All @@ -229,15 +224,11 @@ describe("Settings - Customization", () => {
"background-color",
"rgba(0, 0, 0, 0)",
);
cy.assertText(
assertLabelAndText(
settingsCustomizations.customCSSSectionLabel,
"Custom CSS",
"Custom CSS label should be present",
);
cy.assertText(
settingsCustomizations.customCSSSectionText,
"Custom CSS",
"Add additional custom CSS to the application.",
"Custom CSS text should be present",
);
settingsCustomizations.customCSSSectionTextArea.type(
".slimbar {background-color: rgb(255, 0, 141)}",
Expand All @@ -249,7 +240,6 @@ describe("Settings - Customization", () => {
"background-color",
"rgb(255, 0, 141)",
);

settingsCustomizations.goToChat();
chatsMain.slimbar.should(
"have.css",
Expand Down
5 changes: 0 additions & 5 deletions cypress/e2e/20-files.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,6 @@ describe("Files", () => {

// Toast notification should be displayed
filesScreen.toastNotification.should("be.visible");
filesScreen.toastNotificationText.should(
"have.text",
"Directory already exists",
);
});

it("F10 - User can create subfolders and navigate to parent folder with go back button", () => {
Expand Down Expand Up @@ -164,6 +160,5 @@ describe("Files", () => {

// Toast notification should be displayed
filesScreen.toastNotification.should("be.visible");
filesScreen.toastNotificationText.should("have.text", "File already exists");
});
});

0 comments on commit 3018970

Please sign in to comment.