From 8181b648d00c4fe7c9ab906f0c898b4abbaf83d4 Mon Sep 17 00:00:00 2001 From: Tawana A Arthur <89936951+tawana0518@users.noreply.github.com> Date: Wed, 8 Mar 2023 20:38:57 -0500 Subject: [PATCH 01/16] Updated line 6 with docker repo --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index 80050ddea..f8bc5479d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,7 +3,7 @@ version: "3.8" services: master_branch: development_branch: - image: kaw393939/mywebclass:development + image: tawanaarthur/project1:development container_name: development_branch pull_policy: always restart: always From 1a2b318102af53e415d0031775f14cfbc7983793 Mon Sep 17 00:00:00 2001 From: Tawana A Arthur <89936951+tawana0518@users.noreply.github.com> Date: Wed, 8 Mar 2023 22:21:19 -0500 Subject: [PATCH 02/16] Updated line 12 with docker repo --- .github/workflows/publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 402eeb701..e61e63f34 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -9,7 +9,7 @@ on: - 'v*' env: - DOCKER_REPO_NAME: kaw393939/mywebclass + DOCKER_REPO_NAME: tawanaarthur/project1 jobs: build: From 936d27717ca5a29cb8817a481d25a0180aba94a2 Mon Sep 17 00:00:00 2001 From: Rajiv Kumar Date: Thu, 16 Mar 2023 22:05:17 -0400 Subject: [PATCH 03/16] added Team_Productivity_Log.md and playwright test mywebclass_privacy.spec.js for privacy policy --- Team_Productivity_Log.md | 13 +++++++++++++ tests/mywebclass_privacy.spec.js | 21 +++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 Team_Productivity_Log.md create mode 100644 tests/mywebclass_privacy.spec.js diff --git a/Team_Productivity_Log.md b/Team_Productivity_Log.md new file mode 100644 index 000000000..7b4ee8423 --- /dev/null +++ b/Team_Productivity_Log.md @@ -0,0 +1,13 @@ +# Team Productivity Log + +This table tracks the progress of tasks in our project, including the issue title, story points, issue link, status, assigned to and assigned on, completed on, category, and status notes. + +| Issue title | Story points | Issue link | Status | Assigned to, Assigned on | Completed on | Category | Status notes | +|------------------------------------------|--------------|-----------------------------------------------------------------------|-------------|--------------------------|--------------|---------------|----------------------------------------------------------| +| Team Productivity Log | 1 | [Link](https://github.com/tawana0518/mywebclass-simulation/issues/11) | Completed | Rajiv, 2022-03-16 | 2022-03-16 | Documentation | Completed documenting Marked Down File | +| Internationalization Research | 2 | [Link](https://github.com/tawana0518/mywebclass-simulation/issues/3) | In Progress | Rajiv, 2022-03-15 | - | Research | Drafted initial version on Internationalization Research | +| Home Page | 5 | [Link](https://github.com/tawana0518/mywebclass-simulation/issues/2) | In Progress | Rajiv, 2022-03-14 | - | Enhancement | Initial analysis in progress | +| Front End Responsive Frameworks Research | 3 | [Link](https://github.com/tawana0518/mywebclass-simulation/issues/13) | To do | John, 2022-03-16 | - | Research | | + +To add a new task to the table, a team member should create an issue on GitHub and add the link to the table with the relevant details. By keeping track of our progress in this table, we can ensure that tasks are assigned and completed efficiently and effectively. + diff --git a/tests/mywebclass_privacy.spec.js b/tests/mywebclass_privacy.spec.js new file mode 100644 index 000000000..36b3676fd --- /dev/null +++ b/tests/mywebclass_privacy.spec.js @@ -0,0 +1,21 @@ +/* global localStorage */ +import { test, expect } from '@playwright/test' + +test('test', async ({ page }) => { + await page.goto('http://localhost:3000/') + await page.getByRole('button', { name: 'Agree', exact: true }).click() + + // Retrieve the privacyPolicyAgreed item from local storage + const privacyPolicyAgreed = await page.evaluate(() => { + return localStorage.getItem('privacyPolicyAgreed') + }) + + // Check if privacyPolicyAgreed is set in local storage + expect(privacyPolicyAgreed).toBeTruthy() + + // Click the "Content Template" link + await page.getByRole('link', { name: 'Content Template' }).click() + + // Click the "Section 3" link + await page.getByRole('link', { name: 'Section 3' }).click() +}) From 9d1bf793d05af04e91612aaded1af70b7f5d68c2 Mon Sep 17 00:00:00 2001 From: Rajiv Kumar <111255700+rk864@users.noreply.github.com> Date: Thu, 16 Mar 2023 22:12:15 -0400 Subject: [PATCH 04/16] Update Team_Productivity_Log.md Minor change in Assigned --- Team_Productivity_Log.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Team_Productivity_Log.md b/Team_Productivity_Log.md index 7b4ee8423..3c0f92c9e 100644 --- a/Team_Productivity_Log.md +++ b/Team_Productivity_Log.md @@ -7,7 +7,7 @@ This table tracks the progress of tasks in our project, including the issue titl | Team Productivity Log | 1 | [Link](https://github.com/tawana0518/mywebclass-simulation/issues/11) | Completed | Rajiv, 2022-03-16 | 2022-03-16 | Documentation | Completed documenting Marked Down File | | Internationalization Research | 2 | [Link](https://github.com/tawana0518/mywebclass-simulation/issues/3) | In Progress | Rajiv, 2022-03-15 | - | Research | Drafted initial version on Internationalization Research | | Home Page | 5 | [Link](https://github.com/tawana0518/mywebclass-simulation/issues/2) | In Progress | Rajiv, 2022-03-14 | - | Enhancement | Initial analysis in progress | -| Front End Responsive Frameworks Research | 3 | [Link](https://github.com/tawana0518/mywebclass-simulation/issues/13) | To do | John, 2022-03-16 | - | Research | | +| Front End Responsive Frameworks Research | 3 | [Link](https://github.com/tawana0518/mywebclass-simulation/issues/13) | To do | Rajiv, 2022-03-16 | - | Research | | To add a new task to the table, a team member should create an issue on GitHub and add the link to the table with the relevant details. By keeping track of our progress in this table, we can ensure that tasks are assigned and completed efficiently and effectively. From 9fda2c08f046578b3c132876cf4d0ebf0e17ee4c Mon Sep 17 00:00:00 2001 From: bmarani <123278350+bmarani@users.noreply.github.com> Date: Fri, 17 Mar 2023 12:10:32 -0400 Subject: [PATCH 05/16] Update Team_Productivity_Log.md --- Team_Productivity_Log.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Team_Productivity_Log.md b/Team_Productivity_Log.md index 3c0f92c9e..ebc9b9da1 100644 --- a/Team_Productivity_Log.md +++ b/Team_Productivity_Log.md @@ -8,6 +8,7 @@ This table tracks the progress of tasks in our project, including the issue titl | Internationalization Research | 2 | [Link](https://github.com/tawana0518/mywebclass-simulation/issues/3) | In Progress | Rajiv, 2022-03-15 | - | Research | Drafted initial version on Internationalization Research | | Home Page | 5 | [Link](https://github.com/tawana0518/mywebclass-simulation/issues/2) | In Progress | Rajiv, 2022-03-14 | - | Enhancement | Initial analysis in progress | | Front End Responsive Frameworks Research | 3 | [Link](https://github.com/tawana0518/mywebclass-simulation/issues/13) | To do | Rajiv, 2022-03-16 | - | Research | | - +| Accessibility Research | 2 | [Link](https://github.com/tawana0518/mywebclass-simulation/issues/4) | Completed | Berta, 2022-03-14 | 2022-03-15 | Research | Drafted initial version on Accessibility Research | +| Legal compliance Research | 2 | [Link](https://github.com/tawana0518/mywebclass-simulation/issues/6) | Completed | Berta, 2022-03-14 | 2022-03-15 | Research | Drafted initial version for legal compliance and privacy policy Research | To add a new task to the table, a team member should create an issue on GitHub and add the link to the table with the relevant details. By keeping track of our progress in this table, we can ensure that tasks are assigned and completed efficiently and effectively. From 752e9bad7d8d818bbb3b4efeb7c9791dfab7ce45 Mon Sep 17 00:00:00 2001 From: Tawana A Arthur <89936951+tawana0518@users.noreply.github.com> Date: Fri, 17 Mar 2023 21:00:34 -0400 Subject: [PATCH 06/16] Update Team_Productivity_Log.md Adding issue 4 into table --- Team_Productivity_Log.md | 1 + 1 file changed, 1 insertion(+) diff --git a/Team_Productivity_Log.md b/Team_Productivity_Log.md index ebc9b9da1..2efa73fe8 100644 --- a/Team_Productivity_Log.md +++ b/Team_Productivity_Log.md @@ -10,5 +10,6 @@ This table tracks the progress of tasks in our project, including the issue titl | Front End Responsive Frameworks Research | 3 | [Link](https://github.com/tawana0518/mywebclass-simulation/issues/13) | To do | Rajiv, 2022-03-16 | - | Research | | | Accessibility Research | 2 | [Link](https://github.com/tawana0518/mywebclass-simulation/issues/4) | Completed | Berta, 2022-03-14 | 2022-03-15 | Research | Drafted initial version on Accessibility Research | | Legal compliance Research | 2 | [Link](https://github.com/tawana0518/mywebclass-simulation/issues/6) | Completed | Berta, 2022-03-14 | 2022-03-15 | Research | Drafted initial version for legal compliance and privacy policy Research | +| SEO research | 2 | [Link](https://github.com/tawana0518/mywebclass-simulation/issues/5) | Completed | Tawana, 2022-03-14 | 2022-03-15 | Research | Researched and draft SEO Research - found in Wiki | To add a new task to the table, a team member should create an issue on GitHub and add the link to the table with the relevant details. By keeping track of our progress in this table, we can ensure that tasks are assigned and completed efficiently and effectively. From b895929b2da50cd0172934b9538503d03e935a12 Mon Sep 17 00:00:00 2001 From: Tawana A Arthur <89936951+tawana0518@users.noreply.github.com> Date: Fri, 17 Mar 2023 21:05:38 -0400 Subject: [PATCH 07/16] Updating table with issue 12 --- Team_Productivity_Log.md | 1 + 1 file changed, 1 insertion(+) diff --git a/Team_Productivity_Log.md b/Team_Productivity_Log.md index 2efa73fe8..19be32ef7 100644 --- a/Team_Productivity_Log.md +++ b/Team_Productivity_Log.md @@ -11,5 +11,6 @@ This table tracks the progress of tasks in our project, including the issue titl | Accessibility Research | 2 | [Link](https://github.com/tawana0518/mywebclass-simulation/issues/4) | Completed | Berta, 2022-03-14 | 2022-03-15 | Research | Drafted initial version on Accessibility Research | | Legal compliance Research | 2 | [Link](https://github.com/tawana0518/mywebclass-simulation/issues/6) | Completed | Berta, 2022-03-14 | 2022-03-15 | Research | Drafted initial version for legal compliance and privacy policy Research | | SEO research | 2 | [Link](https://github.com/tawana0518/mywebclass-simulation/issues/5) | Completed | Tawana, 2022-03-14 | 2022-03-15 | Research | Researched and draft SEO Research - found in Wiki | +|Playwright Tests Research | 3 | [Link] (https://github.com/tawana0518/mywebclass-simulation/issues/12) | In progress | Tawana, 2022-03-17 | - | Research | Continuing research on playwright testing and lighthouse reports | To add a new task to the table, a team member should create an issue on GitHub and add the link to the table with the relevant details. By keeping track of our progress in this table, we can ensure that tasks are assigned and completed efficiently and effectively. From bba724c1b5970df3d4409522c86ca68d22407409 Mon Sep 17 00:00:00 2001 From: Tawana A Arthur <89936951+tawana0518@users.noreply.github.com> Date: Fri, 17 Mar 2023 21:06:16 -0400 Subject: [PATCH 08/16] Update Team_Productivity_Log.md --- Team_Productivity_Log.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Team_Productivity_Log.md b/Team_Productivity_Log.md index 19be32ef7..fc3abad51 100644 --- a/Team_Productivity_Log.md +++ b/Team_Productivity_Log.md @@ -11,6 +11,6 @@ This table tracks the progress of tasks in our project, including the issue titl | Accessibility Research | 2 | [Link](https://github.com/tawana0518/mywebclass-simulation/issues/4) | Completed | Berta, 2022-03-14 | 2022-03-15 | Research | Drafted initial version on Accessibility Research | | Legal compliance Research | 2 | [Link](https://github.com/tawana0518/mywebclass-simulation/issues/6) | Completed | Berta, 2022-03-14 | 2022-03-15 | Research | Drafted initial version for legal compliance and privacy policy Research | | SEO research | 2 | [Link](https://github.com/tawana0518/mywebclass-simulation/issues/5) | Completed | Tawana, 2022-03-14 | 2022-03-15 | Research | Researched and draft SEO Research - found in Wiki | -|Playwright Tests Research | 3 | [Link] (https://github.com/tawana0518/mywebclass-simulation/issues/12) | In progress | Tawana, 2022-03-17 | - | Research | Continuing research on playwright testing and lighthouse reports | +|Playwright Tests Research | 3 | [Link](https://github.com/tawana0518/mywebclass-simulation/issues/12) | In progress | Tawana, 2022-03-17 | - | Research | Continuing research on playwright testing and lighthouse reports | To add a new task to the table, a team member should create an issue on GitHub and add the link to the table with the relevant details. By keeping track of our progress in this table, we can ensure that tasks are assigned and completed efficiently and effectively. From 1c4025a7fb4e716a1f986013ff2c65da15f0ce02 Mon Sep 17 00:00:00 2001 From: Rajiv Kumar Date: Sun, 19 Mar 2023 09:47:59 -0400 Subject: [PATCH 09/16] Update Package.Json to point to my team project repository --- package.json | 8 +-- tests/mywebclass_internationalization.spec.js | 56 +++++++++++++++++++ 2 files changed, 60 insertions(+), 4 deletions(-) create mode 100644 tests/mywebclass_internationalization.spec.js diff --git a/package.json b/package.json index 9a0bbb78d..fd7eb9d2b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mywebclass.org", - "version": "0.1.0", + "version": "0.1.1", "description": "Help for students and teachers learning advanced technologies.", "main": "src/index.js", "directories": { @@ -25,14 +25,14 @@ }, "repository": { "type": "git", - "url": "git+https://github.com/NJIT-WIS/mywebclass.git" + "url": "git+https://github.com/tawana0518/mywebclass-simulation.git" }, "author": "Keith Williams @ NJIT.EDU", "license": "MIT", "bugs": { - "url": "https://github.com/NJIT-WIS/mywebclass/issues" + "url": "https://github.com/tawana0518/mywebclass-simulation/issues" }, - "homepage": "https://github.com/NJIT-WIS/mywebclass#readme", + "homepage": "https://github.com/tawana0518/mywebclass-simulation#readme", "devDependencies": { "@playwright/test": "^1.31.1", "autoprefixer": "^10.4.13", diff --git a/tests/mywebclass_internationalization.spec.js b/tests/mywebclass_internationalization.spec.js new file mode 100644 index 000000000..25485c036 --- /dev/null +++ b/tests/mywebclass_internationalization.spec.js @@ -0,0 +1,56 @@ +// In this test script, +// we set the Accept-Language header to different languages using a loop and +// verify that the header changes to the desired language for each iteration. +// You can modify this test script as per your requirements to test the internationalization of the website using Playwright. + +// After running the command "npm run test" for the above test script, a new instance of the browser will open, and the test script will start executing automatically. +// You don't need to click anything in the browser during the test execution as Playwright will automate all the user interactions required for the test. +// Once the test execution is complete, the browser will automatically close, and you will see the test results in the command prompt or terminal window where you executed the "npm run test" command. +// You can also customize the test runner to output the results to a file or generate a report, depending on your requirements. The documentation for Playwright Test provides more information on how to customize the test runner output. + +import { test, expect } from '@playwright/test' + +const languages = ['fr', 'es', 'en'] // Add other languages as needed + +test.describe('MyWebClass.org internationalization', () => { + let page + + test.beforeEach(async ({ browser }) => { + page = await browser.newPage() + await page.goto('https://www.mywebclass.org') + }) + + test.afterEach(async () => { + await page.close() + }) + + for (const lang of languages) { + test(`should display the site in ${lang} when the "Accept-Language" header is set to "${lang}"`, async () => { + // Set the Accept-Language header and navigate to the website + await page.setExtraHTTPHeaders({ 'Accept-Language': lang }) + await page.goto('https://www.mywebclass.org') + + // Check if the website is blocking the Accept-Language header or redirecting to a different language version + const pageUrl = page.url() + const expectedUrl = `https://www.mywebclass.org/${lang}/` + expect(pageUrl).toContain(expectedUrl, `Page URL does not match expected URL for language ${lang}. Actual URL: ${pageUrl}`) + + // Wait for the language selector button to be present and click it + const languageSelectorButton = await page.waitForSelector('.language-selector', { timeout: 5000 }) + expect(languageSelectorButton).not.toBeNull('Could not find language selector button.') + await languageSelectorButton.click() + + // Wait for the language option to be present and click it + const languageOption = await page.waitForSelector(`.language-selector a[hreflang="${lang}"]`, { timeout: 5000 }) + expect(languageOption).not.toBeNull(`Could not find language option for ${lang}.`) + await languageOption.click() + + // Wait for the page to reload and check that the language selector button reflects the current language + await page.waitForNavigation() + const languageElement = await page.waitForSelector('.language-selector .active', { timeout: 5000 }) + expect(languageElement).not.toBeNull('Could not find active language element.') + const languageText = await languageElement.textContent() + expect(languageText.toLowerCase()).toContain(lang, `Language selector does not reflect language ${lang}.`) + }) + } +}) From 9c19167c0a6674ec9ee01bfb4fe7fb59bcbd9c50 Mon Sep 17 00:00:00 2001 From: Rajiv Kumar <111255700+rk864@users.noreply.github.com> Date: Sun, 19 Mar 2023 09:57:17 -0400 Subject: [PATCH 10/16] Delete mywebclass_internationalization.spec.js I am deleting this file and will fix it later with local merge. This is only Playwright test script. --- tests/mywebclass_internationalization.spec.js | 56 ------------------- 1 file changed, 56 deletions(-) delete mode 100644 tests/mywebclass_internationalization.spec.js diff --git a/tests/mywebclass_internationalization.spec.js b/tests/mywebclass_internationalization.spec.js deleted file mode 100644 index 25485c036..000000000 --- a/tests/mywebclass_internationalization.spec.js +++ /dev/null @@ -1,56 +0,0 @@ -// In this test script, -// we set the Accept-Language header to different languages using a loop and -// verify that the header changes to the desired language for each iteration. -// You can modify this test script as per your requirements to test the internationalization of the website using Playwright. - -// After running the command "npm run test" for the above test script, a new instance of the browser will open, and the test script will start executing automatically. -// You don't need to click anything in the browser during the test execution as Playwright will automate all the user interactions required for the test. -// Once the test execution is complete, the browser will automatically close, and you will see the test results in the command prompt or terminal window where you executed the "npm run test" command. -// You can also customize the test runner to output the results to a file or generate a report, depending on your requirements. The documentation for Playwright Test provides more information on how to customize the test runner output. - -import { test, expect } from '@playwright/test' - -const languages = ['fr', 'es', 'en'] // Add other languages as needed - -test.describe('MyWebClass.org internationalization', () => { - let page - - test.beforeEach(async ({ browser }) => { - page = await browser.newPage() - await page.goto('https://www.mywebclass.org') - }) - - test.afterEach(async () => { - await page.close() - }) - - for (const lang of languages) { - test(`should display the site in ${lang} when the "Accept-Language" header is set to "${lang}"`, async () => { - // Set the Accept-Language header and navigate to the website - await page.setExtraHTTPHeaders({ 'Accept-Language': lang }) - await page.goto('https://www.mywebclass.org') - - // Check if the website is blocking the Accept-Language header or redirecting to a different language version - const pageUrl = page.url() - const expectedUrl = `https://www.mywebclass.org/${lang}/` - expect(pageUrl).toContain(expectedUrl, `Page URL does not match expected URL for language ${lang}. Actual URL: ${pageUrl}`) - - // Wait for the language selector button to be present and click it - const languageSelectorButton = await page.waitForSelector('.language-selector', { timeout: 5000 }) - expect(languageSelectorButton).not.toBeNull('Could not find language selector button.') - await languageSelectorButton.click() - - // Wait for the language option to be present and click it - const languageOption = await page.waitForSelector(`.language-selector a[hreflang="${lang}"]`, { timeout: 5000 }) - expect(languageOption).not.toBeNull(`Could not find language option for ${lang}.`) - await languageOption.click() - - // Wait for the page to reload and check that the language selector button reflects the current language - await page.waitForNavigation() - const languageElement = await page.waitForSelector('.language-selector .active', { timeout: 5000 }) - expect(languageElement).not.toBeNull('Could not find active language element.') - const languageText = await languageElement.textContent() - expect(languageText.toLowerCase()).toContain(lang, `Language selector does not reflect language ${lang}.`) - }) - } -}) From d46fb1fb3b68c197fb98290c4afc394ec58bd6d6 Mon Sep 17 00:00:00 2001 From: Rajiv Kumar Date: Sun, 19 Mar 2023 14:37:35 -0400 Subject: [PATCH 11/16] Completing Internatinalization Reseach for Sprint1 with changes in index.html, main.js --- package-lock.json | 4 +-- src/index.html | 1 + src/js/main.js | 14 ++++++++++ tests/mywebclass_internationalization.spec.js | 26 +++++++++++++++++++ 4 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 tests/mywebclass_internationalization.spec.js diff --git a/package-lock.json b/package-lock.json index ff94ff7f0..daec82f8e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "mywebclass.org", - "version": "0.1.0", + "version": "0.1.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "mywebclass.org", - "version": "0.1.0", + "version": "0.1.1", "license": "MIT", "dependencies": { "@popperjs/core": "^2.11.6" diff --git a/src/index.html b/src/index.html index ad76fc58c..b069be521 100644 --- a/src/index.html +++ b/src/index.html @@ -1,4 +1,5 @@ + diff --git a/src/js/main.js b/src/js/main.js index 1558c49d5..c7fe348c5 100644 --- a/src/js/main.js +++ b/src/js/main.js @@ -8,6 +8,8 @@ import allPage from './allPages' import contentPage from './contentPage' document.addEventListener('DOMContentLoaded', () => { + // @Rajiv 19th March - Call the setLanguage() function when the DOM content is loaded + setLanguage() allPage.initialize() contentPage.initialize() }) @@ -109,3 +111,15 @@ document.addEventListener('DOMContentLoaded', () => { createPrivacyModal() loadGoogleAnalytics() }) + +// @Rajiv 19th March - Create a JavaScript function in the main.js file to set the language attribute dynamically based on the user's language preference: +function setLanguage () { + // Get the user's preferred language + const userLang = navigator.language || navigator.userLanguage + + // Check if the user's language is supported (in this example, we're checking for English) + const supportedLang = userLang.substring(0, 2).toLowerCase() === 'en' ? 'en' : 'en' + + // Set the 'lang' attribute of the 'html' tag to the supported language + document.documentElement.setAttribute('lang', supportedLang) +} diff --git a/tests/mywebclass_internationalization.spec.js b/tests/mywebclass_internationalization.spec.js new file mode 100644 index 000000000..8d7389866 --- /dev/null +++ b/tests/mywebclass_internationalization.spec.js @@ -0,0 +1,26 @@ +import { test, expect } from '@playwright/test' + +test.describe('MyWebClass.org internationalization', () => { + let page + + test.beforeEach(async ({ browser }) => { + page = await browser.newPage() + await page.goto('http://localhost:3000') + }) + + test.afterEach(async () => { + await page.close() + }) + + test('should display the site in "en" when the "Accept-Language" header is set to "en"', async () => { + // Set the Accept-Language header and navigate to the website + await page.setExtraHTTPHeaders({ 'Accept-Language': 'en' }) + await page.goto('http://localhost:3000') + + // Check if the lang attribute of the HTML tag is set to "en" + const langAttribute = await page.getAttribute('html', 'lang') + expect(langAttribute).toBe('en', 'The lang attribute of the HTML tag is not set to "en".') + + // Perform any additional checks for the "en" language version of the website here, e.g., checking specific text or elements + }) +}) From 543e6f7620fe09544cee0881ff327e8d29633cc4 Mon Sep 17 00:00:00 2001 From: Tawana Arthur Date: Sun, 19 Mar 2023 17:50:24 -0400 Subject: [PATCH 12/16] create playwright test script based on SEO research. I will need to add mobile friendliness once Bootstrap code is in the files --- src/scss/styles.scss | 2 ++ tests/mywebclass_seo.spec.js | 27 +++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 tests/mywebclass_seo.spec.js diff --git a/src/scss/styles.scss b/src/scss/styles.scss index 309c1d9d5..259321c3e 100644 --- a/src/scss/styles.scss +++ b/src/scss/styles.scss @@ -26,4 +26,6 @@ body.banner-offset { } } + + \ No newline at end of file diff --git a/tests/mywebclass_seo.spec.js b/tests/mywebclass_seo.spec.js new file mode 100644 index 000000000..9de5d80a9 --- /dev/null +++ b/tests/mywebclass_seo.spec.js @@ -0,0 +1,27 @@ +import { test, expect } from '@playwright/test' + +test.describe('MyWebClass.org tests', () => { + test('SEO tests', async ({ page }) => { + await page.goto('http://localhost:3000/') + // Test for keyword research + const keywords = ['MyWebClass.org'] + const pageContent = await page.textContent('body') + const hasKeywords = keywords.every(keyword => pageContent.includes(keyword)) + expect(hasKeywords).toBeTruthy() + // Test for meta tags + const pageTitle = await page.title() + const pageMetaDescription = await page.$eval('meta[name="description"]', el => el.content) + const pageMetaKeywords = await page.$eval('meta[name="keywords"]', el => el.content) + const hasMetaTags = Boolean(pageTitle && pageMetaDescription && pageMetaKeywords) + expect(hasMetaTags).toBeTruthy() + // Test for URL structure + const pageUrl = page.url() + const pageUrlPathname = new URL(pageUrl).pathname + const hasProperUrlStructure = Boolean(pageUrl && !pageUrl.includes('%20') && pageUrlPathname === '/') + expect(hasProperUrlStructure).toBeTruthy() + // Test for fast load times + const pageLoadTime = await page.evaluate(() => window.performance.timing.domContentLoadedEventEnd - window.performance.timing.navigationStart) + const isFastLoading = pageLoadTime <= 3000 + expect(isFastLoading).toBeTruthy() + }) +}) From b17aee2a27c7d04c8571607d7c5ff2b1d1688c1a Mon Sep 17 00:00:00 2001 From: Tawana Arthur Date: Mon, 20 Mar 2023 20:47:21 -0400 Subject: [PATCH 13/16] Updated privacy html file with correct title --- src/privacy.html | 2 +- tests/mywebclass_seo.spec.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/privacy.html b/src/privacy.html index 9337f1b6c..2e5ad87fc 100644 --- a/src/privacy.html +++ b/src/privacy.html @@ -4,7 +4,7 @@ - MyWebClass.org | Our Story + MyWebClass.org | Privacy Policy diff --git a/tests/mywebclass_seo.spec.js b/tests/mywebclass_seo.spec.js index 9de5d80a9..f877ee30b 100644 --- a/tests/mywebclass_seo.spec.js +++ b/tests/mywebclass_seo.spec.js @@ -21,7 +21,7 @@ test.describe('MyWebClass.org tests', () => { expect(hasProperUrlStructure).toBeTruthy() // Test for fast load times const pageLoadTime = await page.evaluate(() => window.performance.timing.domContentLoadedEventEnd - window.performance.timing.navigationStart) - const isFastLoading = pageLoadTime <= 3000 + const isFastLoading = pageLoadTime <= 5000 expect(isFastLoading).toBeTruthy() }) }) From a722ef252a2cac32d1ac59a7d8ddae9c838cf220 Mon Sep 17 00:00:00 2001 From: bmarani Date: Mon, 20 Mar 2023 21:05:44 -0400 Subject: [PATCH 14/16] updated privacy policy --- src/privacy.html | 74 +++++++++++++++++++++--------------------------- 1 file changed, 33 insertions(+), 41 deletions(-) diff --git a/src/privacy.html b/src/privacy.html index 9337f1b6c..d04723b7a 100644 --- a/src/privacy.html +++ b/src/privacy.html @@ -72,22 +72,19 @@

