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
Show file tree
Hide file tree
Changes from all commits
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 }
3 changes: 3 additions & 0 deletions specs_e2e/rails_4_2/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 4.2.10'
gem 'sprockets', '~> 3.7.2'
# Solution for issue: NoMethodError: undefined method `new' for BigDecimal:Class
# https://github.com/ruby/bigdecimal?tab=readme-ov-file#which-version-should-you-select
gem 'bigdecimal', '1.3.5'

group :development, :test do
gem 'vcr'
Expand Down
Loading