File tree Expand file tree Collapse file tree 1 file changed +4
-8
lines changed
grails-test-examples/geb/src/integration-test/groovy/org/demo/spock Expand file tree Collapse file tree 1 file changed +4
-8
lines changed Original file line number Diff line number Diff line change 1919
2020package org.demo.spock
2121
22+ import java.nio.file.Files
23+
2224import spock.lang.Stepwise
2325
2426import grails.plugin.geb.ContainerGebSpec
@@ -43,9 +45,6 @@ class PerTestRecordingSpec extends ContainerGebSpec {
4345 when : ' visiting another page than the previous test'
4446 to(UploadPage )
4547
46- and : ' pausing to ensure the recorded file size is different'
47- Thread . sleep(1000 )
48-
4948 then : ' the page loads correctly'
5049 title == ' Upload Test'
5150 }
@@ -86,15 +85,12 @@ class PerTestRecordingSpec extends ContainerGebSpec {
8685 recordingFiles != null
8786 recordingFiles. length >= 2 // At least 2 files for the first two test methods
8887
89- and : ' the recording files should have different content (different sizes) '
88+ and : ' the recording files should have different content'
9089 // Sort by last modified time to get the most recent files
9190 def sortedFiles = recordingFiles. sort { it. lastModified() }
9291 def secondLastFile = sortedFiles[sortedFiles. length - 2 ]
9392 def lastFile = sortedFiles[sortedFiles. length - 1 ]
94-
95- // Files should have different sizes (allowing for small variations due to timing)
96- long sizeDifference = Math . abs(lastFile. length() - secondLastFile. length())
97- sizeDifference > 1000 // Expect at least 1KB difference
93+ Files . mismatch(lastFile. toPath(), secondLastFile. toPath()) != -1
9894 }
9995
10096 private static boolean isVideoFile (File file ) {
You can’t perform that action at this time.
0 commit comments