Skip to content

Commit 825c171

Browse files
test(sidebar): make functional tests deterministic and CI-safe
1 parent 805bba3 commit 825c171

1 file changed

Lines changed: 26 additions & 9 deletions

File tree

features/sidebar.feature

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,20 @@ Feature: Manage WordPress sidebars
22

33
Scenario: List available sidebars
44
Given a WP install
5-
6-
When I try `wp theme delete twentytwelve --force`
7-
And I run `wp theme install twentytwelve --activate`
8-
Then STDOUT should not be empty
5+
When I run `wp eval '
6+
register_sidebar([
7+
"id" => "sidebar-1",
8+
"name" => "Main Sidebar"
9+
]);
10+
register_sidebar([
11+
"id" => "sidebar-2",
12+
"name" => "First Front Page Widget Area"
13+
]);
14+
register_sidebar([
15+
"id" => "sidebar-3",
16+
"name" => "Second Front Page Widget Area"
17+
]);
18+
'`
919

1020
When I run `wp sidebar list --fields=name,id`
1121
Then STDOUT should be a table containing rows:
@@ -29,7 +39,7 @@ Feature: Manage WordPress sidebars
2939

3040
Scenario: Get sidebar details
3141
Given a WP install
32-
When I run `wp theme install twentytwelve --activate`
42+
When I run `wp eval 'register_sidebar(["id"=>"sidebar-1","name"=>"Test Sidebar"]);'`
3343
And I run `wp sidebar get sidebar-1`
3444
Then STDOUT should contain:
3545
"""
@@ -38,12 +48,19 @@ Feature: Manage WordPress sidebars
3848

3949
Scenario: Sidebar exists command returns success
4050
Given a WP install
41-
When I run `wp theme install twentytwelve --activate`
51+
When I run `wp eval 'register_sidebar(["id"=>"sidebar-1","name"=>"Test Sidebar"]);'`
4252
And I run `wp sidebar exists sidebar-1`
4353
Then the return code should be 0
4454

4555
Scenario: Sidebar exists command returns failure
4656
Given a WP install
47-
When I run `wp theme install twentytwelve --activate`
48-
And I try `wp sidebar exists does-not-exist`
49-
Then the return code should be 1
57+
When I try `wp sidebar exists does-not-exist`
58+
Then the return code should be 1
59+
60+
Scenario: Get non-existing sidebar returns error
61+
Given a WP install
62+
When I try `wp sidebar get does-not-exist`
63+
Then STDERR should contain:
64+
"""
65+
does not exist
66+
"""

0 commit comments

Comments
 (0)