Skip to content

Commit

Permalink
OP-322: Behat fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jkindly committed Jun 28, 2024
1 parent a668e56 commit 7471ad3
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 73 deletions.
12 changes: 3 additions & 9 deletions features/admin/adding_page.feature
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ Feature: Adding new page
And I fill the code with "page_with_title"
And I fill the slug with "page_with_title"
And I fill the name with "page_with_title"
And I fill the content with "This is a page with a title set by us."
And I add it
Then I should be notified that the page has been created

Expand All @@ -26,7 +25,6 @@ Feature: Adding new page
And I fill the name with "Top 5 outfits for this summer"
And I fill the meta keywords with "TOP 5 summer outfit trends, outfits, Ralph Lauren"
And I fill the meta description with "This summer is going to be hot like a pizza."
And I fill the content with "The best looks, trends, inspiration, and shopping picks for summer style."
And I add it
Then I should be notified that the page has been created

Expand All @@ -39,9 +37,6 @@ Feature: Adding new page
And I fill the name with "Aston Martin is amazing car"
And I fill the meta keywords with "Aston Martin is amazing car"
And I fill the meta description with "Aston Martin is amazing car for this summer."
And I fill the content with "Aston Martin is amazing car for this summer. Buy it."
And I choose "aston-martin" media as image
And I add it
Then I should be notified that the page has been created

@ui
Expand All @@ -56,14 +51,14 @@ Feature: Adding new page
Scenario: Adding new page with blank data
When I go to the create page page
And I add it
And I should be notified that "Code, Name, Slug, Content" fields cannot be blank
And I should be notified that "Code, Name, Slug" fields cannot be blank

@ui
Scenario: Trying to add a page with too short data
When I go to the create page page
And I fill "Code, Name, Slug, Meta keywords, Meta description, Content" fields with 1 character
And I fill "Code, Name, Slug, Meta keywords, Meta description" fields with 1 character
And I try to add it
Then I should be notified that "Code, Name, Slug, Meta keywords, Meta description, Content" fields are too short
Then I should be notified that "Code, Name, Slug, Meta keywords, Meta description" fields are too short

@ui @unstable
Scenario: Trying to add a page with too long data
Expand All @@ -80,6 +75,5 @@ Feature: Adding new page
And I add "Blog" and "Homepage" collections to it
And I fill the slug with "Slug"
And I fill the name with "Best day ever"
And I fill the content with "This was the best day of my life"
And I add it
Then I should be notified that the page has been created
12 changes: 1 addition & 11 deletions features/admin/managing_pages.feature
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,6 @@ Feature: Managing cms pages
Scenario: Updating page
Given there is a page in the store
When I want to edit this page
And I fill "Code, Content" fields
And I update it
Then I should be notified that the page was updated

@ui
Scenario: Updating page with image
Given there is a page in the store
And there is an existing "image" media with "aston-martin" code
When I want to edit this page
And I fill "Code, Content" fields
And I choose "aston-martin" media as image
And I fill "Code, Name" fields
And I update it
Then I should be notified that the page was updated
3 changes: 0 additions & 3 deletions features/api/viewing_pages.feature
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,11 @@ Feature: Getting data from cms pages
And there are 10 pages in the store
And the store has "iPhone 8" and "iPhone X" products
And there is a page in the store
And this page has these products associated with it
And there are existing collections named "Blog" and "General"
And this page has these collections associated with it
And this page has "About us" name
And this page has "about" code
And this page also has "about-us" slug
And this page also has "We are the best!" content

@api
Scenario: Browsing defined pages
Expand All @@ -27,4 +25,3 @@ Feature: Getting data from cms pages
Scenario: Viewing a detailed page
Given I view page with code "about"
Then I should see the page name "About us"
And I should see the page content "We are the best!"
24 changes: 0 additions & 24 deletions features/shop/displaying_page.feature
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,12 @@ Feature: Displaying pages
Scenario: Displaying page
Given there is a page in the store
And the store has "iPhone 8" and "iPhone X" products
And this page has these products associated with it
And there are existing collections named "Blog" and "General"
And this page has these collections associated with it
And this page has "About us" name
And this page also has "about-us" slug
And this page also has "Lorem ipsum" content
When I go to the "about-us" page
Then I should see a page with "About us" name
And I should also see "Lorem ipsum" content
And I should also see "iPhone 8" and "iPhone X" products associated with this page
And I should also see "Blog" and "General" collections associated with this page

@ui
Expand All @@ -31,31 +27,12 @@ Feature: Displaying pages
When I go to this page
Then I should see the "About" page link in the header

@ui @javascript
Scenario: Displaying page with image
Given there is a page in the store
And the store has "iPhone 8" and "iPhone X" products
And this page has these products associated with it
And there are existing collections named "Blog" and "General"
And this page has these collections associated with it
And this page has "About us" name
And this page also has "about-us" slug
And this page also has "Lorem ipsum" content
And this page also has "homepage_main.jpeg" image
When I go to the "about-us" page
Then I should see a page with "About us" name
And I should also see "Lorem ipsum" content
And I should also see "iPhone 8" and "iPhone X" products associated with this page
And I should also see "Blog" and "General" collections associated with this page
And I should also see page image

@ui @javascript @title
Scenario: Displaying page with title
Given there is a page in the store
And this page has "some_page_with_title" code
And this page has "some_page_with_title" name
And this page also has "some_page_with_title" slug
And this page also has "Lorem ipsum" content
And this page also has "title" title
When I go to this page
Then I should see page title "title"
Expand All @@ -66,6 +43,5 @@ Feature: Displaying pages
And this page has "title" code
And this page has "Title" name
And this page also has "title" slug
And this page also has "Lorem ipsum" content
When I go to this page
Then I should see page title "Sylius"
26 changes: 0 additions & 26 deletions tests/Behat/Context/Setup/PageContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,32 +132,6 @@ public function thisPageAlsoHasTitle(string $title): void
$this->entityManager->flush();
}

/**
* @Given this page also has :content image
*/
public function thisPageAlsoHasImage(string $image): void
{
$image = $this->uploadImage($image);

$this->sharedStorage->get('page')->setImage($image);

$this->entityManager->flush();
}

/**
* @Given this page has these products associated with it
*/
public function thisPageHasTheseProductsAssociatedWithIt(): void
{
$products = $this->productRepository->findAll();

foreach ($products as $product) {
$this->sharedStorage->get('page')->addProduct($product);
}

$this->entityManager->flush();
}

/**
* @Given this page has these collections associated with it
*/
Expand Down

0 comments on commit 7471ad3

Please sign in to comment.