mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-28 18:26:54 +00:00
fix(playwright): remove localhost from expected url (#53532)
This commit is contained in:
+14
-16
@@ -1,8 +1,14 @@
|
||||
import { test, expect } from '@playwright/test';
|
||||
|
||||
const breadcrumbNavs = {
|
||||
leftBreadcrumb: '(New) Foundational C# with Microsoft',
|
||||
rightBreadcrumb: 'Write Your First Code Using C#'
|
||||
left: {
|
||||
text: '(New) Foundational C# with Microsoft',
|
||||
url: '/learn/foundational-c-sharp-with-microsoft'
|
||||
},
|
||||
right: {
|
||||
text: 'Write Your First Code Using C#',
|
||||
url: '/learn/foundational-c-sharp-with-microsoft/#write-your-first-code-using-c-sharp'
|
||||
}
|
||||
};
|
||||
|
||||
test.beforeEach(async ({ page }) => {
|
||||
@@ -18,25 +24,19 @@ test.afterEach(async ({ page }) => {
|
||||
test.describe('Challenge Breadcrumb Component Tests', () => {
|
||||
test('breadcrumb nav links should be visible', async ({ page }) => {
|
||||
await expect(
|
||||
page
|
||||
.getByRole('listitem')
|
||||
.filter({ hasText: breadcrumbNavs.leftBreadcrumb })
|
||||
page.getByRole('listitem').filter({ hasText: breadcrumbNavs.left.text })
|
||||
).toBeVisible();
|
||||
await expect(
|
||||
page
|
||||
.getByRole('listitem')
|
||||
.filter({ hasText: breadcrumbNavs.rightBreadcrumb })
|
||||
page.getByRole('listitem').filter({ hasText: breadcrumbNavs.right.text })
|
||||
).toBeVisible();
|
||||
});
|
||||
|
||||
test('left breadcrumb nav link should have correct URL', async ({ page }) => {
|
||||
await page
|
||||
.getByRole('listitem')
|
||||
.filter({ hasText: breadcrumbNavs.leftBreadcrumb })
|
||||
.filter({ hasText: breadcrumbNavs.left.text })
|
||||
.click();
|
||||
await expect(page).toHaveURL(
|
||||
'http://localhost:8000/learn/foundational-c-sharp-with-microsoft'
|
||||
);
|
||||
await expect(page).toHaveURL(breadcrumbNavs.left.url);
|
||||
});
|
||||
|
||||
test('right breadcrumb nav link should have correct URL', async ({
|
||||
@@ -44,10 +44,8 @@ test.describe('Challenge Breadcrumb Component Tests', () => {
|
||||
}) => {
|
||||
await page
|
||||
.getByRole('listitem')
|
||||
.filter({ hasText: breadcrumbNavs.rightBreadcrumb })
|
||||
.filter({ hasText: breadcrumbNavs.right.text })
|
||||
.click();
|
||||
await expect(page).toHaveURL(
|
||||
'http://localhost:8000/learn/foundational-c-sharp-with-microsoft/#write-your-first-code-using-c-sharp'
|
||||
);
|
||||
await expect(page).toHaveURL(breadcrumbNavs.right.url);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
import { test, expect } from '@playwright/test';
|
||||
import translations from '../client/i18n/locales/english/translations.json';
|
||||
|
||||
const timeCalculatorUrl =
|
||||
'/learn/scientific-computing-with-python/scientific-computing-with-python-projects/time-calculator';
|
||||
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await page.goto(
|
||||
'/learn/scientific-computing-with-python/scientific-computing-with-python-projects/arithmetic-formatter'
|
||||
@@ -41,9 +44,7 @@ test.describe('Challenge Completion Modal Tests (Signed Out)', () => {
|
||||
await page
|
||||
.getByRole('button', { name: translations.buttons['go-to-next'] })
|
||||
.click();
|
||||
await expect(page).toHaveURL(
|
||||
'http://localhost:8000/learn/scientific-computing-with-python/scientific-computing-with-python-projects/time-calculator'
|
||||
);
|
||||
await expect(page).toHaveURL(timeCalculatorUrl);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -72,8 +73,6 @@ test.describe('Challenge Completion Modal Tests (Signed In)', () => {
|
||||
await page
|
||||
.getByRole('button', { name: translations.buttons['submit-and-go'] })
|
||||
.click();
|
||||
await expect(page).toHaveURL(
|
||||
'http://localhost:8000/learn/scientific-computing-with-python/scientific-computing-with-python-projects/time-calculator'
|
||||
);
|
||||
await expect(page).toHaveURL(timeCalculatorUrl);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user