MageTest / BehatMage

Behat for Magento
MIT License
85 stars 31 forks source link

Invalid entity_type specified: catalog_product #27

Open adam-j-martin opened 11 years ago

adam-j-martin commented 11 years ago

Hi there, Great work on this. However, I have the following error when following the example in the documentation here.

F--- (::) failed steps (::) 01. Invalid entity_type specified: catalog_product In step `Given the following products exist:'. # AdminUserContext::theProductsExist() From scenario `Turn off reviews per product'. # features\admin_user_manages_review_visibility.feature:6 Of feature `Admin User can manage review visibility'. # features\admin_user_manages_review_visibility.feature 1 scenario (1 failed) 4 steps (3 skipped, 1 failed) 0m0.109s

any help appreciated :)

debo commented 11 years ago

Hi @adam-j-martin thanks for your feedback and issue report. I just tried to replicate your issue on my environment but without luck unfortunately. The error you are getting is coming straight out of Magento which is not able to find a specific entity into EAV.

Could you please verify that the BehatMage extension is enabled in the behat.yml file and that the data-install scripts has been properly executed? Do you know how to verify that? Also, did you refreshed or reloaded the page to ensure that the data-install script runs.

Please let me know how do you get on with it.

Thanks, Debo

adam-j-martin commented 11 years ago

Hi Debo, This is what I have in my behat.yml - I am not sure if everything is in there that is needed. And sorry, data install scripts? Do you mean magento ones.

default: formatter: name: progress paths: bootstrap: '%behat.paths.features%/bootstrap' extensions: MageTest\MagentoExtension\Extension: ~ Behat\MinkExtension\Extension: base_url: http://magento.local

javascript_session: sahi

  #browser_name: firefox
  goutte:
    server_parameters:
      HTTP_HOST: %behat.mink.base_url%
  sahi: ~</code>

perhaps I am missing something in my composer.json?

{ "name": "magento-bdd", "description": "Magento BDD", "config": { "bin-dir": "bin" },

"require": {
    "php": ">=5.3.0"
},
"require-dev": {
    "magetest/magento-behat-extension": "dev-develop",
    "magetest/magento-phpspec-extension": "*"
},
"autoload": {
    "psr-0": {
        "": [
            "src",
            "htdocs/app",
            "htdocs/app/code/local",
            "htdocs/app/code/community",
            "htdocs/app/code/core",
            "htdocs/lib"
        ]
    }
},
"minimum-stability": "dev"

}

adam-j-martin commented 11 years ago

Actually I had to change composer as I got an error about mink sahi driver, so added the following:

"magetest/magento-behat-extension": "dev-develop", "magetest/magento-phpspec-extension": "", "behat/mink": "", "fabpot/goutte": "1.0.x-dev", "behat/mink-extension": "dev-master", "behat/mink-goutte-driver":"dev-master", "behat/mink-sahi-driver": "*"

Is it possible to see both your behat.yml and the composer file

adam-j-martin commented 11 years ago

Still having issues with this. Not sure of the next steps to be honest. The error occurs when running bin/behat before writing any code for Magento. That is, this is failing trying with the product fixture. The exact problem code is:

$id = $this->model->getIdBySku($attributes['sku']);

which is found on line 63 of class Product (which implements FixtureInterface)

alistairstead commented 11 years ago

I have not had time to test but I think using the mink extension as well as the magento extension may be the problem.

Can you possibly try only loading the Magento extension in you behat.yml?

debo commented 11 years ago

Hi @adam-j-martin,

yes, if you followed the guide in the README.md it tells you to create a data-install script to add an attribute to the product, did you created that script and ensured it ran? Yesterday I went through the documentation to be sure I didn't miss anything and I've not been able to replicate. Investigation is still going on...

adam-j-martin commented 11 years ago

Hi @MarcoDeBortoli - I appreciate your help on this. I understand what you are saying around the data-install script.. but the error I am getting is in the checking if the product exists - not the check on the new required attribute.

@alistairstead - I did try again with the following behat.yml

default: formatter: name: progress extensions: MageTest\MagentoExtension\Extension: ~ Behat\MinkExtension\Extension: base_url: enterprise.local goutte: server_parameters: HTTP_HOST: %behat.mink.base_url%

sorry about the formatting

debo commented 11 years ago

@adam-j-martin : I understand, but that's indeed Magento raising an exceptions because it cannot find a particular entity for what I can see and it's investigated also here: http://www.magentocommerce.com/boards/viewthread/4719/

Regarding the behat.yml file this is what I'm currently using: https://gist.github.com/MarcoDeBortoli/9cca7bcb1ff9285a0b60

adam-j-martin commented 11 years ago

capture

this is at the step immediately after adding the step definition to the AdminUserContext. Also, to eliminate the issue being around the attribute I have created it manually for now and assigned it to the default attribute set. I also manually created the product.

Cheers

debo commented 11 years ago

@adam-j-martin can you please gist the output of the following command:

$ bin/behat -dl

Thanks

adam-j-martin commented 11 years ago

@MarcoDeBortoli https://gist.github.com/adam-j-martin/5876759

One thing to mention is that I am testing with Enterprise 1.13.0.1 I have tried to comment out a few things as tests - i.e providing the correct id instead of getting it to look it up.. but then it just moves the problem to the fixture save. So definitely an issue with the magento model as you say. But I have tried this on several different machines now

debo commented 11 years ago

Mmmm the last given in your list looks a bit suspicious to me. This is my output after following steps by steps the README.me

https://gist.github.com/MarcoDeBortoli/dc9b2a418641d878fac3

Could you please verify and confirm that your context file extends MagentoContext?

adam-j-martin commented 11 years ago
adam-j-martin commented 11 years ago

@MarcoDeBortoli

https://gist.github.com/adam-j-martin/5877032

this is the verbose output - I have just copied your behat.yml exactly (changing the base url) and now the error is not a fatal (good) but a failing test (good)... but not getting the message about missing attribute but still the message about invalid entity_type.

debo commented 11 years ago

Hi @adam-j-martin ok in complete honesty I didn't try the extension with the that EE version yet. I'm going to test it straight away and let you know as soon as I have some results.

adam-j-martin commented 11 years ago

Hi @MarcoDeBortoli - Magento have removed the download of that version - so let me know if you need me to send you a copy... or I could zip up my bdd project completely for you (along with db)

debo commented 11 years ago

I have that version, but yes, if you can share with me your project, given it doesn't contain any sensitive informations, that will surely help me nail down the problem especially if it's due by something specifically related to it. Thanks.

adam-j-martin commented 11 years ago

@MarcoDeBortoli - Shall I wetransfer.com the archive to you? what email address please

debo commented 11 years ago

@adam-j-martin I just emailed you.