Skip to content

Commit

Permalink
Fix behat tests (#123)
Browse files Browse the repository at this point in the history
  • Loading branch information
lruozzi9 committed Aug 29, 2022
1 parent 0f0b14f commit 681a6d6
Show file tree
Hide file tree
Showing 9 changed files with 62 additions and 111 deletions.
77 changes: 33 additions & 44 deletions features/importing_products.feature
Original file line number Diff line number Diff line change
@@ -1,61 +1,50 @@
@importing_products
Feature: Enqueuing products
In order to import my products from Akeneo
Feature: Importing products
In order to show updated data about my products
As a Store Owner
I want to add them to the Akeneo PIM queue
I want to import products from Akeneo PIM

@cli
Scenario: Enqueuing products modified since a given date
Given there is a product "product-1" updated at "2020-01-10 22:23:13" on Akeneo
And there is a product "product-2" updated at "2020-01-21 09:54:12" on Akeneo
And there is a product "product-3" updated at "2020-01-22 08:15:08" on Akeneo
When I import items for all importers modified since date "2020-01-20 01:00:00"
Then the queue item with identifier "product-1" for the "Product" importer should not be in the Akeneo queue
And the queue item with identifier "product-2" for the "Product" importer should be in the Akeneo queue
And the queue item with identifier "product-3" for the "Product" importer should be in the Akeneo queue
Background:
Given there is a product "BRAIDED_HAT_M" on Akeneo
And there is a product "BRAIDED_HAT_L" on Akeneo

@cli
Scenario: There are no products modified since datetime read in file
Given there is a file with name "last-date" and content "2020-01-20 01:00:00"
And current date time is "2020-01-25T12:00:00+01:00"
When I import items for all importers modified since date specified from file "last-date"
Then there should be no item in the queue for the "Product" importer
And there is a file with name "last-date" that contains "2020-01-25T12:00:00+01:00"
Scenario: Importing single product model and its variants
Given the store operates on a single channel
And the store is also available in "it_IT"
When I import all from Akeneo
Then the product "MODEL_BRAIDED_HAT" should exists with the right data
And the product variant "BRAIDED_HAT_M" of product "MODEL_BRAIDED_HAT" should exists with the right data
And the product variant "BRAIDED_HAT_L" of product "MODEL_BRAIDED_HAT" should exists with the right data

@cli
Scenario: Enqueuing products modified since datetime read in file
Given there is a product "product-1" updated at "2020-01-10 22:23:13" on Akeneo
And there is a product "product-2" updated at "2020-01-21 09:54:12" on Akeneo
And there is a file with name "last-date" and content "2020-01-20 01:00:00"
And current date time is "2020-01-25T12:00:00+01:00"
When I import items for all importers modified since date specified from file "last-date"
Then the queue item with identifier "product-1" for the "Product" importer should not be in the Akeneo queue
And the queue item with identifier "product-2" for the "Product" importer should be in the Akeneo queue
And there is a file with name "last-date" that contains "2020-01-25T12:00:00+01:00"

@ui
Scenario: Enqueuing a simple product
Given I am logged in as an administrator
And the store has a product "Braided hat m"
When I browse products
And I schedule an Akeneo PIM import for the "Braided hat m" product
Then I should be notified that it has been successfully enqueued
Scenario: Importing products with images should not leave temporary files in temporary files directory
Given the store operates on a single channel
And the store is also available in "it_IT"
When I import all from Akeneo
Then there should not be any temporary file in the temporary files directory

@ui
Scenario: Enqueuing a product already enqueued
Given I am logged in as an administrator
And the store has a product "Braided hat l"
And there is one item to import with identifier "BRAIDED_HAT_L" for the "Product" importer in the Akeneo queue
Scenario: Importing a simple product
Given there is a product "11164822" on Akeneo
And I am logged in as an administrator
And the store has a product "11164822"
When I browse products
And I schedule an Akeneo PIM import for the "Braided hat l" product
And I schedule an Akeneo PIM import for the "11164822" product
Then I should be notified that it has been successfully enqueued
And the product "11164822" should exists with the right data
And the product variant "11164822" of product "11164822" should exists with the right data

@ui
Scenario: Enqueuing a configurable product
Scenario: Importing a configurable product
Given the store operates on a single channel
And the store has a "Braided hat" configurable product
And this product has "Small", "Medium" and "Large" variants
And the store has a "Model Braided Hat" configurable product
And this product has "Braided Hat S", "Braided Hat M" and "Braided Hat L" variants
And I am logged in as an administrator
When I browse products
And I schedule an Akeneo PIM import for the "Braided hat" product
And I schedule an Akeneo PIM import for the "Model Braided Hat" product
Then I should be notified that it has been successfully enqueued
Then the product "MODEL_BRAIDED_HAT" should exists with the right data
And the product variant "BRAIDED_HAT_S" of product "MODEL_BRAIDED_HAT" should exists with the right data
And the product variant "BRAIDED_HAT_M" of product "MODEL_BRAIDED_HAT" should exists with the right data
And the product variant "BRAIDED_HAT_L" of product "MODEL_BRAIDED_HAT" should exists with the right data
15 changes: 0 additions & 15 deletions features/importing_products_associations.feature

This file was deleted.

45 changes: 0 additions & 45 deletions features/importing_products_from_queue.feature

This file was deleted.

24 changes: 23 additions & 1 deletion tests/Behat/Resources/suites.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,36 @@ default:
- sylius.behat.context.setup.channel
- sylius.behat.context.setup.locale
- webgriffe_sylius_akeneo.behat.context.setup.queue
- webgriffe_sylius_akeneo.behat.context.setup.akeneo

- webgriffe_sylius_akeneo.behat.context.db.product
- webgriffe_sylius_akeneo.behat.context.messenger
- webgriffe_sylius_akeneo.behat.context.cli.import_command
- webgriffe_sylius_akeneo.behat.context.system.filesystem

filters:
tags: "@importing_products && @cli"

ui_importing_products:
contexts:
- sylius.behat.context.hook.doctrine_orm

- sylius.behat.context.transform.shared_storage
- sylius.behat.context.transform.product

- sylius.behat.context.setup.channel
- sylius.behat.context.setup.admin_security
- sylius.behat.context.setup.product
- webgriffe_sylius_akeneo.behat.context.setup.akeneo
- webgriffe_sylius_akeneo.behat.context.setup.queue

- webgriffe_sylius_akeneo.behat.context.db.product

- sylius.behat.context.ui.admin.managing_products
- webgriffe_sylius_akeneo.behat.context.ui.admin.managing_products

filters:
tags: "@importing_products && @ui"

cli_importing_product_associations:
contexts:
- sylius.behat.context.hook.doctrine_orm
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"identifier": "braided-hat-l",
"identifier": "BRAIDED_HAT_L",
"enabled": true,
"family": "accessories",
"categories": [
"master_accessories_hats",
"master_accessories_hats"
],
"groups": [],
"parent": "model-braided-hat",
"parent": "MODEL_BRAIDED_HAT",
"values": {
"size": [
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"identifier": "braided-hat-m",
"identifier": "BRAIDED_HAT_M",
"enabled": true,
"family": "accessories",
"categories": [
"master_accessories_hats",
"master_accessories_hats"
],
"groups": [],
"parent": "model-braided-hat",
"parent": "MODEL_BRAIDED_HAT",
"values": {
"size": [
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"identifier": "braided-hat-s",
"identifier": "BRAIDED_HAT_S",
"enabled": false,
"family": "accessories",
"categories": [
"master_accessories_hats",
"master_accessories_hats"
],
"groups": [],
"parent": "model-braided-hat",
"parent": "MODEL_BRAIDED_HAT",
"values": {
"size": [
{
Expand Down

0 comments on commit 681a6d6

Please sign in to comment.