Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
2d6ad58
create auth tests
afolasope Aug 16, 2024
776ecbf
update workflow
afolasope Aug 16, 2024
750805c
update auth test
afolasope Aug 19, 2024
3a9bda1
update auth test
afolasope Aug 19, 2024
4c64e3b
update auth test
afolasope Aug 19, 2024
b406784
update auth test
afolasope Aug 19, 2024
27ba6d7
update auth test
afolasope Aug 19, 2024
bf17ab5
update auth test
afolasope Aug 19, 2024
0258684
update auth test
afolasope Aug 19, 2024
3107b97
create test for workspace
afolasope Aug 21, 2024
fc0e9c0
update workspace test
afolasope Aug 21, 2024
353c326
update create workspace test
afolasope Aug 21, 2024
82864ab
update workspace test
afolasope Aug 21, 2024
06b57cb
update auth layout
afolasope Aug 21, 2024
5e04eb8
Merge branch 'ENG-177' of https://github.com/IntegraflowHQ/integraflo…
afolasope Aug 21, 2024
ea3f194
update config
afolasope Aug 21, 2024
a2c6470
update action
afolasope Aug 21, 2024
18b82d5
update config
afolasope Aug 21, 2024
ea6ced1
create survey tests
afolasope Aug 28, 2024
ed911c9
create survey tests
afolasope Sep 5, 2024
d56fc90
update questions test
afolasope Sep 8, 2024
8e2ff12
Merge branch 'main' into ENG-178
afolasope Sep 11, 2024
851f9a2
update question test
afolasope Sep 17, 2024
0d45ca5
update question test
afolasope Sep 17, 2024
d0e0090
update question test
afolasope Sep 17, 2024
31f8e01
update question test
afolasope Sep 17, 2024
f06e75e
update question test
afolasope Sep 17, 2024
17ec655
update question tests
afolasope Sep 18, 2024
7df4350
update auth test
afolasope Sep 18, 2024
336edd9
Merge branch 'ENG-176' into ENG-177
afolasope Sep 18, 2024
d6e6c2c
update workspace test
afolasope Sep 18, 2024
2605434
update auth tests
afolasope Sep 18, 2024
ee85215
update auth tests
afolasope Sep 18, 2024
4fe686e
update auth test
afolasope Sep 20, 2024
23ec1af
Merge branch 'ENG-176' into ENG-177
afolasope Sep 20, 2024
595423d
update auth test
afolasope Sep 23, 2024
c9c537d
Merge branch 'ENG-176' into ENG-177
afolasope Sep 23, 2024
f195d34
Merge branch 'main' into ENG-177
afolasope Sep 24, 2024
78c0b4a
update workspace test
afolasope Sep 25, 2024
2542e55
Merge branch 'ENG-177' into ENG-178
afolasope Sep 25, 2024
ed948ec
add test id to relevent elements
afolasope Oct 17, 2024
5d7ede1
create new helper functions
afolasope Oct 17, 2024
f35234c
create question setup function
afolasope Oct 17, 2024
6c7596a
create test for question settings
afolasope Oct 17, 2024
84402fb
update question test
afolasope Oct 17, 2024
bd23c1a
update question tests
afolasope Oct 17, 2024
e24c935
Merge branch 'main' into ENG-178
afolasope Oct 17, 2024
ece3a5a
add new user
afolasope Oct 21, 2024
af6dcd9
update question test
afolasope Oct 21, 2024
3d318b6
update question test
afolasope Oct 21, 2024
0cd7ec1
update workspace test
afolasope Oct 21, 2024
819d7c1
update question test
afolasope Oct 21, 2024
330a4ef
Merge branch 'ENG-182' into ENG-178
afolasope Oct 27, 2024
54421bd
add data test id to elements
afolasope Oct 31, 2024
0126d51
create logic tests
afolasope Oct 31, 2024
19dbcdf
update logic tests
afolasope Nov 11, 2024
c8d4a88
update logic test
afolasope Nov 13, 2024
5124212
add test id to elements
afolasope Nov 21, 2024
f96d692
create test to check web-sdk settings
afolasope Nov 21, 2024
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
6 changes: 6 additions & 0 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ jobs:

- name: Build dashboard
run: yarn build:dashboard
env:
VITE_GOOGLE_CLIENT_ID: ${{ secrets.VITE_GOOGLE_CLIENT_ID }}
VITE_SERVER_BASE_URL: ${{ secrets.VITE_SERVER_BASE_URL }}
VITE_LINK_SURVEY_HOST: ${{ secrets.VITE_LINK_SURVEY_HOST }}
VITE_PUBLIC_POSTHOG_KEY: ${{ secrets.VITE_PUBLIC_POSTHOG_KEY }}
VITE_PUBLIC_POSTHOG_HOST: ${{ secrets.VITE_PUBLIC_POSTHOG_HOST }}

