@@ -78,91 +78,91 @@ public function test_settings_should_persist_all_disabled_sizes() {
7878 $ this ->assertEquals ( 0 , count ( $ enabled_sizes ) );
7979 }
8080
81- // public function test_api_key_input_presence() {
82- // $elements = self::$driver->findElements( WebDriverBy::name( 'tinypng_api_key' ) );
83- // $this->assertEquals( 1, count( $elements ) );
84- // }
85-
86- // public function test_should_show_total_images_info() {
87- // $this->enable_compression_sizes( array( '0', 'thumbnail', 'medium', 'large') );
88- // $element = self::$driver->findElement( WebDriverBy::id( 'tiny-image-sizes-notice' ) );
89- // $this->assertContains( 'With these settings you can compress at least 125 images for free each month.', $element->getText() );
90- // }
91- //
92- // public function test_should_update_total_images_info() {
93- // $this->enable_compression_sizes( array( '0', 'thumbnail', 'medium', 'large') );
94- // $element = self::$driver->findElement(
95- // WebDriverBy::xpath( '//input[@type="checkbox" and @name="tinypng_sizes[0]" and @checked="checked"]' ));
96- // $element->click();
97- // self::$driver->wait( 2 )->until(WebDriverExpectedCondition::textToBePresentInElement(
98- // WebDriverBy::cssSelector( '#tiny-image-sizes-notice' ),
99- // 'With these settings you can compress at least 166 images for free each month.'));
100- // }
101- //
102- // public function test_should_show_correct_no_image_sizes_info() {
103- // $elements = self::$driver->findElements(
104- // WebDriverBy::xpath( '//input[@type="checkbox" and starts-with(@name, "tinypng_sizes") and @checked="checked"]' ));
105- // foreach ( $elements as $element ) {
106- // $element->click();
107- // }
108- // self::$driver->wait( 2 )->until(WebDriverExpectedCondition::textToBePresentInElement(
109- // WebDriverBy::cssSelector( '#tiny-image-sizes-notice' ), 'With these settings no images will be compressed.'));
110- // // Not really necessary anymore to assert this.
111- // $elements = self::$driver->findElement( WebDriverBy::id( 'tiny-image-sizes-notice' ) )->findElements( WebDriverBy::tagName( 'p' ) );
112- // $statuses = array_map( 'innerText', $elements );
113- // $this->assertContains( 'With these settings no images will be compressed.', $statuses );
114- // }
115- //
116- // public function test_should_show_resizing_when_original_enabled() {
117- // $element = self::$driver->findElement( WebDriverBy::id( 'tinypng_sizes_0' ) );
118- // if ( ! $element->getAttribute( 'checked' ) ) {
119- // $element->click();
120- // }
121- // $labels = self::$driver->findElements( WebDriverBy::tagName( 'label' ) );
122- // $texts = array_map( 'innerText', $labels );
123- // $this->assertContains( 'Resize and compress the original image', $texts );
124- // $paragraphs = self::$driver->findElements( WebDriverBy::tagName( 'p' ) );
125- // $texts = array_map( 'innerText', $paragraphs );
126- // $this->assertNotContains( 'Enable compression of the original image size for more options.', $texts );
127- // }
128- //
129- // public function test_should_not_show_resizing_when_original_disabled() {
130- // $element = self::$driver->findElement( WebDriverBy::id( 'tinypng_sizes_0' ) );
131- // if ( $element->getAttribute( 'checked' ) ) {
132- // $element->click();
133- // }
134- // self::$driver->wait( 1 )->until(WebDriverExpectedCondition::textToBePresentInElement(
135- // WebDriverBy::cssSelector( 'p.tiny-resize-unavailable' ), 'Enable compression of the original image size for more options.'));
136- // $labels = self::$driver->findElements( WebDriverBy::tagName( 'label' ) );
137- // $texts = array_map( 'innerText', $labels );
138- // $this->assertNotContains( 'Resize and compress orginal images to fit within:', $texts );
139- // }
140- //
141- // public function test_should_not_show_resizing_when_original_disabled_when_shown_first() {
142- // $this->enable_compression_sizes( array( 'original') );
143- // self::$driver->navigate()->refresh();
144- // $this->assertEquals('Enable compression of the original image size for more options.',
145- // self::$driver->findElement( WebDriverBy::cssSelector( '.tiny-resize-unavailable' ) )->getText());
146- // }
147- //
148- // public function test_should_persist_resizing_settings() {
149- // $this->enable_resize( 123, 456 );
150- // $this->assertEquals( '123', self::$driver->findElement( WebDriverBy::id( 'tinypng_resize_original_width' ) )->getAttribute( 'value' ) );
151- // $this->assertEquals( '456', self::$driver->findElement( WebDriverBy::id( 'tinypng_resize_original_height' ) )->getAttribute( 'value' ) );
152- // }
153- //
154- // public function test_status_presence_ok() {
155- // reset_webservice();
156- // $this->set_api_key( 'PNG123' );
157- // self::$driver->wait( 2 )->until(WebDriverExpectedCondition::textToBePresentInElement(
158- // WebDriverBy::cssSelector( '#tiny-compress-status p.tiny-account-status' ),
159- // 'Your account is connected'));
160- // }
161- //
162- // public function test_status_presense_fail() {
163- // $this->set_api_key( 'INVALID123', false );
164- // self::$driver->wait( 2 )->until(WebDriverExpectedCondition::textToBePresentInElement(
165- // WebDriverBy::cssSelector( '#tiny-compress-status p.tiny-update-account-message' ),
166- // 'The key that you have entered is not valid'));
167- // }
81+ // public function test_api_key_input_presence() {
82+ // $elements = self::$driver->findElements( WebDriverBy::name( 'tinypng_api_key' ) );
83+ // $this->assertEquals( 1, count( $elements ) );
84+ // }
85+
86+ // public function test_should_show_total_images_info() {
87+ // $this->enable_compression_sizes( array( '0', 'thumbnail', 'medium', 'large') );
88+ // $element = self::$driver->findElement( WebDriverBy::id( 'tiny-image-sizes-notice' ) );
89+ // $this->assertContains( 'With these settings you can compress at least 125 images for free each month.', $element->getText() );
90+ // }
91+ //
92+ // public function test_should_update_total_images_info() {
93+ // $this->enable_compression_sizes( array( '0', 'thumbnail', 'medium', 'large') );
94+ // $element = self::$driver->findElement(
95+ // WebDriverBy::xpath( '//input[@type="checkbox" and @name="tinypng_sizes[0]" and @checked="checked"]' ));
96+ // $element->click();
97+ // self::$driver->wait( 2 )->until(WebDriverExpectedCondition::textToBePresentInElement(
98+ // WebDriverBy::cssSelector( '#tiny-image-sizes-notice' ),
99+ // 'With these settings you can compress at least 166 images for free each month.'));
100+ // }
101+ //
102+ // public function test_should_show_correct_no_image_sizes_info() {
103+ // $elements = self::$driver->findElements(
104+ // WebDriverBy::xpath( '//input[@type="checkbox" and starts-with(@name, "tinypng_sizes") and @checked="checked"]' ));
105+ // foreach ( $elements as $element ) {
106+ // $element->click();
107+ // }
108+ // self::$driver->wait( 2 )->until(WebDriverExpectedCondition::textToBePresentInElement(
109+ // WebDriverBy::cssSelector( '#tiny-image-sizes-notice' ), 'With these settings no images will be compressed.'));
110+ // // Not really necessary anymore to assert this.
111+ // $elements = self::$driver->findElement( WebDriverBy::id( 'tiny-image-sizes-notice' ) )->findElements( WebDriverBy::tagName( 'p' ) );
112+ // $statuses = array_map( 'innerText', $elements );
113+ // $this->assertContains( 'With these settings no images will be compressed.', $statuses );
114+ // }
115+ //
116+ // public function test_should_show_resizing_when_original_enabled() {
117+ // $element = self::$driver->findElement( WebDriverBy::id( 'tinypng_sizes_0' ) );
118+ // if ( ! $element->getAttribute( 'checked' ) ) {
119+ // $element->click();
120+ // }
121+ // $labels = self::$driver->findElements( WebDriverBy::tagName( 'label' ) );
122+ // $texts = array_map( 'innerText', $labels );
123+ // $this->assertContains( 'Resize and compress the original image', $texts );
124+ // $paragraphs = self::$driver->findElements( WebDriverBy::tagName( 'p' ) );
125+ // $texts = array_map( 'innerText', $paragraphs );
126+ // $this->assertNotContains( 'Enable compression of the original image size for more options.', $texts );
127+ // }
128+ //
129+ // public function test_should_not_show_resizing_when_original_disabled() {
130+ // $element = self::$driver->findElement( WebDriverBy::id( 'tinypng_sizes_0' ) );
131+ // if ( $element->getAttribute( 'checked' ) ) {
132+ // $element->click();
133+ // }
134+ // self::$driver->wait( 1 )->until(WebDriverExpectedCondition::textToBePresentInElement(
135+ // WebDriverBy::cssSelector( 'p.tiny-resize-unavailable' ), 'Enable compression of the original image size for more options.'));
136+ // $labels = self::$driver->findElements( WebDriverBy::tagName( 'label' ) );
137+ // $texts = array_map( 'innerText', $labels );
138+ // $this->assertNotContains( 'Resize and compress orginal images to fit within:', $texts );
139+ // }
140+ //
141+ // public function test_should_not_show_resizing_when_original_disabled_when_shown_first() {
142+ // $this->enable_compression_sizes( array( 'original') );
143+ // self::$driver->navigate()->refresh();
144+ // $this->assertEquals('Enable compression of the original image size for more options.',
145+ // self::$driver->findElement( WebDriverBy::cssSelector( '.tiny-resize-unavailable' ) )->getText());
146+ // }
147+ //
148+ // public function test_should_persist_resizing_settings() {
149+ // $this->enable_resize( 123, 456 );
150+ // $this->assertEquals( '123', self::$driver->findElement( WebDriverBy::id( 'tinypng_resize_original_width' ) )->getAttribute( 'value' ) );
151+ // $this->assertEquals( '456', self::$driver->findElement( WebDriverBy::id( 'tinypng_resize_original_height' ) )->getAttribute( 'value' ) );
152+ // }
153+ //
154+ // public function test_status_presence_ok() {
155+ // reset_webservice();
156+ // $this->set_api_key( 'PNG123' );
157+ // self::$driver->wait( 2 )->until(WebDriverExpectedCondition::textToBePresentInElement(
158+ // WebDriverBy::cssSelector( '#tiny-compress-status p.tiny-account-status' ),
159+ // 'Your account is connected'));
160+ // }
161+ //
162+ // public function test_status_presense_fail() {
163+ // $this->set_api_key( 'INVALID123', false );
164+ // self::$driver->wait( 2 )->until(WebDriverExpectedCondition::textToBePresentInElement(
165+ // WebDriverBy::cssSelector( '#tiny-compress-status p.tiny-update-account-message' ),
166+ // 'The key that you have entered is not valid'));
167+ // }
168168}
0 commit comments