Skip to content

Commit

Permalink
Fix env variables override issue
Browse files Browse the repository at this point in the history
  • Loading branch information
ravichdev committed Jun 12, 2020
1 parent 74ad548 commit 898db11
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 3 deletions.
6 changes: 3 additions & 3 deletions .env.dist
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Unsplash
UNSPLASH_ACCESS_KEY=
UNSPLASH_SECRET_KEY=
UNSPLASH_UTM_SOURCE=
UNSPLASH_ACCESS_KEY=${UNSPLASH_ACCESS_KEY:=}
UNSPLASH_SECRET_KEY=${UNSPLASH_SECRET_KEY:=}
UNSPLASH_UTM_SOURCE=${UNSPLASH_UTM_SOURCE:=}

# MySQL
MYSQL_ROOT_PASSWORD=root
Expand Down
74 changes: 74 additions & 0 deletions tests/e2e/specs/admin/attachment-details.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
/**
* WordPress dependencies
*/
import { createNewPost, insertBlock } from '@wordpress/e2e-test-utils';

/**
* Internal dependencies
*/
import { clickButton, clickSelector } from '../../utils';
import {
UNSPLASH_LIBRARY_BUTTON,
UNSPLASH_CONTRAINER,
UNSPLASH_MODAL,
} from '../../constants';

describe( 'Attachment Details', () => {
beforeEach( async () => {
await createNewPost( {} );

// Insert image block.
await insertBlock( 'Image' );

// Click the media library button and wait for tab.
await clickButton( 'Media Library' );
await page.waitForSelector( UNSPLASH_MODAL, {
visible: true,
} );
await clickSelector( UNSPLASH_LIBRARY_BUTTON );
} );

it( 'should show pre-import attachment details', async () => {
await page.waitForSelector( UNSPLASH_CONTRAINER );
const btnSelector =
UNSPLASH_CONTRAINER + ' .unsplash-attachment:nth-child(3)';
await clickSelector( btnSelector );
const attachmentDetails = '.unsplash-attachment-details';
await page.waitForSelector( attachmentDetails );

expect( await page.$( `${ attachmentDetails } .details` ) ).not.toBeNull();

await page.waitForSelector( `${ attachmentDetails } .details .author` );

expect(
await page.evaluate(
author => author.innerText,
await page.$( `${ attachmentDetails } .details .author` )
)
).toContain( 'Photo by:' );

expect(
await page.evaluate(
filename => filename.innerHTML,
await page.$( `${ attachmentDetails } .details .filename` )
)
).toContain( '<strong>File name:</strong>' );

expect(
await page.evaluate(
uploaded => uploaded.innerText,
await page.$( `${ attachmentDetails } .details .uploaded` )
)
).toContain( 'Date:' );

const originalImage = await page.evaluate(
details => details.innerHTML,
await page.$( `${ attachmentDetails } .details` )
);

expect( originalImage ).toContain( '<strong>Original image:</strong>' );
expect( originalImage ).toMatch(
new RegExp( /https:\/\/unsplash.com\/photos\/[^"]+/ )
);
} );
} );

0 comments on commit 898db11

Please sign in to comment.