- name: Start Backend Server
run: docker compose -f ./docker-compose-test.yml up -d
Expand Down
1 change: 1 addition & 0 deletions apps/frontend/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ dist-ssr
/playwright-report/
/blob-report/
/playwright/.cache/
/playwright/.auth/
1 change: 1 addition & 0 deletions apps/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
"zustand": "^4.4.5"
},
"devDependencies": {
"@faker-js/faker": "^9.0.1",
"@graphql-codegen/cli": "^3.3.1",
"@graphql-codegen/client-preset": "^4.1.0",
"@graphql-codegen/typescript": "^3.0.4",
Expand Down
18 changes: 12 additions & 6 deletions apps/frontend/playwright.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { defineConfig, devices } from "@playwright/test";
import { ONBOARDED_USER_FILE } from "./tests/utils/constants";

/**
* Read environment variables from file.
Expand All @@ -12,14 +13,14 @@ import { defineConfig, devices } from "@playwright/test";
*/
export default defineConfig({
testDir: "./tests",
timeout: 90000,
/* Run tests in files in parallel */
fullyParallel: true,
/* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly: !!process.env.CI,
/* Retry on CI only */
retries: process.env.CI ? 2 : 0,
retries: 3,
/* Opt out of parallel tests on CI. */
workers: process.env.CI ? 1 : undefined,
workers: process.env.CI ? undefined : "80%",
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: "html",
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
Expand All @@ -33,19 +34,24 @@ export default defineConfig({

/* Configure projects for major browsers */
projects: [
{ name: "setup", testMatch: /.*\.setup\.ts/ },

{
name: "chromium",
use: { ...devices["Desktop Chrome"] },
use: { ...devices["Desktop Chrome"], storageState: ONBOARDED_USER_FILE },
dependencies: ["setup"],
},

{
name: "firefox",
use: { ...devices["Desktop Firefox"] },
use: { ...devices["Desktop Firefox"], storageState: ONBOARDED_USER_FILE },
dependencies: ["setup"],
},

{
name: "webkit",
use: { ...devices["Desktop Safari"] },
use: { ...devices["Desktop Safari"], storageState: ONBOARDED_USER_FILE },
dependencies: ["setup"],
},

/* Test against mobile viewports. */
Expand Down
2 changes: 1 addition & 1 deletion apps/frontend/src/layout/AuthLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Profile2 from "../assets/images/loginScreen/profile-2.png";
import Profile3 from "../assets/images/loginScreen/profile-3.png";
import Logo from "../assets/images/logo.png";

const clientId = import.meta.env.VITE_GOOGLE_CLIENT_ID;
const clientId = import.meta.env.VITE_GOOGLE_CLIENT_ID ?? "";

export function AuthLayout() {
return (
Expand Down
2 changes: 2 additions & 0 deletions apps/frontend/src/layout/partials/Navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ export const Navbar = () => {
</div>
<div className="space-y-[27px] pb-[24px]">
<button
data-testid="create-survey"
onClick={() =>
navigate(
`${ROUTES.SURVEY_LIST}/?create=2`
Expand Down Expand Up @@ -247,6 +248,7 @@ export const Navbar = () => {
onClick={() => {
setOpenOrganizationInviteModal(true);
}}
data-testid="invite-team-btn"
>
<span>
<CirclePlusIcon />
Expand Down
12 changes: 10 additions & 2 deletions apps/frontend/src/layout/partials/UserProfile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ export const UserProfile = () => {

return (
<DropdownMenu>
<DropdownMenuTrigger className="flex w-full items-center text-intg-text outline-none">
<DropdownMenuTrigger
data-testid="profile-btn"
className="flex w-full items-center text-intg-text outline-none"
>
<div className="flex items-center gap-2">
<img src={Frame} alt="picture frame" className="h-[31px] w-[31px] rounded object-contain" />
<span className="text-sm">Profile</span>
Expand Down Expand Up @@ -134,6 +137,7 @@ export const UserProfile = () => {
</DropdownMenuSubContent>
</DropdownMenuSub>
<DropdownMenuItem
data-testid="workspace-settings-btn"
className="flex items-center gap-2 px-3 py-2"
onClick={() =>
navigate(
Expand Down Expand Up @@ -164,7 +168,11 @@ export const UserProfile = () => {
);
})}
<DropdownMenuSeparator className="my-3 border-[.5px] border-intg-bg-4" />
<DropdownMenuItem className="flex cursor-pointer items-center gap-2 px-3 py-2" onClick={logout}>
<DropdownMenuItem
data-testid="logout"
className="flex cursor-pointer items-center gap-2 px-3 py-2"
onClick={logout}
>
<LogoutIcon />
<p className="text-sm text-intg-error-text">Log out</p>
</DropdownMenuItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ export const SurveyList = () => {
return (
<TableRow
key={survey.id}
data-testid={survey.name ?? survey.id}
className="border-intg-bg-4 text-center font-light transition-all duration-300 ease-in hover:bg-intg-bg-8"
>
<TableCell
Expand Down Expand Up @@ -152,7 +153,7 @@ export const SurveyList = () => {
</TableCell>
<TableCell className="text-center">
<Popover.Root>
<Popover.Trigger asChild>
<Popover.Trigger asChild data-testid="survey-dropdown-menu">
<button className="w-fit rounded-md px-1 py-1 transition-all duration-300 ease-in hover:cursor-pointer hover:bg-intg-bg-1 data-[state=a]:bg-intg-bg-1">
<MoreHorizontal color="#AFAAC7" />
</button>
Expand Down Expand Up @@ -252,6 +253,7 @@ export const SurveyList = () => {
getSurveyNameOnSelect(survey?.id ?? "", event)
}
className="flex gap-[6px] rounded-md py-[7px] text-sm font-normal text-intg-text-4 transition-all duration-300 ease-in hover:cursor-pointer hover:bg-intg-bg-1 hover:pl-[8px]"
data-testid="delete-survey"
>
<Trash2 size="18" color="#AFAAC7" />
Delete
Expand All @@ -265,6 +267,7 @@ export const SurveyList = () => {
className="w-[500px]"
>
<button
data-testid="confirm-delete-survey"
disabled={loading}
onClick={(e) =>
handleSurveyDelete(e, survey as Survey)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export interface EditorTextProps {
defaultValue?: string;
showMention?: boolean;
value?: string;
dataTestid?: string;
}

export const EditorTextInput = ({
Expand All @@ -35,6 +36,7 @@ export const EditorTextInput = ({
placeholder,
showMention = false,
value,
dataTestid,
}: EditorTextProps) => {
const [displayFallbackField, setDisplayFallbackField] = useState(false);
const [fallbackValue, setFallbackValue] = useState("");
Expand Down Expand Up @@ -269,6 +271,7 @@ export const EditorTextInput = ({
value={value}
defaultValue={defaultValue}
placeholder={placeholder}
data-testid={dataTestid}
className="rounded-lg border border-transparent bg-[#272138] text-sm text-intg-text-1 placeholder:text-intg-text-3 focus:border-intg-text-3 focus:outline-none"
disabled={maxCharacterCount === stripHtmlTags(defaultValue ?? "")?.length}
readOnly={survey?.status === SurveyStatusEnum.Active}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ export const LogicTab = ({ questionIndex }: Props) => {

setIsCreatingLogic(true);
}}
data-testid="add-new-logic"
>
<p className="text-xs underline">Add new Logic</p>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,12 @@ export const QuestionPanel = ({ questionIndex }: Props) => {
</Tabs.List>

<div className="flex items-center gap-3">
{survey?.status !== SurveyStatusEnum.Active ? (
<Trash2 onClick={() => deleteQuestion(question)} className="cursor-pointer" size={20} />
) : null}

<button onClick={clear}>
<button data-testid="delete-question">
{survey?.status !== SurveyStatusEnum.Active ? (
<Trash2 onClick={() => deleteQuestion(question)} className="cursor-pointer" size={20} />
) : null}
</button>
<button onClick={clear} name="close-question">
<XIcon className="cursor-pointer" />
</button>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ type Props = {
onclick?: () => void;
classname?: string;
size?: "sm" | "md";
dataTestid?: string;
};

const TextButton = ({ text, onclick, classname, size = "sm" }: Props) => {
const TextButton = ({ text, onclick, classname, size = "sm", dataTestid }: Props) => {
return (
<div
onClick={onclick && onclick}
Expand All @@ -16,6 +17,7 @@ const TextButton = ({ text, onclick, classname, size = "sm" }: Props) => {
size === "md" ? "text-sm" : "text-xs"
} w-fit cursor-pointer text-intg-text underline transition-colors delay-75 duration-500 ease-in hover:text-white `,
)}
data-testid={dataTestid}
>
{text}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ export const CTAFields = () => {
classname={`${showDescription ? "hidden" : "block"} mt-2`}
text="Add description"
onclick={() => setShowDescription(true)}
dataTestid="add-description-btn"
/>
) : null}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export const FormFieldList = () => {
options: newOptions,
});
}}
dataTestid="form-type-indicator"
/>

<EditorTextInput
Expand All @@ -66,6 +67,7 @@ export const FormFieldList = () => {
true,
);
}}
dataTestid="form-label"
/>
</div>

Expand Down Expand Up @@ -99,6 +101,7 @@ export const FormFieldList = () => {
{survey?.status !== SurveyStatusEnum.Active ? (
<TextButton
text={"Add next field"}
dataTestid="add-next-field-btn"
onclick={() => {
const highestOrderNumber = getHighestOrderNumber(question?.options);
const newOptions = [...question.options];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export const RatingFields = () => {
<div className="flex gap-2">
<div className="flex-1">
<ReactSelect
dataTestid="scale-style-indicator"
label="Scale Style"
options={scaleStyleOptions}
defaultValue={scaleStyleOptions.find((option) => option.value === question?.type)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ export const DefaultLogicBox: React.FC<Props> = ({
value={conditionOptions((question as ParsedQuestion).type!)?.find(
(option: Option) => option.value === (logicValues.condition as string),
)}
dataTestid="condition-indicator"
/>
</div>
</div>
Expand Down Expand Up @@ -174,6 +175,7 @@ export const DefaultLogicBox: React.FC<Props> = ({
onOperatorChange={() => {
handleOperatorChange();
}}
dataTestid="value-indicator"
comboBox={true}
options={logicValuesOptions(question!)}
onchange={handleValuesSelection}
Expand Down Expand Up @@ -204,6 +206,7 @@ export const DefaultLogicBox: React.FC<Props> = ({
<ReactSelect
options={destinationOptions(parsedQuestions, question!)}
onchange={handleDestinationSelection}
dataTestid="destination-indicator"
/>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useQuestion } from "@/modules/surveys/hooks/useQuestion";
import { useSurvey } from "@/modules/surveys/hooks/useSurvey";
import { QuestionLogic, LogicOperator } from "@/types";
import { LogicOperator, QuestionLogic } from "@/types";
import { cn, generateUniqueId } from "@/utils";
import { destinationOptions } from "@/utils/question";
import { PlusIcon } from "lucide-react";
Expand Down Expand Up @@ -131,6 +131,7 @@ const FormLogicDefault = ({ setFormLogicValues, formLogicValues, setIsCreatingLo
onchange={(value: SingleValue<Option> | MultiValue<Option>) => {
handleUpdateCondition(value);
}}
dataTestid="destination-indicator"
/>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ export const LogicGroup = ({ group, formLogicValues, setFormLogicValues, setIsCr
group.fields.includes(option.value),
) ?? []
}
dataTestid="value-indicator"
/>
</div>
</div>
Expand All @@ -95,6 +96,7 @@ export const LogicGroup = ({ group, formLogicValues, setFormLogicValues, setIsCr
onchange={(value) => {
handleUpdateCondition(value);
}}
dataTestid="condition-indicator"
/>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ export const FormLogicBox = ({ logic, logicIndex }: Props) => {
onchange={(value) => {
handleUpdateDestination(value);
}}
dataTestid="destination-indicator"
/>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ export const LogicGroup = ({ groups, setEditValues, editValues, logicIndex }: Pr
onchange={(values: SingleValue<Option> | MultiValue<Option>) => {
handleUpdateFields(values, group, index);
}}
dataTestid="value-indicator"
/>
</div>
</div>
Expand All @@ -230,6 +231,7 @@ export const LogicGroup = ({ groups, setEditValues, editValues, logicIndex }: Pr
onchange={(value: SingleValue<Option> | MultiValue<Option>) => {
handleUpdateCondition(value, group, index);
}}
dataTestid="condition-indicator"
/>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,23 @@ const MinMaxSelector = ({ options, maxChange, minChange, minValue, maxValue, max
<div className="flex gap-4">
<div className="flex-1">
<p className="text-sm">Min</p>
<ReactSelect onchange={handleMinChange} options={options} value={min} defaultValue={minDefault} />
<ReactSelect
onchange={handleMinChange}
dataTestid={"min-indicator"}
options={options}
value={min}
defaultValue={minDefault}
/>
</div>
<div className="flex-1">
<p className="text-sm">Max</p>
<ReactSelect onchange={handleMaxChange} options={options} value={max} defaultValue={maxDefault} />
<ReactSelect
onchange={handleMaxChange}
dataTestid="max-indicator"
options={options}
value={max}
defaultValue={maxDefault}
/>
</div>
</div>
);
Expand Down
Loading