Skip to content

Commit e91ec4e

Browse files
Merge branch 'develop' into feature/release-automation
2 parents 6bca598 + f519537 commit e91ec4e

19 files changed

Lines changed: 737 additions & 77 deletions

.env.example

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Copy to `.env` and fill in real values. `.env` is gitignored.
2+
#
3+
# Used by Playwright (tests/e2e/playwright.config.js) at e2e startup.
4+
5+
# Cloudinary connection string consumed by the wizard e2e spec
6+
# (tests/e2e/wizard-setup.spec.js). Use a dedicated test account —
7+
# never production credentials. See README "End-to-end testing" for
8+
# why this is named CLOUDINARY_E2E_URL rather than CLOUDINARY_URL.
9+
CLOUDINARY_E2E_URL=cloudinary://API_KEY:API_SECRET@CLOUD_NAME

.github/workflows/ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ jobs:
7070
run: npm run env:start
7171

7272
- name: Run E2E tests
73+
env:
74+
CLOUDINARY_E2E_URL: ${{ secrets.CLOUDINARY_E2E_URL }}
7375
run: npm run test:e2e
7476

7577
- name: Stop wp-env

README.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,59 @@ Files included in the release package are defined in the `gruntfile.js` under th
117117

118118
3. Run `npm run deploy-assets` to deploy just the WP.org plugin assets such as screenshots, icons and banners.
119119

