-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
39 changed files
with
526 additions
and
333 deletions.
There are no files selected for viewing
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
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,37 +1,40 @@ | ||
import { expect } from '@playwright/test'; | ||
import { expect } from "@playwright/test"; | ||
|
||
// https://stackoverflow.com/questions/33178843/es6-export-default-with-multiple-functions-referring-to-each-other | ||
export default { | ||
async clear(request, url) { | ||
const response = await request.post(url + '/api/clear'); | ||
const response = await request.post(url + "/api/v1/clear"); | ||
|
||
return response; | ||
}, | ||
|
||
async login(page) { | ||
await page.getByRole('link', {name: /You need to login/}).click(); | ||
await page.getByRole("link", { name: /You need to login/ }).click(); | ||
}, | ||
|
||
async playOptimization(page) { | ||
await page.getByRole('link', { name: 'Games', exact: true }).click(); | ||
await page.getByRole("link", { name: "Games", exact: true }).click(); | ||
|
||
await page.getByRole("link", { name: /Travelling Salesman Problem/ }).click(); | ||
await page.getByRole("link", { name: /Create your own contest/ }).click(); | ||
|
||
await page.getByRole('link', { name: /Travelling Salesman Problem/ }).click(); | ||
await page.getByRole('link', { name: /Create your own contest/ }).click(); | ||
|
||
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/random | ||
const contestName = String(Math.floor(Math.random() * 1024)); | ||
await page.locator("#contestName").fill(contestName); | ||
await page.getByRole('button', { name: 'Submit' }).click(); | ||
await page.getByRole("button", { name: "Submit" }).click(); | ||
|
||
// await page.getByRole('link', { name: /Auto-generated/ }).first().click(); | ||
await page.getByRole('link', { name: new RegExp(`${contestName}`, 'gi') }).first().click(); | ||
|
||
await page.getByRole('button', { name: 'Preview the board' }).click(); | ||
await page.getByRole('button', { name: 'Join contest as player' }).click(); | ||
await page.getByRole('button', { name: 'Load some available moves' }).click(); | ||
await page.getByRole('button', { name: 'Prefill with an example move' }).click(); | ||
await page.getByText('greedy').click(); | ||
await page.getByRole('button', { name: 'Submit' }).click(); | ||
await page.getByText('11111111-1111-1111-1111-111111111111 has score').click(); | ||
await page | ||
.getByRole("link", { name: new RegExp(`${contestName}`, "gi") }) | ||
.first() | ||
.click(); | ||
|
||
await page.getByRole("button", { name: "Preview the board" }).click(); | ||
await page.getByRole("button", { name: "Join contest as player" }).click(); | ||
await page.getByRole("button", { name: "Load some available moves" }).click(); | ||
await page.getByRole("button", { name: "Prefill with an example move" }).click(); | ||
await page.getByText("greedy").click(); | ||
await page.getByRole("button", { name: "Submit" }).click(); | ||
await page.getByText("11111111-1111-1111-1111-111111111111 has score").click(); | ||
}, | ||
}; |
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,15 +1,15 @@ | ||
import { test, expect } from '@playwright/test'; | ||
import { test, expect } from "@playwright/test"; | ||
|
||
import fakePlayer from "./fake-player.mjs" | ||
import fakePlayer from "./fake-player.mjs"; | ||
|
||
const url = "https://kumite-dev-d2844865d26b.herokuapp.com/"; | ||
|
||
test('login', async ({ page }) => { | ||
test("login", async ({ page }) => { | ||
await page.goto(url); | ||
await fakePlayer.login(page); | ||
}); | ||
|
||
test('play-optimization', async ({ page }) => { | ||
test("play-optimization", async ({ page }) => { | ||
await page.goto(url); | ||
await fakePlayer.playOptimization(page); | ||
}); | ||
}); |
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
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
Oops, something went wrong.