@@ -167,7 +167,7 @@ public function testResizeDisabledShouldDisplayOriginalDimensionsInEditScreen()
167167 public function testPreserveCopyrightShouldDisplayCorrectImageSizeInMediaLibrary ()
168168 {
169169 $ this ->set_api_key ('PRESERVEJPG123 ' );
170- $ this ->enable_preserve_copyright ( );
170+ $ this ->enable_preserve ( array ( ' copyright ' ) );
171171 $ this ->upload_media (dirname (__FILE__ ) . '/../fixtures/input-copyright.jpg ' );
172172 $ this ->assertNotContains ('files modified after compression ' ,
173173 self ::$ driver ->findElement (WebDriverBy::cssSelector ('div#tinify-compress-details ' ))->getText ());
@@ -186,4 +186,35 @@ public function testNonImageFileShouldNotShowCompressInfoInMediaLibrary()
186186 $ this ->assertEquals ('' ,
187187 self ::$ driver ->findElement (WebDriverBy::cssSelector ('div#tinify-compress-details ' ))->getText ());
188188 }
189+
190+ public function testGatewayTimeoutShouldBeDetectedInShrink ()
191+ {
192+ $ this ->enable_compression_sizes (array ('medium ' ));
193+ $ this ->set_api_key ('GATEWAYTIMEOUT ' );
194+ $ this ->upload_media (dirname (__FILE__ ) . '/../fixtures/input-example.png ' );
195+ $ this ->assertContains ('JSON: Syntax error [4] ' ,
196+ self ::$ driver ->findElement (WebDriverBy::cssSelector ('td.tiny-compress-images ' ))->getText ());
197+ }
198+
199+ public function testGatewayTimeoutShouldBeDetectedInOutput ()
200+ {
201+ $ this ->enable_compression_sizes (array ('medium ' ));
202+ $ this ->enable_preserve (array ('copyright ' ));
203+ $ this ->set_api_key ('PNG123_GATEWAYTIMEOUT ' );
204+ $ this ->upload_media (dirname (__FILE__ ) . '/../fixtures/input-example.png ' );
205+ self ::$ driver ->takeScreenshot ("/Users/jacobmiddag/Downloads/ss2.png " );
206+ $ this ->assertContains ('Unexepected error in output ' ,
207+ self ::$ driver ->findElement (WebDriverBy::cssSelector ('td.tiny-compress-images ' ))->getText ());
208+ }
209+
210+ public function testErrorShouldBeDetectedInOutput ()
211+ {
212+ $ this ->enable_compression_sizes (array ('medium ' ));
213+ $ this ->enable_preserve (array ('copyright ' ));
214+ $ this ->set_api_key ('PNG123_INVALID ' );
215+ $ this ->upload_media (dirname (__FILE__ ) . '/../fixtures/input-example.png ' );
216+ self ::$ driver ->takeScreenshot ("/Users/jacobmiddag/Downloads/ss3.png " );
217+ $ this ->assertContains ("Metadata key 'author' not supported " ,
218+ self ::$ driver ->findElement (WebDriverBy::cssSelector ('td.tiny-compress-images ' ))->getText ());
219+ }
189220}
0 commit comments