Skip to content
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

Fix: Playwright e2e helpers - Response body handling #168

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const appCommands = async (data) => {
const response = await context.post('/__e2e__/command', { data })

expect(response.ok()).toBeTruthy()
return response.body
return response.json();
}

const app = (name, options = {}) => appCommands({ name, options }).then((body) => body[0])
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@helio3197 Since appCommand now returns JSON, don't you think then part for app should be updated as well?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it should remain the same since the /__e2e__/command endpoint returns an array of command execution results, and the current behavior is to grab the first command result as the return value as app handles only a command request at time

Expand All @@ -23,15 +23,15 @@ const appVcrInsertCassette = async (cassette_name, options) => {
Object.keys(options).forEach(key => options[key] === undefined ? delete options[key] : {});
const response = await context.post("/__e2e__/vcr/insert", {data: [cassette_name,options]});
expect(response.ok()).toBeTruthy();
return response.body;
return response.json();
}

const appVcrEjectCassette = async () => {
const context = await contextPromise;

const response = await context.post("/__e2e__/vcr/eject");
expect(response.ok()).toBeTruthy();
return response.body;
return response.json();
}

export { appCommands, app, appScenario, appEval, appFactories, appVcrInsertCassette, appVcrEjectCassette }
Loading