Skip to content

Commit c2418df

Browse files
Remove obsolete 'experimentalAlignedExceptEdge' admin flag (#2433)
This flag was used to fetch edge runs back when they were not tagged with the experimental label. It is no longer useful, and is also misleading (the name implies it might remove Edge from the default query, which it does not do). See #2431 (comment) This change also makes util/populate_dev_data.go closer to what is shipped on wpt.fyi - the flags are updated and a new Edge experimental test run is added for the local testing sha. The data for that run is a copy of the Edge stable data for the same sha. Finally, the `webdriver/` README.md file is extensively updated with more description and a lot of debugging tips I've discovered over the last day!
1 parent c682c48 commit c2418df

File tree

7 files changed

+136
-48
lines changed

7 files changed

+136
-48
lines changed

shared/test_run_filter.go

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -119,23 +119,6 @@ func (filter TestRunFilter) OrExperimentalRuns() TestRunFilter {
119119
return filter
120120
}
121121

122-
// OrAlignedExperimentalRunsExceptEdge returns the current filter, or, if it is a default
123-
// query, returns a query for the latest experimental runs.
124-
func (filter TestRunFilter) OrAlignedExperimentalRunsExceptEdge() TestRunFilter {
125-
if !filter.IsDefaultQuery() {
126-
return filter
127-
}
128-
aligned := true
129-
filter.Aligned = &aligned
130-
filter.Products = GetDefaultProducts()
131-
for i := range filter.Products {
132-
if filter.Products[i].BrowserName != "edge" {
133-
filter.Products[i].Labels = mapset.NewSetWith("experimental")
134-
}
135-
}
136-
return filter
137-
}
138-
139122
// MasterOnly returns the current filter, ensuring it has with the master-only
140123
// restriction (a label of "master").
141124
func (filter TestRunFilter) MasterOnly() TestRunFilter {

util/populate_dev_data.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,11 @@ func main() {
8989
edge.ResultsURL = fmt.Sprintf(summaryURLFmtString, *localHost, staticRunSHA[:10], "edge[stable].json")
9090
edge.Labels = []string{"edge", shared.StableLabel}
9191

92+
edgeExp := edge
93+
edgeExp.BrowserVersion = "20"
94+
edgeExp.ResultsURL = strings.Replace(edge.ResultsURL, "[stable]", "[experimental]", -1)
95+
edgeExp.Labels = []string{"edge", shared.ExperimentalLabel}
96+
9297
firefox := chrome
9398
firefox.BrowserName = "firefox"
9499
firefox.BrowserVersion = "66"
@@ -115,6 +120,7 @@ func main() {
115120
chrome,
116121
chromeExp,
117122
edge,
123+
edgeExp,
118124
firefox,
119125
firefoxExp,
120126
safari,
@@ -160,7 +166,7 @@ func main() {
160166
addFlag(store, "diffFilter", enabledFlag)
161167
addFlag(store, "diffFromAPI", enabledFlag)
162168
addFlag(store, "experimentalByDefault", enabledFlag)
163-
addFlag(store, "experimentalAlignedExceptEdge", enabledFlag)
169+
addFlag(store, "experimentalAligned", enabledFlag)
164170
addFlag(store, "structuredQueries", enabledFlag)
165171
addFlag(store, "diffRenames", enabledFlag)
166172
addFlag(store, "paginationTokens", enabledFlag)

webapp/components/wpt-flags.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ Object.defineProperty(wpt, 'ClientSideFeatures', {
4242
'displayMetadata',
4343
'experimentalByDefault',
4444
'experimentalAligned',
45-
'experimentalAlignedExceptEdge',
4645
'fetchManifestForTestList',
4746
'githubCommitLinks',
4847
'githubLogin',
@@ -349,11 +348,6 @@ class WPTEnvironmentFlagsEditor extends FlagsEditorClass(/*environmentFlags*/ tr
349348
Align the default experimental runs
350349
</paper-checkbox>
351350
</paper-item>
352-
<paper-item sub-item>
353-
<paper-checkbox checked="{{experimentalAlignedExceptEdge}}">
354-
All experimental, except edge[stable], and aligned
355-
</paper-checkbox>
356-
</paper-item>
357351
<paper-item>
358352
<paper-checkbox checked="{{paginationTokens}}">
359353
Return "wpt-next-page" pagination token HTTP header in /api/runs

webapp/static/24278ab617/edge[experimental].json

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.

webapp/test_results_handler.go

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -105,14 +105,10 @@ func populateHomepageData(r *http.Request) (data homepageData, err error) {
105105
} else {
106106
if pr == nil && testRunFilter.IsDefaultQuery() {
107107
if aeAPI.IsFeatureEnabled("experimentalByDefault") {
108-
if aeAPI.IsFeatureEnabled("experimentalAlignedExceptEdge") {
109-
testRunFilter = testRunFilter.OrAlignedExperimentalRunsExceptEdge()
110-
} else {
111-
testRunFilter = testRunFilter.OrExperimentalRuns()
112-
if aeAPI.IsFeatureEnabled("experimentalAligned") {
113-
aligned := true
114-
testRunFilter.Aligned = &aligned
115-
}
108+
testRunFilter = testRunFilter.OrExperimentalRuns()
109+
if aeAPI.IsFeatureEnabled("experimentalAligned") || true {
110+
aligned := true
111+
testRunFilter.Aligned = &aligned
116112
}
117113
} else {
118114
testRunFilter = testRunFilter.OrAlignedStableRuns()

webdriver/README.md

Lines changed: 122 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,130 @@
11
# wpt.fyi Webdriver tests
22

3-
This directory covers Webdriver tests for the `webapp`, written in a 3rd-party
4-
Golang Webdriver client, [tebeka/selenium](https://github.com/tebeka/selenium).
3+
This directory containers integration tests for webapp/. These tests bring up
4+
the full webserver then use a Golang Webdriver client,
5+
[tebeka/selenium](https://github.com/tebeka/selenium), to load pages in a
6+
browser (Chrome or Firefox) and assert that the webapp behaves as expected.
57

68
To run the tests, from the root `wpt.fyi` directory, run:
79

8-
make go_webdriver_test
10+
make go_large_test
911

10-
If you want to actually see the tests in action, disable the frame buffer.
12+
You can run just one of Chrome or Firefox via:
1113

12-
make webdriver_deps
13-
go test --frame_buffer=false -tags=large ./webdriver
14+
make go_chrome_test
15+
make go_firefox_test
1416

15-
If you want to use a custom installed location of selenium / browser / driver
16-
binaries, the required flags are shown in [the Makefile](../Makefile)
17-
`go_webdriver_test' rule.
17+
Note that when running these tests outside of docker (see [Running in
18+
docker](#running-in-docker)), they will use your locally installed browser and
19+
webdriver clients, so it is worth making sure they are the versions you expect.
20+
21+
## Debugging
22+
23+
Debugging the webdriver/ tests can be difficult as they are integration tests
24+
and the problem can occur anywhere from controlling the browser, to the webapp
25+
frontend, to the backend - and other weird bugs inbetween! This section
26+
contains some tips on how to effectively debug them.
27+
28+
After running one of the above `make` commands at least once, one can directly
29+
run the golang tests via:
30+
31+
```
32+
# You can copy GECKODRIVER_PATH out of the make output; it should be installed
33+
# locally under webapp/node_modules/selenium-standalone/...
34+
go test -v -timeout=15m -tags=large ./webdriver -args \
35+
-firefox_path=/usr/bin/firefox \
36+
-geckodriver_path=$GECKODRIVER_PATH \
37+
-chrome_path=/usr/bin/google-chrome \
38+
-chromedriver_path=/usr/bin/chromedriver \
39+
-frame_buffer=true \
40+
-staging=false \
41+
-browser=chrome # Or firefox
42+
```
43+
44+
It is worth comparing this command-line against the Makefile, in case this
45+
documentation becomes out of date.
46+
47+
### Running only one test
48+
49+
If you only need to run one test, you can use the golang test [`-run`
50+
parameter](https://golang.org/pkg/testing/#hdr-Subtests_and_Sub_benchmarks).
51+
For example:
52+
53+
```
54+
go test -v -timeout=15m -tags=large ./webdriver \
55+
-run TestProductParam_Order/Order \
56+
-args \
57+
-firefox_path=/usr/bin/firefox \
58+
-geckodriver_path=$GECKODRIVER_PATH \
59+
-chrome_path=/usr/bin/google-chrome \
60+
-chromedriver_path=/usr/bin/chromedriver \
61+
-frame_buffer=true \
62+
-staging=false \
63+
-browser=chrome # Or firefox
64+
```
65+
66+
### Visual Output
67+
68+
Many of the tests run some javascript (or click on an element, etc) and expect
69+
to find some resulting change on the page. When that doesn't occur, they
70+
usually just timeout and it can be difficult to know why. One very useful trick
71+
is to enable visual output, so that you can actually see the webpage as the
72+
test runs.
73+
74+
To do this, set the `frame_buffer` argument to `false`, e.g.:
75+
76+
```
77+
go test -v -timeout=15m -tags=large ./webdriver -args \
78+
-firefox_path=/usr/bin/firefox \
79+
-geckodriver_path=$GECKODRIVER_PATH \
80+
-chrome_path=/usr/bin/google-chrome \
81+
-chromedriver_path=/usr/bin/chromedriver \
82+
-frame_buffer=false \
83+
-staging=false \
84+
-browser=chrome # Or firefox
85+
```
86+
87+
### Verbose webdriver output
88+
89+
By default, webdriver output is hidden as it is very noisy. You can re-enable
90+
it by passing `-debug=true` to the tests, e.g.:
91+
92+
```
93+
go test -v -timeout=15m -tags=large ./webdriver -args \
94+
-firefox_path=/usr/bin/firefox \
95+
-geckodriver_path=$GECKODRIVER_PATH \
96+
-chrome_path=/usr/bin/google-chrome \
97+
-chromedriver_path=/usr/bin/chromedriver \
98+
-frame_buffer=true \
99+
-staging=false \
100+
-browser=chrome \
101+
-debug=true
102+
```
103+
104+
Redirecting stderr to stdout and saving it to a log-file is recommended due to
105+
the verbosity of webdriver logs (append `2>&1 | tee my-log.txt` to the above
106+
command).
107+
108+
### Running in docker
109+
110+
Sometimes bugs only occur in a docker-like environment. This can be difficult
111+
to reproduce, but a first step is to run the tests inside of docker. To do
112+
this, first start the docker container in one terminal tab:
113+
114+
```
115+
./util/docker-dev/run.sh
116+
```
117+
118+
Then, in another tab, we need to get the instance id of the container, exec
119+
'bash' inside of it, and run our test:
120+
121+
```
122+
docker container ls
123+
[ note the CONTAINER ID ]
124+
docker exec -it $CONTAINER_ID bash
125+
user@abce84dd426d:~/wpt.fyi$
126+
[now you can run 'make go_chrome_test', or 'go test ...' directly, etc]
127+
```
128+
129+
Note that this maps the host machine's wpt.fyi checkout into docker, so any
130+
code edits you make on the host are reflected in the container and vice-versa.

webdriver/label_test.go

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,8 @@ import (
1515

1616
func TestLabelParam_Results(t *testing.T) {
1717
runWebdriverTest(t, func(t *testing.T, app AppServer, wd selenium.WebDriver) {
18-
// Local static data only have 2 experimental browsers, and neither has aligned
19-
// experimental runs.
20-
if *staging {
21-
testLabel(t, wd, app, "/", "experimental", "wpt-results", 4, false)
22-
} else {
23-
testLabel(t, wd, app, "/", "experimental", "wpt-results", 3, false)
24-
}
18+
aligned := false
19+
testLabel(t, wd, app, "/", "experimental", "wpt-results", 4, aligned)
2520
})
2621

2722
}

0 commit comments

Comments
 (0)