-
Notifications
You must be signed in to change notification settings - Fork 230
feat: add detailed steps and timeline for Philippines 13A visa application process #456
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
Open
gabconcepcionph
wants to merge
8
commits into
bettergovph:main
Choose a base branch
from
gabconcepcionph:feature/visa-steps-structured-ui
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
d8de1a5
feat: add detailed steps and timeline for Philippines 13A visa applic…
fd4427c
Merge branch 'main' into feature/visa-steps-structured-ui
gabconcepcionph 9df1f37
Merge branch 'main' into feature/visa-steps-structured-ui
gabconcepcionph c80a314
refactor: convert visa steps section to use Accordion component for b…
gabconcepcionph 7cea665
Merge branch 'feature/visa-steps-structured-ui' of github.com:gabconc…
gabconcepcionph 1970db6
test: remove redundant 13G visa detail test case and add heading leve…
gabconcepcionph c30a66d
test: remove redundant visibility checks for minimum requirements sec…
gabconcepcionph 7f5e3f6
Merge branch 'main' into feature/visa-steps-structured-ui
DaijobuDes File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,130 @@ | ||
| import { expect, test } from '@playwright/test'; | ||
|
|
||
| test('should render visa types landing structure', async ({ page }) => { | ||
| await page.goto('/travel/visa-types'); | ||
|
|
||
| await expect( | ||
| page.getByRole('heading', { level: 1, name: 'Philippines Visa Types' }) | ||
| ).toBeVisible(); | ||
|
|
||
| await expect( | ||
| page.getByText( | ||
| 'Explore different types of visas available for travel to the Philippines' | ||
| ) | ||
| ).toBeVisible(); | ||
|
|
||
| await expect(page.getByPlaceholder('Search visa types...')).toBeVisible(); | ||
|
|
||
| await expect( | ||
| page.getByRole('heading', { name: 'Visa Categories' }) | ||
| ).toBeVisible(); | ||
|
|
||
| const categoryButtons = page.getByRole('button', { name: /Visas$/ }); | ||
| expect(await categoryButtons.count()).toBeGreaterThan(0); | ||
| await expect(categoryButtons.first()).toBeVisible(); | ||
|
|
||
| const visaLinks = page.getByRole('link', { name: /Visa/ }); | ||
| expect(await visaLinks.count()).toBeGreaterThan(0); | ||
| await expect(visaLinks.first()).toBeVisible(); | ||
|
|
||
| await expect( | ||
| page.getByRole('heading', { level: 3, name: 'Important Notice' }) | ||
| ).toBeVisible(); | ||
| }); | ||
|
|
||
| test('should render visa detail layout structure', async ({ page }) => { | ||
| await page.goto('/travel/visa-types'); | ||
|
|
||
| const visaLinks = page.getByRole('link', { name: /Visa/ }); | ||
| const firstVisaLink = visaLinks.first(); | ||
| const targetHref = await firstVisaLink.getAttribute('href'); | ||
|
|
||
| expect(targetHref).toBeTruthy(); | ||
|
|
||
| await firstVisaLink.click(); | ||
| await page.waitForURL(`**${targetHref}`); | ||
|
|
||
| await expect( | ||
| page.getByRole('heading', { name: 'Philippines Visa Types' }) | ||
| ).toBeVisible(); | ||
|
|
||
| await expect(page.getByPlaceholder('Search visa types...')).toBeVisible(); | ||
|
|
||
| await expect( | ||
| page.getByRole('link', { name: 'Back to Visa Types' }) | ||
| ).toBeVisible(); | ||
|
|
||
| const detailHeading = page.getByRole('heading', { level: 2 }).first(); | ||
| await expect(detailHeading).toBeVisible(); | ||
| await expect(detailHeading).not.toHaveText(''); | ||
|
|
||
| await expect( | ||
| page.getByRole('heading', { level: 3, name: 'Minimum Requirements' }) | ||
| ).toBeVisible(); | ||
|
|
||
| const stepsHeading = page.getByRole('heading', { level: 3, name: 'Steps' }); | ||
| if ((await stepsHeading.count()) > 0) { | ||
| await expect(stepsHeading.first()).toBeVisible(); | ||
| const firstStepTrigger = page | ||
| .getByRole('button', { name: /^(Step\s+\d+|\d+\.)/i }) | ||
| .first(); | ||
| await firstStepTrigger.click(); | ||
| const openStepContent = page.locator('[data-state="open"]').first(); | ||
| await expect(openStepContent).toBeVisible(); | ||
| const openStepItems = openStepContent.locator('li, p'); | ||
| expect(await openStepItems.count()).toBeGreaterThan(0); | ||
| await expect(openStepItems.first()).toBeVisible(); | ||
| } | ||
|
|
||
| const subtypesHeading = page.getByRole('heading', { | ||
| level: 3, | ||
| name: 'Visa Subtypes', | ||
| }); | ||
| if ((await subtypesHeading.count()) > 0) { | ||
| await expect(subtypesHeading.first()).toBeVisible(); | ||
| await expect(page.getByRole('heading', { level: 4 }).first()).toBeVisible(); | ||
| } | ||
|
|
||
| await expect( | ||
| page.getByRole('heading', { level: 3, name: 'Important Notice' }) | ||
| ).toBeVisible(); | ||
| }); | ||
|
|
||
| test('should render 13A visa detail directly', async ({ page }) => { | ||
| await page.goto('/travel/visa-types/13a'); | ||
|
|
||
| await expect( | ||
| page.getByRole('heading', { name: 'Philippines Visa Types' }) | ||
| ).toBeVisible(); | ||
|
|
||
| const primaryHeading13A = page.getByRole('heading', { level: 2 }).first(); | ||
| await expect(primaryHeading13A).toBeVisible(); | ||
| await expect(primaryHeading13A).not.toHaveText(''); | ||
|
|
||
| const minimumRequirementsHeading13A = page.getByRole('heading', { | ||
| level: 3, | ||
| name: 'Minimum Requirements', | ||
| }); | ||
| await expect(minimumRequirementsHeading13A).toBeVisible(); | ||
| const minimumRequirementsItems13A = minimumRequirementsHeading13A.locator( | ||
| 'xpath=following-sibling::div[1]//li' | ||
| ); | ||
| expect(await minimumRequirementsItems13A.count()).toBeGreaterThan(0); | ||
| await expect(minimumRequirementsItems13A.first()).toBeVisible(); | ||
|
|
||
| const stepsHeading = page.getByRole('heading', { level: 3, name: 'Steps' }); | ||
| await expect(stepsHeading.first()).toBeVisible(); | ||
| await page | ||
| .getByRole('button', { name: /^(Step\s+\d+|\d+\.)/i }) | ||
| .first() | ||
| .click(); | ||
| const openStepContent13A = page.locator('[data-state="open"]').first(); | ||
| await expect(openStepContent13A).toBeVisible(); | ||
| const openStepItems13A = openStepContent13A.locator('li, p'); | ||
| expect(await openStepItems13A.count()).toBeGreaterThan(0); | ||
| await expect(openStepItems13A.first()).toBeVisible(); | ||
|
|
||
| await expect( | ||
| page.getByRole('heading', { level: 3, name: 'Important Notice' }) | ||
| ).toBeVisible(); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| import * as AccordionPrimitive from '@radix-ui/react-accordion'; | ||
| import { ChevronDownIcon } from 'lucide-react'; | ||
| import { ComponentPropsWithoutRef, ElementRef, forwardRef } from 'react'; | ||
| import { cn } from '../../lib/utils'; | ||
|
|
||
| const Accordion = AccordionPrimitive.Root; | ||
|
|
||
| const AccordionItem = forwardRef< | ||
| ElementRef<typeof AccordionPrimitive.Item>, | ||
| ComponentPropsWithoutRef<typeof AccordionPrimitive.Item> | ||
| >(({ className, ...props }, ref) => ( | ||
| <AccordionPrimitive.Item | ||
| ref={ref} | ||
| className={cn( | ||
| 'overflow-hidden rounded-lg border border-gray-200 bg-white shadow-xs', | ||
| className | ||
| )} | ||
| {...props} | ||
| /> | ||
| )); | ||
| AccordionItem.displayName = 'AccordionItem'; | ||
|
|
||
| const AccordionTrigger = forwardRef< | ||
| ElementRef<typeof AccordionPrimitive.Trigger>, | ||
| ComponentPropsWithoutRef<typeof AccordionPrimitive.Trigger> | ||
| >(({ className, children, ...props }, ref) => ( | ||
| <AccordionPrimitive.Header className='flex'> | ||
| <AccordionPrimitive.Trigger | ||
| ref={ref} | ||
| className={cn( | ||
| 'flex w-full items-center justify-between gap-4 px-4 py-3 text-left text-base font-semibold text-gray-800 transition-colors', | ||
| 'hover:bg-gray-50 focus:outline-hidden focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-2', | ||
| '[data-state=open]>svg:rotate-180', | ||
| className | ||
| )} | ||
| {...props} | ||
| > | ||
| <span className='flex-1'>{children}</span> | ||
| <ChevronDownIcon className='h-5 w-5 text-gray-500 transition-transform duration-200' /> | ||
| </AccordionPrimitive.Trigger> | ||
| </AccordionPrimitive.Header> | ||
| )); | ||
| AccordionTrigger.displayName = AccordionPrimitive.Trigger.displayName; | ||
|
|
||
| const AccordionContent = forwardRef< | ||
| ElementRef<typeof AccordionPrimitive.Content>, | ||
| ComponentPropsWithoutRef<typeof AccordionPrimitive.Content> | ||
| >(({ className, children, ...props }, ref) => ( | ||
| <AccordionPrimitive.Content | ||
| ref={ref} | ||
| className={cn('px-4 pb-4 pt-0 text-gray-700', className)} | ||
| {...props} | ||
| > | ||
| {children} | ||
| </AccordionPrimitive.Content> | ||
| )); | ||
| AccordionContent.displayName = AccordionPrimitive.Content.displayName; | ||
|
|
||
| export { Accordion, AccordionContent, AccordionItem, AccordionTrigger }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please refrain from using the
locator()method and manually specifying the HTML tags or xpath to locate an element. Please use thegetByRole()method instead.locator()is best used when you are trying to narrow down elements to locate then paired withgetByRole()