Skip to content

Commit

Permalink
test(playwright): Remove describe in test files (#1256)
Browse files Browse the repository at this point in the history
  • Loading branch information
xrutayisire authored Dec 27, 2023
1 parent 71ac949 commit 85da77e
Show file tree
Hide file tree
Showing 12 changed files with 1,280 additions and 1,336 deletions.
222 changes: 110 additions & 112 deletions playwright/tests/changelog/changelog.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,123 +2,121 @@ import { expect } from "@playwright/test";

import { test } from "../../fixtures";

test.describe("Changelog", () => {
test.run()(
"I can see a warning if the selected release note has a breaking changes",
async ({ changelogPage, procedures }) => {
const releaseNotes =
"Breaking Changes - This changes is breaking your slice machine";
procedures.mock(
"versions.getAllStableSliceMachineVersionsWithKind",
() => [
{
version: "2.0.0",
kind: "MAJOR",
},
],
{ execute: false },
);
procedures.mock(
"versions.getSliceMachineReleaseNotesForVersion",
() => `# ${releaseNotes}`,
{ execute: false },
);
test.run()(
"I can see a warning if the selected release note has a breaking changes",
async ({ changelogPage, procedures }) => {
const releaseNotes =
"Breaking Changes - This changes is breaking your slice machine";
procedures.mock(
"versions.getAllStableSliceMachineVersionsWithKind",
() => [
{
version: "2.0.0",
kind: "MAJOR",
},
],
{ execute: false },
);
procedures.mock(
"versions.getSliceMachineReleaseNotesForVersion",
() => `# ${releaseNotes}`,
{ execute: false },
);

await changelogPage.goto();
await changelogPage.checkReleaseNotes(releaseNotes);
await expect(changelogPage.breakingChangesWarning).toBeVisible();
},
);
await changelogPage.goto();
await changelogPage.checkReleaseNotes(releaseNotes);
await expect(changelogPage.breakingChangesWarning).toBeVisible();
},
);

test.run()(
"I cannot see a warning if the selected release does not contain a breaking change",
async ({ changelogPage, procedures }) => {
const releaseNotes = "This changes is not breaking your slice machine";
procedures.mock(
"versions.getAllStableSliceMachineVersionsWithKind",
() => [
{
version: "2.0.0",
kind: "MAJOR",
},
{
version: "1.0.42",
kind: "PATCH",
},
],
{ execute: false },
);
procedures.mock(
"versions.getSliceMachineReleaseNotesForVersion",
() => releaseNotes,
{ execute: false },
);
test.run()(
"I cannot see a warning if the selected release does not contain a breaking change",
async ({ changelogPage, procedures }) => {
const releaseNotes = "This changes is not breaking your slice machine";
procedures.mock(
"versions.getAllStableSliceMachineVersionsWithKind",
() => [
{
version: "2.0.0",
kind: "MAJOR",
},
{
version: "1.0.42",
kind: "PATCH",
},
],
{ execute: false },
);
procedures.mock(
"versions.getSliceMachineReleaseNotesForVersion",
() => releaseNotes,
{ execute: false },
);

await changelogPage.goto();
await changelogPage.selectVersion("1.0.42");
await changelogPage.goto();
await changelogPage.selectVersion("1.0.42");

await changelogPage.checkReleaseNotes(releaseNotes);
await expect(changelogPage.breakingChangesWarning).not.toBeVisible();
},
);
await changelogPage.checkReleaseNotes(releaseNotes);
await expect(changelogPage.breakingChangesWarning).not.toBeVisible();
},
);

test.run()(
"I can see the yarn latest update command",
async ({ changelogPage, procedures }) => {
const packageManager = "yarn";
const adapterName = "@slicemachine/adapter-next";
procedures.mock("project.getAdapterName", () => adapterName, {
execute: false,
});
procedures.mock("getState", ({ data }) => ({
...(data as Record<string, unknown>),
env: {
...((data as Record<string, unknown>)["env"] as Record<
string,
unknown
>),
packageManager,
},
}));
test.run()(
"I can see the yarn latest update command",
async ({ changelogPage, procedures }) => {
const packageManager = "yarn";
const adapterName = "@slicemachine/adapter-next";
procedures.mock("project.getAdapterName", () => adapterName, {
execute: false,
});
procedures.mock("getState", ({ data }) => ({
...(data as Record<string, unknown>),
env: {
...((data as Record<string, unknown>)["env"] as Record<
string,
unknown
>),
packageManager,
},
}));

await changelogPage.goto();
await expect(
changelogPage.getUpdateCommand({
packageManager,
adapterName,
version: "latest",
}),
).toBeVisible();
},
);
await changelogPage.goto();
await expect(
changelogPage.getUpdateCommand({
packageManager,
adapterName,
version: "latest",
}),
).toBeVisible();
},
);

test.run()(
"I can see the npm latest update command",
async ({ changelogPage, procedures }) => {
const packageManager = "npm";
const adapterName = "@slicemachine/adapter-next";
procedures.mock("project.getAdapterName", () => adapterName, {
execute: false,
});
procedures.mock("getState", ({ data }) => ({
...(data as Record<string, unknown>),
env: {
...((data as Record<string, unknown>)["env"] as Record<
string,
unknown
>),
packageManager,
},
}));
test.run()(
"I can see the npm latest update command",
async ({ changelogPage, procedures }) => {
const packageManager = "npm";
const adapterName = "@slicemachine/adapter-next";
procedures.mock("project.getAdapterName", () => adapterName, {
execute: false,
});
procedures.mock("getState", ({ data }) => ({
...(data as Record<string, unknown>),
env: {
...((data as Record<string, unknown>)["env"] as Record<
string,
unknown
>),
packageManager,
},
}));

await changelogPage.goto();
await expect(
changelogPage.getUpdateCommand({
packageManager,
adapterName,
version: "latest",
}),
).toBeVisible();
},
);
});
await changelogPage.goto();
await expect(
changelogPage.getUpdateCommand({
packageManager,
adapterName,
version: "latest",
}),
).toBeVisible();
},
);
Loading

0 comments on commit 85da77e

Please sign in to comment.