-
Notifications
You must be signed in to change notification settings - Fork 117
solution #92
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
base: main
Are you sure you want to change the base?
solution #92
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
node_modules/ | ||
/test-results/ | ||
/playwright-report/ | ||
/playwright/.cache/ |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's recommended to use an LTS version of Node.js for better stability and long-term support. Consider changing the node-version to 16 instead of 18. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice usage of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Great job setting up the GitHub Actions workflow! It's well-structured and easy to understand. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: JobSimulator.dev Test Checker | ||
|
||
on: | ||
push: | ||
branches: ["main"] | ||
pull_request: | ||
branches: ["main"] | ||
|
||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
container: | ||
image: mcr.microsoft.com/playwright:v1.31.0-focal | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
- name: Install dependencies | ||
run: npm ci && cd .github/workflows && npm ci && cd ../.. | ||
|
||
- name: build app | ||
run: npx webpack | ||
|
||
- name: start webpack server | ||
run: npx webpack serve & | ||
|
||
- name: start backend | ||
run: npm run start-json-server & | ||
|
||
- name: Run Tests | ||
run: node .github/workflows/test.js |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It looks like you've added a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems like the package-lock.json file has been added inside the .github/workflows directory. Please move it to the root of the project, as it should be placed alongside the package.json file. |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"type": "module", | ||
"devDependencies": { | ||
"playwright": "^1.31.1", | ||
"uvu": "^0.5.6" | ||
}, | ||
"scripts": {} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
import { chromium } from "playwright"; | ||
import { setTimeout } from "timers/promises"; | ||
import { test } from "uvu"; | ||
import * as assert from "uvu/assert"; | ||
|
||
let browser; | ||
let context; | ||
let page; | ||
|
||
test.before(async () => { | ||
browser = await chromium.launch({ | ||
use: { timezoneId: "Etc/UTC" }, | ||
}); | ||
context = await browser.newContext(); | ||
}); | ||
|
||
test.before.each(async () => { | ||
page = await context.newPage(); | ||
}); | ||
|
||
test.after.each(async () => { | ||
await page.close(); | ||
}); | ||
|
||
test.after(async () => { | ||
await browser.close(); | ||
await context.close(); | ||
}); | ||
|
||
test("Solved Issue #1: Company Names are Present", async () => { | ||
await page.goto("http://localhost:8080"); | ||
await setTimeout(250); | ||
|
||
var text = await page.$eval("body > table > tbody > tr:nth-child(2) > td:nth-child(1)", (el) => el.textContent); | ||
assert.type(text, "string"); | ||
assert.is(text, "Fusion LLC"); | ||
|
||
var text = await page.$eval("body > table > tbody > tr:nth-child(3) > td:nth-child(1)", (el) => el.textContent); | ||
assert.type(text, "string"); | ||
assert.is(text, "Techopolis Ltd."); | ||
|
||
var text = await page.$eval("body > table > tbody > tr:nth-child(4) > td:nth-child(1)", (el) => el.textContent); | ||
assert.type(text, "string"); | ||
assert.is(text, "Code learning LLC"); | ||
}); | ||
|
||
test("Solved Issue #2: display dates in 24-hour time format", async () => { | ||
await page.goto("http://localhost:8080"); | ||
await setTimeout(250); | ||
|
||
var text = await page.$eval("body > table > tbody > tr:nth-child(2) > td:nth-child(3)", (el) => el.textContent); | ||
assert.type(text, "string"); | ||
assert.is(text, "03:41"); | ||
|
||
var text = await page.$eval("body > table > tbody > tr:nth-child(3) > td:nth-child(3)", (el) => el.textContent); | ||
assert.type(text, "string"); | ||
assert.is(text, "08:45"); | ||
|
||
var text = await page.$eval("body > table > tbody > tr:nth-child(4) > td:nth-child(3)", (el) => el.textContent); | ||
assert.type(text, "string"); | ||
assert.is(text, "12:45"); | ||
}); | ||
|
||
test("Solved Issue #3: display revenue numbers in a human readable format", async () => { | ||
await page.goto("http://localhost:8080"); | ||
await setTimeout(250); | ||
|
||
var text = await page.$eval("body > table > tbody > tr:nth-child(2) > td:nth-child(4)", (el) => el.textContent); | ||
assert.type(text, "string"); | ||
assert.is(text, "17 000 000"); | ||
|
||
var text = await page.$eval("body > table > tbody > tr:nth-child(3) > td:nth-child(4)", (el) => el.textContent); | ||
assert.type(text, "string"); | ||
assert.is(text, "7 375 294"); | ||
|
||
var text = await page.$eval("body > table > tbody > tr:nth-child(4) > td:nth-child(4)", (el) => el.textContent); | ||
assert.type(text, "string"); | ||
assert.is(text, "100 000"); | ||
}); | ||
|
||
test("Solved Issue #4: make table look prettier", async () => { | ||
await page.goto("http://localhost:8080"); | ||
await setTimeout(250); | ||
|
||
var headerColor = await page.$eval("tr:first-of-type", (el) => | ||
getComputedStyle(el).getPropertyValue("background-color") | ||
); | ||
assert.is(headerColor, "rgb(173, 216, 230)"); | ||
|
||
var tableBorderColor = await page.$eval("body > table", (el) => | ||
getComputedStyle(el).getPropertyValue("border-color") | ||
); | ||
assert.is(tableBorderColor, "rgb(173, 216, 230)"); | ||
}); | ||
|
||
test.run(); |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice update to the .gitignore file to ensure all 'node_modules' directories are ignored, not just the top-level one. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Great job updating the .gitignore to ignore node_modules in all subdirectories! This will help keep the repository clean from unnecessary files. |
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.
Great to see a new workflow file added for automated testing! This will definitely help to ensure code quality and streamline the testing process.