Navigation

Privacy Policy

By Author Name Last Updated: - January 1, 2022 0 + March 19, 2023 0

Privacy Policy

-

We at mywebclass.org are committed to protecting your privacy. This Privacy Policy explains what - information we collect from you when you visit our website, how we use it, and how we protect - it. By using our website, you agree to the terms of this Privacy Policy.

+

We at MyWebClass are committed to protecting your privacy. This privacy policy explains how we + collect, use, and protect your personal information when you use our website.

Information we collect

-

We may collect the following information from you when you visit our website:

+

We may collect personal information from you when you visit our website, such as:

    -
  • Personal information such as your name and email address, if you choose to provide it to - us. +
  • your name,
  • -
  • Information about your use of the website, such as pages visited, time spent on the site, - and links clicked. +
  • email address,
  • Information about your device, such as your IP address, browser type, and operating system. @@ -96,49 +93,44 @@

    Information we collect

    How we use your information

    We use the information we collect from you for the following purposes:

      -
    • To improve our website and the user experience.
    • -
    • To analyze user behavior and measure the effectiveness of our content and marketing - efforts. +
    • To provide you with the services and products you have requested
    • +
    • To communicate with you about our services and products
    • -
    • To communicate with you about our products and services, if you have provided us with your - contact information. +
    • To improve our website and services
    • -
    • To comply with legal obligations.
    • +
    • To comply with legal obligations
    • +
    • to send you marketing communications, such as newsletters or promotional offers, if you have provided your consent.
    +

    Sharing of Information

    +

    We do not sell, rent, or trade your personal information to third parties. However, we may share + your personal information with third-party service providers who assist us in providing our services and products to you.

    +

    Security Measures

    +

    We take reasonable measures to protect your personal information from unauthorized access, use, or disclosure. + However, we cannot guarantee the security of your information, as no method of transmission over the internet is completely secure.

    +

    Accessibility Policy

    +

    We are committed to ensuring that our website is accessible to everyone, including individuals with disabilities. + We strive to comply with the Web Content Accessibility Guidelines (WCAG) 2.1 Level AA.

    Google Analytics

    -

    We use Google Analytics to collect information about your use of our website. Google Analytics - collects information such as how often users visit the site, what pages they visit when they do - so, and what other sites they used prior to coming to our website. We use the information we get - from Google Analytics to improve our website and the user experience. Google Analytics collects - only the IP address assigned to you on the date you visit our website, rather than your name or - other identifying information. We do not combine the information collected through the use of - Google Analytics with personally identifiable information. Google Analytics plants a permanent - cookie on your web browser to identify you as a unique user the next time you visit our website. - This cookie cannot be used by anyone other than Google. Google’s ability to use and share - information collected by Google Analytics about your visits to our website is restricted by the - Google Analytics Terms of Use and the Google Privacy Policy.

    -

    Data retention and security

    -

    We retain the information we collect for as long as necessary to fulfill the purposes for which - it was collected, unless a longer retention period is required by law. We take reasonable - measures to protect the information we collect from loss, theft, misuse, and unauthorized - access, disclosure, alteration, and destruction.

    +

    We use Google Analytics to help analyze how users use our website. The tool uses cookies to collect + standard Internet log information and visitor behavior information in an anonymous form. The information + generated by the cookie about your use of the website (including IP address) is transmitted to Google. + This information is then used to evaluate visitors' use of the website and to compile statistical + reports on website activity for us.

    Data retention and security

    We retain the information we collect for as long as necessary to fulfill the purposes for which it was collected, unless a longer retention period is required by law. We take reasonable measures to protect the information we collect from loss, theft, misuse, and unauthorized access, disclosure, alteration, and destruction.

    Your rights

    -

    You have the right to access, correct, and delete your personal information. You also have the - right to object to the processing of your personal information and to withdraw your consent to - the processing of your personal information. To exercise these rights, please contact us at - [contact email address].

    -

    Changes to this Privacy Policy

    -

    We may update this Privacy Policy from time to time. We will notify you of any changes by posting - the new Privacy Policy on this page. We recommend that you review this Privacy Policy - periodically for any changes.

    +

    You have the right to access, modify, or delete your personal information. You may also withdraw + your consent to receive marketing communications from us at any time. To exercise these rights, + please contact us using the contact information provided below.

    +

    Changes to This Policy

    +

    We may update this privacy policy from time to time. Any changes will be posted on this page, and + the date at the top of the page will indicate when the policy was last updated.

    Contact us

    -

    If you have any questions about this Privacy Policy, please contact us at [contact email - address].

    +

    If you have any questions or concerns about our privacy policy or the handling of your personal + information, please contact us at NJIT.edu.

