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

updating branch Automated-tests-manuji #16

Merged
merged 10 commits into from
Dec 18, 2024
12 changes: 6 additions & 6 deletions tests/all_advisories_page.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ test.describe('All advisories page tests', ()=>{
test('Verify the Event search is working', async ({page}) =>{
await page.goto(activeAdvisoriesURL);
await page.waitForLoadState('networkidle');
await page.getByLabel('Select an event').click();
await page.getByLabel('Select an event').fill('Avalanche', { customTimeout });
await page.getByLabel('Avalanche', { exact: true }).click();
await page.getByLabel('Select a type').click();
await page.getByLabel('Select a type').fill('Avalanche', { customTimeout });
await page.getByRole('option', { name: 'Avalanche', exact: true }).click();
await page.getByRole('button', { name: 'Search' }).click();
await expect(page.locator('h1', {name : 'Active advisories | Avalanche'})).toBeVisible();
await page.getByLabel('Clear').click();
await expect(page.getByLabel('Select an event')).toBeEmpty();
await page.getByLabel('Select an event').fill('Fire');
await page.getByLabel('Wildfire', { exact: true }).click();
await expect(page.getByLabel('Select a type')).toBeEmpty();
await page.getByLabel('Select a type').fill('Fire');
await page.getByRole('option', { name: 'Wildfire', exact: true }).click();
await page.getByRole('button', {name : 'Search'}).click();
await expect(page.locator('h1', {name : 'Active advisories | Fire'})).toBeVisible();
});
Expand Down
1 change: 0 additions & 1 deletion tests/approved_management_plan.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ test.describe('Approved management plan tests', ()=>{
test('Check that we can get to the page from homepage', async ({page})=>{
await page.waitForLoadState('networkidle');
await page.getByRole('menuitem', { name: 'About' }).click();
await expect(page.locator('#home div').filter({ hasText: 'Main Menu BackAboutOur' }).nth(4)).toBeVisible();
await expect(page.getByRole('menuitem', { name: 'About', exact: true })).toBeVisible();
await page.getByRole('menuitem', { name: 'Management plans' }).click();
await expect(page.getByRole('menuitem', { name: 'Management plans' }).nth(1)).toBeVisible();
Expand Down
2 changes: 1 addition & 1 deletion tests/dayUsePasses_contentPage.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ test('Verify the page content', async ({ page }) => {
await expect(page.getByRole('heading', { name: 'Day-use passes', exact: true })).toBeVisible();
await expect(page.locator('h1')).toContainText('Day-use passes');
await expect(page.getByRole('img', { name: 'Day-use passes' })).toBeVisible();
await expect(page.getByText('Joffre LakesGaribaldiGolden EarsMount SeymourWhy day-use passes?', { exact: true })).toBeVisible();
await expect(page.getByText('Mount SeymourJoffre LakesGaribaldiGolden EarsWhy day-use passes?', { exact: true })).toBeVisible();
await expect(page.locator('#section-navbar').getByRole('link', { name: 'Joffre Lakes' })).toBeVisible();
await expect(page.locator('#section-navbar')).toContainText('Joffre Lakes');
await expect(page.locator('#section-navbar').getByRole('link', { name: 'Garibaldi' })).toBeVisible();
Expand Down
62 changes: 27 additions & 35 deletions tests/find_a_park_page.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,17 +94,17 @@ test.describe('Find a park page tests', async ()=>{
await page.getByRole('menuitem', { name: 'Find a park' }).click();
await page.waitForLoadState('networkidle');
await expect(page).toHaveURL("https://bcparks.ca/find-a-park/");
await page.getByLabel('Backcountry camping (267)').click();
await expect(page.getByLabel('Backcountry camping (267)')).toBeVisible();
await expect(page.getByText('267', { exact: true })).toBeVisible();
await page.getByLabel('Backcountry camping (266)').click();
await expect(page.getByLabel('Backcountry camping (266)')).toBeVisible();
await expect(page.getByText('266', { exact: true })).toBeVisible();
// Apply Lower Mainland filter and is visible
await page.getByLabel('Lower Mainland (7)').click();
await expect(page.getByLabel('Lower Mainland (7)')).toBeVisible();
await expect(page.getByText('267', { exact: true })).toBeHidden();
await expect(page.getByText('7', { exact: true })).toBeVisible();
// Remove the Backcountry camping filter and is hidden
await page.getByRole('button', { name: 'Backcountry' }).click();
await expect(page.getByLabel('Backcountry camping (267)')).toBeHidden();
await expect(page.getByLabel('Backcountry camping (266)')).toBeHidden();
// Apply Canoeing filter and is visible
await page.getByLabel('Canoeing (14)').click();
await expect(page.getByRole('button', { name: 'Canoeing' })).toBeVisible();
Expand All @@ -116,13 +116,13 @@ test.describe('Find a park page tests', async ()=>{
await page.getByRole('button', { name: 'Show all 19' }).click();
await page.getByRole('group', { name: 'Facilities' }).getByRole('button').click();
// Check that all filters are unchecked
await expect(page.getByLabel('Backcountry camping (267)')).not.toBeChecked();
await expect(page.getByLabel('Cycling (275)')).not.toBeChecked();
await expect(page.getByLabel('Hiking (450)')).not.toBeChecked();
await expect(page.getByLabel('Pets on leash (519)')).not.toBeChecked();
await expect(page.getByLabel('Picnic areas (263)')).not.toBeChecked();
await expect(page.getByLabel('Swimming (349)')).not.toBeChecked();
await expect(page.getByLabel('Frontcountry camping (191)')).not.toBeChecked();
await expect(page.getByLabel('Backcountry camping (266)')).not.toBeChecked();
await expect(page.getByLabel('Cycling (274)')).not.toBeChecked();
await expect(page.getByLabel('Hiking (440)')).not.toBeChecked();
await expect(page.getByLabel('Pets on leash (511)')).not.toBeChecked();
await expect(page.getByLabel('Picnic areas (258)')).not.toBeChecked();
await expect(page.getByLabel('Swimming (342)')).not.toBeChecked();
await expect(page.getByLabel('Frontcountry camping (187)')).not.toBeChecked();
await expect(page.getByLabel('Lower Mainland (44)')).not.toBeChecked();
await expect(page.getByLabel('South Island (96)')).not.toBeChecked();
await expect(page.getByLabel('Okanagan (83)')).not.toBeChecked();
Expand All @@ -137,30 +137,30 @@ test.describe('Find a park page tests', async ()=>{
await expect(page.getByLabel('Skeena East (91)')).not.toBeChecked();
await expect(page.getByLabel('Skeena West (100)')).not.toBeChecked();
await expect(page.getByLabel('South Central Coast (32)')).not.toBeChecked();
await expect(page.getByLabel('Canoeing (444)')).not.toBeChecked();
await expect(page.getByLabel('Canoeing (417)')).not.toBeChecked();
await expect(page.getByLabel('Caving (14)')).not.toBeChecked();
await expect(page.getByLabel('Climbing (40)')).not.toBeChecked();
await expect(page.getByLabel('Climbing (39)')).not.toBeChecked();
await expect(page.getByRole('group', { name: 'Things to do' }).locator('#Cycling')).not.toBeChecked();
await expect(page.getByLabel('Disc golf (1)')).not.toBeChecked();
await expect(page.getByLabel('E-Biking (58)')).not.toBeChecked();
await expect(page.getByLabel('Fishing (559)')).not.toBeChecked();
await expect(page.getByLabel('Fishing (551)')).not.toBeChecked();
await expect(page.getByRole('group', { name: 'Things to do' }).locator('#Hiking')).not.toBeChecked();
await expect(page.getByLabel('Horseback riding (131)')).not.toBeChecked();
await expect(page.getByLabel('Hunting (336)')).not.toBeChecked();
await expect(page.getByLabel('Interpretive programs (46)')).not.toBeChecked();
await expect(page.getByLabel('Kayaking (214)')).not.toBeChecked();
await expect(page.getByLabel('Horseback riding (124)')).not.toBeChecked();
await expect(page.getByLabel('Hunting (494)')).not.toBeChecked();
await expect(page.getByLabel('Interpretive programs (44)')).not.toBeChecked();
await expect(page.getByLabel('Kayaking (208)')).not.toBeChecked();
await expect(page.locator('div:nth-child(13) > [id="Pets\\ on\\ leash"]')).not.toBeChecked();
await expect(page.getByLabel('Scuba diving (86)')).not.toBeChecked();
await expect(page.getByLabel('Scuba diving (85)')).not.toBeChecked();
await expect(page.getByRole('group', { name: 'Things to do' }).locator('#Swimming')).not.toBeChecked();
await expect(page.getByLabel('Waterskiing (68)')).not.toBeChecked();
await expect(page.getByLabel('Wildlife viewing (295)')).not.toBeChecked();
await expect(page.getByLabel('Windsurfing (70)')).not.toBeChecked();
await expect(page.getByLabel('Winter recreation (168)')).not.toBeChecked();
await expect(page.getByLabel('Accessibility information (')).not.toBeChecked();
await expect(page.getByLabel('Waterskiing (67)')).not.toBeChecked();
await expect(page.getByLabel('Wildlife viewing (290)')).not.toBeChecked();
await expect(page.getByLabel('Windsurfing (69)')).not.toBeChecked();
await expect(page.getByLabel('Winter recreation (165)')).not.toBeChecked();
await expect(page.getByLabel('Accessibility information (206)')).not.toBeChecked();
await expect(page.getByLabel('Bike park (11)')).not.toBeChecked();
await expect(page.getByLabel('Boat launch (150)')).not.toBeChecked();
await expect(page.getByLabel('Campfires (411)')).not.toBeChecked();
await expect(page.getByLabel('Drinking water (174)')).not.toBeChecked();
await expect(page.getByLabel('Boat launch (145)')).not.toBeChecked();
await expect(page.getByLabel('Campfires (406)')).not.toBeChecked();
await expect(page.getByLabel('Drinking water (171)')).not.toBeChecked();
});

test('Check the A-Z park list redirects to the correct page', async ({page})=>{
Expand All @@ -182,12 +182,4 @@ test.describe('Find a park page tests', async ()=>{
await page.getByRole('button', { name: 'Load more results' }).click();
await expect(page.getByText('Arctic Pacific Lakes ParkOminecasee allOpen').first()).toBeVisible();
});


// Adrianne testing at 4:07PM PST
// Adrianne testing at 4:27PM PST on automated-tests-manuji branch
// Adrianne testing at 4:30PM PST on automated-tests-manuji branch
// Adrianne testing at 5:06PM PST on automated-tests-manuji branch
// adrianne testing push
// adrianne testing at 3:20PM PST
});
15 changes: 7 additions & 8 deletions tests/footer.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,14 @@ test.describe('Footer tests', ()=>{
await page.waitForLoadState('networkidle');
// Click on the Instagram link
await page.getByRole('link', { name: 'Instagram' }).click();
await expect(page).toHaveURL('https://www.instagram.com/yourbcparks/');
/*const instagramURL = page.url();
console.log(`Current URL after clicking Instagram: ${instagramURL}`);
if (instagramURL.includes('login')) {
await page.waitForLoadState('networkidle');

const instagramURL = page.url();
console.log(`Current URL after clicking Instagram: ${instagramURL}`);
if(instagramURL.includes('login')){
console.warn('Redirected to Instagram login page.');
} else {
await page.waitForLoadState('networkidle');
} else{
await expect(page).toHaveURL('https://www.instagram.com/yourbcparks/');
}*/
};
});
});
4 changes: 2 additions & 2 deletions tests/megamenu.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ test.describe('Check the level 1 menu items are displayed, active & clickable',
test('Check the Plan your trip menu item' , async ({page})=>{
await expect(page.getByRole('menuitem', { name: 'Plan your trip' })).toBeVisible();
await page.getByRole('menuitem', { name: 'Plan your trip' }).click();
await expect(page.locator('#home div').filter({ hasText: 'Main Menu BackPlan your' }).nth(4)).toBeVisible();
await expect(page.locator('#home div').filter({ hasText: 'BackPlan your tripActive' }).nth(4)).toBeVisible();
await expect(page.getByRole('menuitem', { name: 'Plan your trip', exact: true })).toBeVisible();
await expect(page.getByRole('menu')).toContainText('Plan your trip');
await expect(page.getByRole('menuitem', { name: 'Active advisories' })).toBeVisible();
Expand All @@ -44,7 +44,7 @@ test.describe('Check the level 1 menu items are displayed, active & clickable',
await expect(page.getByRole('menu')).toContainText('Visit responsibly');
await expect(page.getByRole('menuitem', { name: 'Accessibility' })).toBeVisible();
await expect(page.getByRole('menu')).toContainText('Accessibility');
await page.getByRole('menuitem', { name: 'Plan your trip', exact: true }).click();
await page.getByRole('menuitem',{ name: 'Plan your trip', exact: true }).click();
await expect(page).toHaveURL(baseURL + 'plan-your-trip/');


Expand Down
2 changes: 0 additions & 2 deletions tests/park_operating_date.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,6 @@ test('Check the park information is displayed', async ({page})=>{
await page.waitForLoadState('networkidle');
await page.getByLabel('V', { exact: true}).click();
await expect(page.getByRole('link', { name: 'Vaseux Lake Park'})).toBeVisible();
await expect(page.getByText('Vaseux Lake ParkOpen.The park')).toBeVisible();
await expect(page.getByText('Open.The park is open year-round.')).toBeVisible();
await expect(page.getByRole('cell', { name: 'Vaseux Lake Campground' })).toBeVisible();
});

Expand Down
Loading