Skip to content

Commit

Permalink
Remove await from getByX
Browse files Browse the repository at this point in the history
  • Loading branch information
kasperpeulen committed Oct 31, 2023
1 parent ec26ed8 commit 76c3821
Show file tree
Hide file tree
Showing 18 changed files with 36 additions and 36 deletions.
4 changes: 2 additions & 2 deletions code/frameworks/angular/template/cli/Page.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ export const LoggedIn: Story = {
}),
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
const loginButton = await canvas.getByRole('button', {
const loginButton = canvas.getByRole('button', {
name: /Log in/i,
});
await expect(loginButton).toBeInTheDocument();
await userEvent.click(loginButton);
await expect(loginButton).not.toBeInTheDocument();

const logoutButton = await canvas.getByRole('button', {
const logoutButton = canvas.getByRole('button', {
name: /Log out/i,
});
await expect(logoutButton).toBeInTheDocument();
Expand Down
4 changes: 2 additions & 2 deletions code/frameworks/nextjs/template/cli/js/Page.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ export const LoggedOut = {};
export const LoggedIn = {
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
const loginButton = await canvas.getByRole('button', {
const loginButton = canvas.getByRole('button', {
name: /Log in/i,
});
await expect(loginButton).toBeInTheDocument();
await userEvent.click(loginButton);
await expect(loginButton).not.toBeInTheDocument();

const logoutButton = await canvas.getByRole('button', {
const logoutButton = canvas.getByRole('button', {
name: /Log out/i,
});
await expect(logoutButton).toBeInTheDocument();
Expand Down
4 changes: 2 additions & 2 deletions code/frameworks/nextjs/template/cli/ts-3-8/Page.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ export const LoggedOut: Story = {};
export const LoggedIn: Story = {
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
const loginButton = await canvas.getByRole('button', {
const loginButton = canvas.getByRole('button', {
name: /Log in/i,
});
await expect(loginButton).toBeInTheDocument();
await userEvent.click(loginButton);
await expect(loginButton).not.toBeInTheDocument();

const logoutButton = await canvas.getByRole('button', {
const logoutButton = canvas.getByRole('button', {
name: /Log out/i,
});
await expect(logoutButton).toBeInTheDocument();
Expand Down
4 changes: 2 additions & 2 deletions code/frameworks/nextjs/template/cli/ts-4-9/Page.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ export const LoggedOut: Story = {};
export const LoggedIn: Story = {
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
const loginButton = await canvas.getByRole('button', {
const loginButton = canvas.getByRole('button', {
name: /Log in/i,
});
await expect(loginButton).toBeInTheDocument();
await userEvent.click(loginButton);
await expect(loginButton).not.toBeInTheDocument();

const logoutButton = await canvas.getByRole('button', {
const logoutButton = canvas.getByRole('button', {
name: /Log out/i,
});
await expect(logoutButton).toBeInTheDocument();
Expand Down
4 changes: 2 additions & 2 deletions code/renderers/html/template/cli/js/Page.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ export const LoggedOut = {};
export const LoggedIn = {
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
const loginButton = await canvas.getByRole('button', {
const loginButton = canvas.getByRole('button', {
name: /Log in/i,
});
await expect(loginButton).toBeInTheDocument();
await userEvent.click(loginButton);
await expect(loginButton).not.toBeInTheDocument();

const logoutButton = await canvas.getByRole('button', {
const logoutButton = canvas.getByRole('button', {
name: /Log out/i,
});
await expect(logoutButton).toBeInTheDocument();
Expand Down
4 changes: 2 additions & 2 deletions code/renderers/html/template/cli/ts-3-8/Page.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ export const LoggedOut: StoryObj = {};
export const LoggedIn: StoryObj = {
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
const loginButton = await canvas.getByRole('button', {
const loginButton = canvas.getByRole('button', {
name: /Log in/i,
});
await expect(loginButton).toBeInTheDocument();
await userEvent.click(loginButton);
await expect(loginButton).not.toBeInTheDocument();

const logoutButton = await canvas.getByRole('button', {
const logoutButton = canvas.getByRole('button', {
name: /Log out/i,
});
await expect(logoutButton).toBeInTheDocument();
Expand Down
4 changes: 2 additions & 2 deletions code/renderers/html/template/cli/ts-4-9/Page.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ export const LoggedOut: StoryObj = {};
export const LoggedIn: StoryObj = {
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
const loginButton = await canvas.getByRole('button', {
const loginButton = canvas.getByRole('button', {
name: /Log in/i,
});
await expect(loginButton).toBeInTheDocument();
await userEvent.click(loginButton);
await expect(loginButton).not.toBeInTheDocument();

const logoutButton = await canvas.getByRole('button', {
const logoutButton = canvas.getByRole('button', {
name: /Log out/i,
});
await expect(logoutButton).toBeInTheDocument();
Expand Down
4 changes: 2 additions & 2 deletions code/renderers/preact/template/cli/Page.stories.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ export const LoggedOut = {};
export const LoggedIn = {
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
const loginButton = await canvas.getByRole('button', {
const loginButton = canvas.getByRole('button', {
name: /Log in/i,
});
await expect(loginButton).toBeInTheDocument();
await userEvent.click(loginButton);
await expect(loginButton).not.toBeInTheDocument();

const logoutButton = await canvas.getByRole('button', {
const logoutButton = canvas.getByRole('button', {
name: /Log out/i,
});
await expect(logoutButton).toBeInTheDocument();
Expand Down
4 changes: 2 additions & 2 deletions code/renderers/react/template/cli/js/Page.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ export const LoggedOut = {};
export const LoggedIn = {
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
const loginButton = await canvas.getByRole('button', {
const loginButton = canvas.getByRole('button', {
name: /Log in/i,
});
await expect(loginButton).toBeInTheDocument();
await userEvent.click(loginButton);
await expect(loginButton).not.toBeInTheDocument();

const logoutButton = await canvas.getByRole('button', {
const logoutButton = canvas.getByRole('button', {
name: /Log out/i,
});
await expect(logoutButton).toBeInTheDocument();
Expand Down
4 changes: 2 additions & 2 deletions code/renderers/react/template/cli/ts-3-8/Page.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ export const LoggedOut: Story = {};
export const LoggedIn: Story = {
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
const loginButton = await canvas.getByRole('button', {
const loginButton = canvas.getByRole('button', {
name: /Log in/i,
});
await expect(loginButton).toBeInTheDocument();
await userEvent.click(loginButton);
await expect(loginButton).not.toBeInTheDocument();

const logoutButton = await canvas.getByRole('button', {
const logoutButton = canvas.getByRole('button', {
name: /Log out/i,
});
await expect(logoutButton).toBeInTheDocument();
Expand Down
4 changes: 2 additions & 2 deletions code/renderers/react/template/cli/ts-4-9/Page.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ export const LoggedOut: Story = {};
export const LoggedIn: Story = {
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
const loginButton = await canvas.getByRole('button', {
const loginButton = canvas.getByRole('button', {
name: /Log in/i,
});
await expect(loginButton).toBeInTheDocument();
await userEvent.click(loginButton);
await expect(loginButton).not.toBeInTheDocument();

const logoutButton = await canvas.getByRole('button', {
const logoutButton = canvas.getByRole('button', {
name: /Log out/i,
});
await expect(logoutButton).toBeInTheDocument();
Expand Down
4 changes: 2 additions & 2 deletions code/renderers/svelte/template/cli/js/Page.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ export const LoggedOut = {};
export const LoggedIn = {
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
const loginButton = await canvas.getByRole('button', {
const loginButton = canvas.getByRole('button', {
name: /Log in/i,
});
await expect(loginButton).toBeInTheDocument();
await userEvent.click(loginButton);
await expect(loginButton).not.toBeInTheDocument();

const logoutButton = await canvas.getByRole('button', {
const logoutButton = canvas.getByRole('button', {
name: /Log out/i,
});
await expect(logoutButton).toBeInTheDocument();
Expand Down
4 changes: 2 additions & 2 deletions code/renderers/svelte/template/cli/ts-3-8/Page.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ export const LoggedOut: Story = {};
export const LoggedIn: Story = {
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
const loginButton = await canvas.getByRole('button', {
const loginButton = canvas.getByRole('button', {
name: /Log in/i,
});
await expect(loginButton).toBeInTheDocument();
await userEvent.click(loginButton);
await expect(loginButton).not.toBeInTheDocument();

const logoutButton = await canvas.getByRole('button', {
const logoutButton = canvas.getByRole('button', {
name: /Log out/i,
});
await expect(logoutButton).toBeInTheDocument();
Expand Down
4 changes: 2 additions & 2 deletions code/renderers/svelte/template/cli/ts-4-9/Page.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ export const LoggedOut: Story = {};
export const LoggedIn: Story = {
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
const loginButton = await canvas.getByRole('button', {
const loginButton = canvas.getByRole('button', {
name: /Log in/i,
});
await expect(loginButton).toBeInTheDocument();
await userEvent.click(loginButton);
await expect(loginButton).not.toBeInTheDocument();

const logoutButton = await canvas.getByRole('button', {
const logoutButton = canvas.getByRole('button', {
name: /Log out/i,
});
await expect(logoutButton).toBeInTheDocument();
Expand Down
4 changes: 2 additions & 2 deletions code/renderers/vue/template/cli/Page.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ export const LoggedOut = {};
export const LoggedIn = {
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
const loginButton = await canvas.getByRole('button', {
const loginButton = canvas.getByRole('button', {
name: /Log in/i,
});
await expect(loginButton).toBeInTheDocument();
await userEvent.click(loginButton);
await expect(loginButton).not.toBeInTheDocument();

const logoutButton = await canvas.getByRole('button', {
const logoutButton = canvas.getByRole('button', {
name: /Log out/i,
});
await expect(logoutButton).toBeInTheDocument();
Expand Down
4 changes: 2 additions & 2 deletions code/renderers/vue3/template/cli/js/Page.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ export const LoggedIn = {
}),
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
const loginButton = await canvas.getByRole('button', {
const loginButton = canvas.getByRole('button', {
name: /Log in/i,
});
await expect(loginButton).toBeInTheDocument();
await userEvent.click(loginButton);
await expect(loginButton).not.toBeInTheDocument();

const logoutButton = await canvas.getByRole('button', {
const logoutButton = canvas.getByRole('button', {
name: /Log out/i,
});
await expect(logoutButton).toBeInTheDocument();
Expand Down
4 changes: 2 additions & 2 deletions code/renderers/vue3/template/cli/ts-3-8/Page.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ type Story = StoryObj<typeof MyPage>;
export const LoggedIn: Story = {
play: async ({ canvasElement }: any) => {
const canvas = within(canvasElement);
const loginButton = await canvas.getByRole('button', {
const loginButton = canvas.getByRole('button', {
name: /Log in/i,
});
await expect(loginButton).toBeInTheDocument();
await userEvent.click(loginButton);
await expect(loginButton).not.toBeInTheDocument();

const logoutButton = await canvas.getByRole('button', {
const logoutButton = canvas.getByRole('button', {
name: /Log out/i,
});
await expect(logoutButton).toBeInTheDocument();
Expand Down
4 changes: 2 additions & 2 deletions code/renderers/vue3/template/cli/ts-4-9/Page.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ type Story = StoryObj<typeof meta>;
export const LoggedIn: Story = {
play: async ({ canvasElement }: any) => {
const canvas = within(canvasElement);
const loginButton = await canvas.getByRole('button', {
const loginButton = canvas.getByRole('button', {
name: /Log in/i,
});
await expect(loginButton).toBeInTheDocument();
await userEvent.click(loginButton);
await expect(loginButton).not.toBeInTheDocument();

const logoutButton = await canvas.getByRole('button', {
const logoutButton = canvas.getByRole('button', {
name: /Log out/i,
});
await expect(logoutButton).toBeInTheDocument();
Expand Down

0 comments on commit 76c3821

Please sign in to comment.