120+
## End-to-end testing
121+
122+
E2E tests run against a wp-env site using Playwright.
123+
124+
### One-time setup
125+
126+
```bash
127+
npm install
128+
npx playwright install --with-deps chromium
129+
npm run env:start
130+
```
131+
132+
### Running the tests
133+
134+
```bash
135+
npm run test:e2e
136+
```
137+
138+
### Wizard test credentials
139+
140+
`tests/e2e/wizard-setup.spec.js` exercises the live Cloudinary connection flow, so it needs a real connection string. Provide one of two ways:
141+
142+
**Option 1 — `.env` file (recommended for sustained local development).** Copy `.env.example` to `.env` and fill in the value. `.env` is gitignored. Playwright loads it automatically at startup.
143+
144+
```bash
145+
cp .env.example .env
146+
# edit .env, set CLOUDINARY_E2E_URL=cloudinary://...
147+
npm run test:e2e
148+
```
149+
150+
**Option 2 — shell export (good for one-off runs and CI).**
151+
152+
```bash
153+
export CLOUDINARY_E2E_URL='cloudinary://API_KEY:API_SECRET@CLOUD_NAME'
154+
npm run test:e2e
155+
```
156+
157+
A real shell env var takes precedence over the `.env` file.
158+
159+
The variable is intentionally named `CLOUDINARY_E2E_URL` (not `CLOUDINARY_URL`) so it cannot be confused with the Cloudinary SDK convention or with anything you might define in `.wp-env.override.json` for local dev. Use a dedicated test Cloudinary account — never production credentials.
160+
161+
> **Note:** Do **not** set `CLOUDINARY_URL` or `CLOUDINARY_CONNECTION_STRING` as PHP constants via `.wp-env.override.json` while running this spec. The plugin treats a constant-defined connection string as already-configured and hides the wizard's connection input, which makes the test impossible.
162+
163+
CI will provide `CLOUDINARY_E2E_URL` via a GitHub Actions secret (wired separately under WPP-1195's CI subtask).
164+
165+
### Debugging a failing e2e test
166+
167+
```bash
168+
npm run test:e2e:debug -- wizard-setup
169+
```
170+
171+
This opens Playwright's UI runner where you can step through actions, inspect the DOM, and view the network panel.
172+
120173
## License
121174
122175
Released under the GPL license.

css/cloudinary.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/cloudinary.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,25 +65,26 @@
6565
"tippy.js": "^6.3.1"
6666
},
6767
"devDependencies": {
68+
"@playwright/test": "^1.59.1",
6869
"@typescript-eslint/eslint-plugin": "^8.46.3",
6970
"@wordpress/api-fetch": "^7.34.0",
7071
"@wordpress/block-editor": "^15.12.0",
7172
"@wordpress/blocks": "^15.7.0",
7273
"@wordpress/browserslist-config": "^6.34.0",
7374
"@wordpress/components": "^30.7.0",
7475
"@wordpress/data": "^10.34.0",
75-
"@wordpress/element": "^6.34.0",
7676
"@wordpress/e2e-test-utils-playwright": "^1.44.0",
77+
"@wordpress/element": "^6.34.0",
7778
"@wordpress/env": "^10.12.0",
7879
"@wordpress/eslint-plugin": "^22.20.0",
79-
"@playwright/test": "^1.59.1",
8080
"@wordpress/i18n": "^6.7.0",
8181
"@wordpress/scripts": "^31.0.0",
8282
"copy-webpack-plugin": "^13.0.1",
8383
"css-loader": "^7.1.2",
8484
"css-minimizer-webpack-plugin": "^7.0.2",
8585
"css-unicode-loader": "^1.0.3",
8686
"cssnano": "^7.1.2",
87+
"dotenv": "^17.3.1",
8788
"eslint": "^8.57.1",
8889
"eslint-plugin-jest": "^29.0.1",
8990
"eslint-plugin-react-hooks": "^7.0.1",

php/class-deactivation.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,9 +199,9 @@ public function render_connected() {
199199
</div>
200200
<?php endif; ?>
201201
<div class="modal-body" id="modal-body">
202-
<p>
202+
<h2 class="cld-modal-box__title">
203203
<?php esc_html_e( 'Before you deactivate the plugin, would you quickly give us your reason for doing so?', 'cloudinary' ); ?>
204-
</p>
204+
</h2>
205205
<ul class="reasons">
206206
<?php foreach ( $this->get_reasons() as $reason ) : ?>
207207
<li>
@@ -249,7 +249,7 @@ public function render_connected() {
249249
</p>
250250
</div>
251251
<div class="modal-footer" id="modal-footer">
252-
<button class="button button-link deactivate-close" data-action="deactivate">
252+
<button class="button deactivate-close" data-action="deactivate">
253253
<?php esc_html_e( 'Skip and deactivate', 'cloudinary' ); ?>
254254
</button>
255255
<button class="button cancel-close" data-action="cancel">

php/templates/taxonomy-term-transformation-fields.php

Lines changed: 38 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -18,32 +18,44 @@
1818
$label = $tax_object->labels->singular_name;
1919
?>
2020
<?php foreach ( $this->taxonomy_fields as $context => $set ) : ?>
21-
<tr>
22-
<td colspan="2">
23-
<h3>
24-
<?php
25-
echo esc_html(
26-
sprintf(
27-
// translators: The taxonomy label and the context.
28-
__( 'Cloudinary %1$s %2$s Transformations', 'cloudinary' ),
29-
$label,
30-
ucwords( $context )
31-
)
32-
);
33-
?>
34-
</h3>
35-
</td>
36-
</tr>
37-
<?php foreach ( $set as $setting ) : ?>
38-
<tr class="form-field term-<?php echo esc_attr( $setting->get_slug() ); ?>-wrap">
39-
<th scope="row">
40-
<label for="cloudinary_<?php echo esc_attr( $setting->get_slug() ); ?>"><?php echo esc_html( $setting->get_param( 'title' ) ); ?></label>
41-
</th>
42-
<td>
43-
<?php $setting->set_param( 'title', null ); ?>
44-
<?php $setting->set_param( 'tooltip_text', null ); ?>
45-
<?php $setting->get_component()->render( true ); ?>
21+
<?php
22+
$collapse_id = 'cld-collapse-' . sanitize_html_class( $context );
23+
$heading = sprintf(
24+
// translators: The taxonomy label and the context.
25+
__( 'Cloudinary %1$s %2$s Transformations', 'cloudinary' ),
26+
$label,
27+
ucwords( $context )
28+
);
29+
// translators: The transformation context (e.g. Image, Video).
30+
$toggle_label = sprintf( __( 'Toggle %s transformations', 'cloudinary' ), ucwords( $context ) );
31+
?>
32+
<tbody class="cloudinary-term-transformations">
33+
<tr>
34+
<td colspan="2">
35+
<div class="cloudinary-collapsible__toggle" data-collapsible-target="<?php echo esc_attr( $collapse_id ); ?>">
36+
<h3><?php echo esc_html( $heading ); ?></h3>
37+
<button
38+
type="button"
39+
aria-expanded="false"
40+
aria-controls="<?php echo esc_attr( $collapse_id ); ?>"
41+
aria-label="<?php echo esc_attr( $toggle_label ); ?>"
42+
><i class="dashicons dashicons-arrow-down-alt2"></i></button>
43+
</div>
4644
</td>
4745
</tr>
48-
<?php endforeach; ?>
46+
</tbody>
47+
<tbody id="<?php echo esc_attr( $collapse_id ); ?>" hidden class="cloudinary-term-transformations">
48+
<?php foreach ( $set as $setting ) : ?>
49+
<tr class="form-field term-<?php echo esc_attr( $setting->get_slug() ); ?>-wrap">
50+
<th scope="row">
51+
<label for="cloudinary_<?php echo esc_attr( $setting->get_slug() ); ?>"><?php echo esc_html( $setting->get_param( 'title' ) ); ?></label>
52+
</th>
53+
<td>
54+
<?php $setting->set_param( 'title', null ); ?>
55+
<?php $setting->set_param( 'tooltip_text', null ); ?>
56+
<?php $setting->get_component()->render( true ); ?>
57+
</td>
58+
</tr>
59+
<?php endforeach; ?>
60+
</tbody>
4961
<?php endforeach; ?>

php/templates/taxonomy-transformation-fields.php

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,26 @@
3333

3434
$cloudinary = get_plugin_instance();
3535
?>
36-
<div class="cloudinary-collapsible">
37-
<div class="cloudinary-collapsible__toggle">
36+
<div class="cloudinary-collapsible cloudinary-collapsible--card">
37+
<div class="cloudinary-collapsible__toggle" data-collapsible-target="cld-collapse-taxonomy-transformations">
3838
<h2>
3939
<?php
4040
// translators: The taxonomy label.
4141
echo esc_html( sprintf( __( 'Cloudinary %s transformations', 'cloudinary' ), $tax_labels->singular_name ) );
4242
?>
4343
</h2>
44-
<button type="button"><i class="dashicons dashicons-arrow-down-alt2"></i></button>
44+
<?php
45+
// translators: The taxonomy singular label (e.g. Category, Tag).
46+
$toggle_label = sprintf( __( 'Toggle %s transformations', 'cloudinary' ), $tax_labels->singular_name );
47+
?>
48+
<button
49+
type="button"
50+
aria-expanded="false"
51+
aria-controls="cld-collapse-taxonomy-transformations"
52+
aria-label="<?php echo esc_attr( $toggle_label ); ?>"
53+
><i class="dashicons dashicons-arrow-down-alt2"></i></button>
4554
</div>
46-
<div class="cloudinary-collapsible__content" style="display:none;">
55+
<div id="cld-collapse-taxonomy-transformations" class="cloudinary-collapsible__content" hidden>
4756
<div class="cld-more-details">
4857
<?php
4958
printf(

0 commit comments

Comments
 (0)