Skip to content

Commit

Permalink
Revert "First test case" (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
hasan-py authored Oct 12, 2024
1 parent baf8d2d commit 8c832c7
Show file tree
Hide file tree
Showing 15 changed files with 484 additions and 237 deletions.
18 changes: 18 additions & 0 deletions client/e2e/example.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { test, expect } from '@playwright/test';

test('has title', async ({ page }) => {
await page.goto('https://playwright.dev/');

// Expect a title "to contain" a substring.
await expect(page).toHaveTitle(/Playwright/);
});

test('get started link', async ({ page }) => {
await page.goto('https://playwright.dev/');

// Click the get started link.
await page.getByRole('link', { name: 'Get started' }).click();

// Expects page to have a heading with the name of Installation.
await expect(page.getByRole('heading', { name: 'Installation' })).toBeVisible();
});
4 changes: 0 additions & 4 deletions client/e2e/fixtures/createModerator.json

This file was deleted.

3 changes: 0 additions & 3 deletions client/e2e/fixtures/moderatorExists.json

This file was deleted.

3 changes: 0 additions & 3 deletions client/e2e/fixtures/moderatorNotExists.json

This file was deleted.

9 changes: 0 additions & 9 deletions client/e2e/support/constants.ts

This file was deleted.

45 changes: 0 additions & 45 deletions client/e2e/tests/home.spec.ts

This file was deleted.

140 changes: 0 additions & 140 deletions client/e2e/tests/login.spec.ts

This file was deleted.

4 changes: 1 addition & 3 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"preview": "vite preview",
"e2e": "npx playwright test",
"e2e:ui": "npx playwright test --ui"
"preview": "vite preview"
},
"dependencies": {
"@chakra-ui/icons": "^2.0.18",
Expand Down
27 changes: 14 additions & 13 deletions client/playwright.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { defineConfig, devices } from "@playwright/test";
import { defineConfig, devices } from '@playwright/test';

/**
* Read environment variables from file.
Expand All @@ -12,7 +12,7 @@ import { defineConfig, devices } from "@playwright/test";
* See https://playwright.dev/docs/test-configuration.
*/
export default defineConfig({
testDir: "./e2e",
testDir: './e2e',
/* Run tests in files in parallel */
fullyParallel: true,
/* Fail the build on CI if you accidentally left test.only in the source code. */
Expand All @@ -22,25 +22,26 @@ export default defineConfig({
/* Opt out of parallel tests on CI. */
workers: process.env.CI ? 1 : undefined,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: "html",
reporter: 'html',
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
/* Base URL to use in actions like `await page.goto('/')`. */
baseURL: "http://127.0.0.1:5173",
// baseURL: 'http://127.0.0.1:3000',

/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: "on-first-retry",
trace: 'on-first-retry',
},

/* Configure projects for major browsers */
projects: [
{
name: "chromium",
use: { ...devices["Desktop Chrome"] },
name: 'chromium',
use: { ...devices['Desktop Chrome'] },
},

{
name: "firefox",
use: { ...devices["Desktop Firefox"] },
name: 'firefox',
use: { ...devices['Desktop Firefox'] },
},

// {
Expand All @@ -50,8 +51,8 @@ export default defineConfig({

/* Test against mobile viewports. */
{
name: "Mobile Chrome",
use: { ...devices["Pixel 5"] },
name: 'Mobile Chrome',
use: { ...devices['Pixel 5'] },
},
// {
// name: 'Mobile Safari',
Expand All @@ -64,8 +65,8 @@ export default defineConfig({
// use: { ...devices['Desktop Edge'], channel: 'msedge' },
// },
{
name: "Google Chrome",
use: { ...devices["Desktop Chrome"], channel: "chrome" },
name: 'Google Chrome',
use: { ...devices['Desktop Chrome'], channel: 'chrome' },
},
],

Expand Down
4 changes: 2 additions & 2 deletions client/src/pages/gameList/gameCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ export default function GameCard({ item }: { item: any }) {
/>
{item?.reviews?.length > 0 ? (
<div className="absolute bottom-0 right-0 bg-white flex item-center shadow-xl px-2 py-1 m-2 rounded-full">
{[...Array(Math.floor(+item?.avgRating))]?.map((_, key) => (
<StarIcon key={key} mx={"1px"} color="#f59e0b" />
{[...Array(Math.floor(+item?.avgRating))]?.map((_) => (
<StarIcon mx={"1px"} color="#f59e0b" />
))}
<span className="text-xs font-bold ml-1 mr-1">
{+item?.avgRating?.toFixed(2)}
Expand Down
4 changes: 2 additions & 2 deletions client/src/pages/gameList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ export default function Home() {

{!isLoading && data?.length > 0 ? (
<div className="pb-16 m-16 grid grid-cols-1 md:grid-cols-4 lg:grid-cols-4 gap-2 md:gap-4 lg:gap-8">
{data?.map((item: any, key: number) => (
<div key={key} className="col-span-1">
{data?.map((item: any) => (
<div className="col-span-1">
<GameCard item={item} />
</div>
))}
Expand Down
12 changes: 6 additions & 6 deletions client/src/pages/gameReview/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ export default function Review() {

{avgRating() > 0 ? (
<Flex my={4} alignItems={"center"} className="text-black">
{[...Array(Math.floor(+avgRating()))]?.map((_, key) => (
<StarIcon key={key} mx={"2px"} color="#f59e0b" />
{[...Array(Math.floor(+avgRating()))]?.map((_) => (
<StarIcon mx={"2px"} color="#f59e0b" />
))}
<Text marginLeft={2}>{avgRating()?.toFixed(2)}</Text>

Expand All @@ -103,8 +103,8 @@ export default function Review() {
</Heading>
<hr className="border-b-[1px] border-gray-100" />

{data?.reviews?.map((item: any, key:number) => (
<Box key={key} my={10} position={"relative"}>
{data?.reviews?.map((item: any) => (
<Box my={10} position={"relative"}>
<Flex flex="1" gap="4" alignItems="center" flexWrap="wrap">
<Box>
<Heading size="sm" className="text-black">
Expand All @@ -124,8 +124,8 @@ export default function Review() {

{+item?.rating > 0 ? (
<Flex alignItems={"center"}>
{[...Array(Math.floor(+item?.rating))]?.map((_, key) => (
<StarIcon key={key} mx={"2px"} color="#f59e0b" />
{[...Array(Math.floor(+item?.rating))]?.map((_) => (
<StarIcon mx={"2px"} color="#f59e0b" />
))}
<Text marginLeft={2}>{item?.rating}</Text>
</Flex>
Expand Down
6 changes: 2 additions & 4 deletions client/src/pages/moderator/mapView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,8 @@ export default function MapView(props: any) {
url="https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"
/>

{data?.map((item: any, key: number) => (
{data?.map((item: any) => (
<Marker
key={key}
position={[item?.reviews?.latitude, item?.reviews?.longitude]}
>
<Popup minWidth={150}>
Expand All @@ -101,9 +100,8 @@ export default function MapView(props: any) {

{item?.reviews ? (
<Flex alignItems={"center"}>
{[...Array(+item?.reviews?.rating)]?.map((star, key) => (
{[...Array(+item?.reviews?.rating)]?.map((star) => (
<StarIcon
key={key}
marginRight={1}
type="increase"
color="yellow.500"
Expand Down
Loading

0 comments on commit 8c832c7

Please sign in to comment.