-
Notifications
You must be signed in to change notification settings - Fork 4
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
feat: update social links #1295
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
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
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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 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 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,18 @@ | ||
import { test, expect } from "@playwright/test" | ||
import { CoursePage } from "../util" | ||
import { SOCIAL_LINKS } from "../util/constants" | ||
|
||
test("Social links exist and open correct social media pages", async ({ | ||
page | ||
}) => { | ||
const course = new CoursePage(page, "course") | ||
await course.goto() | ||
|
||
for (const [name, url] of SOCIAL_LINKS) { | ||
const link = page | ||
.locator(".footer-main-content") | ||
.getByRole("link", { name, exact: true }) | ||
await expect(link).toBeVisible() | ||
await expect(link).toHaveAttribute("href", url) | ||
} | ||
}) |
This file contains 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 |
---|---|---|
@@ -1,9 +1,27 @@ | ||
import { test, expect } from "@playwright/test" | ||
import { siteUrl } from "../util" | ||
import { WwwPage, siteUrl } from "../util" | ||
import { SOCIAL_LINKS } from "../util/constants" | ||
|
||
test("Course page have title in <head>", async ({ page }) => { | ||
test("Home page has title in <head>", async ({ page }) => { | ||
await page.goto(siteUrl("www")) | ||
await expect(page).toHaveTitle( | ||
"MIT OpenCourseWare | Free Online Course Materials" | ||
) | ||
}) | ||
|
||
test("Social links exist and open correct social media pages", async ({ | ||
page | ||
}) => { | ||
const www = new WwwPage(page) | ||
await www.goto() | ||
|
||
for (const [name, url] of SOCIAL_LINKS) { | ||
for (const location of [".social-icon-row", "#footer-container"]) { | ||
const link = page | ||
.locator(location) | ||
.getByRole("link", { name, exact: true }) | ||
await expect(link).toBeVisible() | ||
await expect(link).toHaveAttribute("href", url) | ||
} | ||
} | ||
}) |
This file contains 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,7 @@ | ||
export const SOCIAL_LINKS = [ | ||
["facebook", /^https:\/\/www.facebook.com\/MITOCW\/?$/], | ||
["instagram", /^https:\/\/www.instagram.com\/mitocw\/?$/], | ||
["x (formerly twitter)", /^https:\/\/twitter.com\/MITOCW\/?$/], | ||
["youtube", /^https:\/\/www.youtube.com\/mitocw\/?$/], | ||
["linkedin", /^https:\/\/www.linkedin.com\/company\/mit-opencourseware\/?$/] | ||
] |
This file contains 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 |
---|---|---|
|
@@ -251,7 +251,7 @@ $searchbox-height: 50px; | |
} | ||
|
||
.social-icon-row { | ||
width: 225px; | ||
width: 270px; | ||
} | ||
|
||
> div { | ||
|
This file contains 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file was deleted.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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.
Originally, I simulated a click and ran assertions on the navigation (i.e. open tab's URL). However, these external links can have uncontrollable behaviors.
For instance, I can open the Instagram link locally without being signed in but, in GitHub Action runner, this URL redirects to the login screen.
For that reason, I have now placed an assertion on the
href
attribute. Feel free to suggest improvements.