From 083f2e1b44c27bb0e967459d02abb16e22e9dffa Mon Sep 17 00:00:00 2001 From: Rajiv Kumar Date: Mon, 20 Mar 2023 21:42:16 -0400 Subject: [PATCH 15/16] Closing my research on Frontend and Bootstrap, tested with Playwright on bottstrap implementations --- tests/bootstrap.spec.js | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 tests/bootstrap.spec.js diff --git a/tests/bootstrap.spec.js b/tests/bootstrap.spec.js new file mode 100644 index 000000000..613c5e7b6 --- /dev/null +++ b/tests/bootstrap.spec.js @@ -0,0 +1,32 @@ +const { test, expect } = require('@playwright/test') + +test.describe('MyWebClass.org Bootstrap implementation', () => { + test.beforeEach(async ({ page }) => { + await page.goto('https://mywebclass.org') + }) + + // test('should have a responsive navigation bar', async ({ page }) => { + // const navbar = await page.waitForSelector('.navbar', { state: 'visible', timeout: 10000 }) + // expect(navbar).toBeTruthy() + // + // await page.setViewportSize({ width: 320, height: 480 }) // Simulate a mobile device + // + // const navbarToggler = await page.waitForSelector('.navbar-toggler', { state: 'visible', timeout: 10000 }) + // expect(navbarToggler).toBeTruthy() + // + // const isNavbarCollapsed = await navbarToggler.evaluate(toggler => toggler.getAttribute('aria-expanded') === 'false') + // expect(isNavbarCollapsed).toBeTruthy() + // + // await navbarToggler.click() + // const isNavbarExpanded = await navbarToggler.evaluate(toggler => toggler.getAttribute('aria-expanded') === 'true') + // expect(isNavbarExpanded).toBeTruthy() + // }) + + test('should have a footer with py-5 class for padding', async ({ page }) => { + const footer = await page.waitForSelector('footer', { state: 'visible', timeout: 10000 }) + expect(footer).toBeTruthy() + + const footerPadding = await footer.evaluate(footerElement => footerElement.classList.contains('py-5')) + expect(footerPadding).toBeTruthy() + }) +}) From 4514ff893428d5c248a1ca067052c6164169b04c Mon Sep 17 00:00:00 2001 From: Tawana Arthur Date: Mon, 20 Mar 2023 22:32:06 -0400 Subject: [PATCH 16/16] Added project deployment link to readme file --- readme.md | 1 + 1 file changed, 1 insertion(+) diff --git a/readme.md b/readme.md index b85863e93..a69e96886 100644 --- a/readme.md +++ b/readme.md @@ -63,3 +63,4 @@ Finally, use Playwright to create powerful and reliable automated tests for web # ADD YOUR PROJECT LINKS BELOW THIS +[Github Pages Live Site Deployment](https://tawana0518.github.io/mywebclass-simulation/)