Remove browser integration tests (#6583)

This change removes support for browser integration tests since they
weren't being used in CI.

Fixes #6581

Signed-off-by: Dennis Adjei-Baah dennis@buoyant.io
This commit is contained in:
Dennis Adjei-Baah 2021-08-04 12:28:50 -05:00 committed by GitHub
parent eec713221f
commit 52363e3a50
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 91 additions and 1977 deletions

64
TEST.md
View File

@ -215,11 +215,6 @@ k3d) and trigger the test:
#### Testing the dashboard
We use [WebdriverIO](https://webdriver.io/) to test how the web dashboard looks
and operates locally in Chrome. For cross-browser testing, we use
[SauceLabs](https://saucelabs.com/), which runs simultaneous tests on different
browsers in the cloud.
If you're new to the repo, make sure you've installed web dependencies via
[Yarn](https://yarnpkg.com):
@ -243,65 +238,6 @@ OR
bin/web dev
```
##### Local
To run a local WebdriverIO instance that will run the tests on a local instance
of Chrome, run:
```bash
bin/web integration local
```
##### Cloud
To run cross-browser tests via SauceLabs, you need to do a few things first:
1. Sign up for a (free) SauceLabs sub-account for the account 'buoyant'. If you
are not a Buoyant staffer, the best way to get an account invite is to ask in
the [Linkerd Slack channel](https://slack.linkerd.io).
2. Once you have your username and key, set them as permanent environment
variables. This keeps your credentials private, and means that everyone on
the team can run the tests via their unique login without modifying the test
files. Open your `~/.bash_profile` file and add:
```bash
export SAUCE_USERNAME="your Sauce username"
export SAUCE_ACCESS_KEY="your Sauce access key"
```
3. Now you'll [download Sauce
Connect](https://wiki.saucelabs.com/display/DOCS/Sauce+Connect+Proxy), the
proxy server that will open a secure tunnel between a SauceLabs VM and the
Linkerd dashboard instance you're running on `localhost:7777`. You'll want to
save it in a separate directory from the rest of your development files.
After downloading it, navigate to that directory and start it up:
```bash
SC=sc-4.5.3-osx # OSX example
wget -O - https://saucelabs.com/downloads/$SC.zip | tar xfz - -C ~/
cd ~/$SC
bin/sc -u $SAUCE_USERNAME -k $SAUCE_ACCESS_KEY
```
Wait until you see `Sauce Connect is up, you may start your tests` in your
terminal. Open a separate terminal window and run:
```bash
bin/web integration cloud
```
SauceLabs will start running the tests in the cloud. If any tests fail,
you'll immediately get the URL in your terminal window with a video of the
test and information about what happened. The test(s) will also appear in
[your SauceLabs archives](https://app.saucelabs.com/archives) a minute or so
after they end. (Depending on time of day and server load, it may take longer
for the tests to appear in the archives.)
4. When you're finished, close the tunnel by pressing `CTRL-C` in the Sauce
Connect window. If you forget to do this, it will close on its own after a
few minutes.
## Writing tests
To add a new test, create a new subdirectory inside the `test/` directory.

16
bin/web
View File

@ -14,8 +14,6 @@ USAGE: web <command>
* build - build the assets
* dev - run a dev server (with live reloading). Options:
-p $DEV_PORT
* integration (cloud|local) - run the integration tests
Note: Sauce Connect tunnel must be open for cloud tests
* port-forward - setup a tunnel to a controller component and port
Example: port-forward linkerd controller 8085
* run - run a local server (sans. reloading)
@ -123,20 +121,6 @@ function test {
yarn jest "$@"
}
integration() {
if [[ $# -ne 1 || ($1 != "cloud" && $1 != "local") ]]; then
echo "usage: bin/${0##*/} integration (cloud|local)" >&2
exit 1
fi
if [ "$1" = cloud ]; then
cd "$ROOT"/web/app && \
./node_modules/.bin/wdio ./integration/wdio-sauce.conf.js
else
cd "$ROOT"/web/app && \
./node_modules/.bin/wdio ./integration/wdio.conf.js
fi
}
main() {
setup ''
build

View File

@ -1,114 +0,0 @@
const assert = require('assert');
let namespaceSelectionButton, namespaceOptions, newNamespaceOption;
describe('namespace selection test', function() {
it('should identify a namespace selection button titled `default`', () => {
browser.url(global.dashboardAddress);
menuButtons = browser.react$$('MenuList Button');
namespaceSelectionButton = menuButtons.find(button => {
return button.getText() === "DEFAULT";
});
})
it('should open a menu when namespace selection button is clicked', () => {
namespaceSelectionButton.click();
browser.waitUntil(() => {
namespaceOptions = browser.react$$('MenuList Menu MenuItem');
return namespaceOptions.length > 0;
}, 1000, 'timed out while waiting for namespace options to display');
});
it('should click on a namespace option', () => {
newNamespaceOption = namespaceOptions.find(namespace => {
return namespace.getText() === "linkerd";
});
newNamespaceOption.click();
});
it('namespace selection button should display new namespace option', () => {
const newNamespace = namespaceSelectionButton.getText().toLowerCase();
assert.equal(newNamespace, "linkerd");
});
it('should confirm namespace selection menu is closed', () => {
browser.waitUntil(() => {
namespaceOptions = browser
.react$$('MenuList Menu MenuItem')
.find(namespaceOption => {
return namespaceOption.getText() === "All Namespaces";
});
return !namespaceOptions;
}, 1000, 'timed out while waiting for namespace options to disappear');
});
it('should click on the deployments list view', () => {
const resourceOptions = browser.react$$('MenuList MenuItem ListItem');
const deploymentResource = resourceOptions.find(resource => {
return resource.getText() === "Deployments";
});
deploymentResource.click();
});
it('breadcrumb header text should display correct text', () => {
const breadcrumbHeader = browser.react$$('BreadcrumbHeader');
const breadcrumbText = breadcrumbHeader.reduce((acc, crumb) => {
acc+= crumb.getText();
return acc;
}, '');
assert.equal(breadcrumbText, "Namespace >linkerd >Deployment");
});
it('should display a list of resources', () => {
browser.waitUntil(() => {
return browser
.react$$('MetricsTable BaseTable TableBody TableRow a')
.length > 0;
}, 1000, 'timed out while waiting for resource list');
});
it('should click on a resource detail page', () => {
const resourceList = browser
.react$$('MetricsTable BaseTable TableBody TableRow a');
const resourceDetailLink = resourceList.find(tableRowLink => {
return tableRowLink.getText() === "linkerd-controller";
});
resourceDetailLink.click();
});
it('should select a different namespace from a resource detail page', () => {
namespaceSelectionButton.click();
namespaceOptions = browser.react$$('MenuList Menu MenuItem');
newNamespaceOption = namespaceOptions.find(namespace => {
return namespace.getText() === "default";
})
newNamespaceOption.click();
})
it('should cancel the modal confirmation dialog', () => {
let cancelNamespaceChangeButton = browser
.react$$('NamespaceConfirmationModal Button')
.find(button => {
return button.getText() === "NO";
});
cancelNamespaceChangeButton.click();
});
it('should close the confirmation dialog', () => {
browser.waitUntil(() => {
let modal = browser.react$('NamespaceConfirmationModal');
return !modal.isDisplayed();
}, 1000, 'timed out while waiting to close the confirmation dialog');
});
it('should select a different namespace', () => {
namespaceSelectionButton.click();
namespaceOptions = browser.react$$('MenuList Menu MenuItem');
newNamespaceOption = namespaceOptions.find(namespace => {
return namespace.getText() === "default";
});
newNamespaceOption.click();
});
it('should accept the modal confirmation dialog', () => {
let acceptNamespaceChangeButton = browser
.react$$('NamespaceConfirmationModal Button').find(button => {
return button.getText() === "YES";
});
acceptNamespaceChangeButton.click();
});
it('should navigate to the namespace detail page for new namespace', () => {
const breadcrumbHeader = browser.react$$('BreadcrumbHeader');
const breadcrumbText = breadcrumbHeader.reduce((acc, crumb) => {
acc = acc + crumb.getText();
return acc;
}, '')
assert.equal(breadcrumbText, "Namespace >default");
});
})

View File

@ -1,21 +0,0 @@
const assert = require('assert');
describe('url detection and routing test', function() {
it('should detect namespace in URL and display correct namespace', () => {
browser.url(global.dashboardAddress + '/namespaces/linkerd/pods');
browser.waitUntil(() => {
let buttonArray = browser.react$$('MenuList Button');
let namespaceSelectionButton = buttonArray.find(button => {
return button.getText() === "LINKERD";
})
return namespaceSelectionButton
}, 1000, 'timed out while waiting for namespace selection button');
});
it('clicking logo on top left should redirect to namespaces view', () => {
// logo is the first svg rendered in the dashboard
const linkerdWordLogo = browser.react$('div a svg');
linkerdWordLogo.click();
const currentUrl = browser.getUrl();
assert.equal(currentUrl, global.dashboardAddress + '/namespaces');
});
});

View File

@ -1,28 +0,0 @@
exports.config = {
runner: 'local',
user: process.env.SAUCE_USERNAME,
key: process.env.SAUCE_ACCESS_KEY,
sauceConnect: true,
specs: [
'./integration/specs/*.js'
],
// Patterns to exclude.
exclude: [
// 'path/to/excluded/files'
],
maxInstances: 10,
capabilities: [
{browserName: 'firefox', platform: 'Windows 10', version: '60.0'},
{browserName: 'chrome', platform: 'OS X 10.13', version: '69.0'}
],
bail: 0,
baseUrl: 'http://localhost',
waitforTimeout: 10000,
connectionRetryTimeout: 90000,
connectionRetryCount: 3,
framework: 'mocha',
mochaOpts: {
ui: 'bdd',
timeout: 60000
}
}

View File

@ -1,30 +0,0 @@
exports.config = {
port: 9515, // default for ChromeDriver
path: '/',
services: ['chromedriver'],
runner: 'local',
before: function() {
const chai = require('chai')
global.dashboardAddress = "http://localhost:7777" // dashboard address
global.expect = chai.expect
chai.Should()
},
specs: [
'./integration/specs/*.js'
],
exclude: [
// 'path/to/excluded/files'
],
maxInstances: 10,
capabilities: [{browserName: 'chrome'}],
bail: 0,
baseUrl: 'http://localhost',
waitforTimeout: 10000,
connectionRetryTimeout: 90000,
connectionRetryCount: 3,
framework: 'mocha',
mochaOpts: {
ui: 'bdd',
timeout: 60000
}
}

View File

@ -48,10 +48,6 @@
"@babel/preset-react": "^7.14.5",
"@babel/runtime": "^7.14.8",
"@lingui/cli": "3.10.2",
"@wdio/cli": "6.12.1",
"@wdio/local-runner": "7.0.0",
"@wdio/mocha-framework": "7.8.0",
"@wdio/sync": "7.9.0",
"babel-core": "^7.0.0-bridge.0",
"babel-jest": "^27.0.6",
"babel-loader": "^8.2.2",
@ -59,7 +55,6 @@
"babel-plugin-macros": "^3.1.0",
"babel-plugin-transform-react-remove-prop-types": "0.4.24",
"chai": "4.3.4",
"chai-webdriverio": "1.0.0",
"chromedriver": "91.0.1",
"clean-webpack-plugin": "3.0.0",
"css-loader": "^6.2.0",
@ -84,8 +79,6 @@
"sinon-stub-promise": "4.0.0",
"style-loader": "^3.2.1",
"url-loader": "^4.1.1",
"wdio-chromedriver-service": "6.0.4",
"webdriverio": "7.9.0",
"webpack": "^5.47.1",
"webpack-bundle-analyzer": "4.4.2",
"webpack-cli": "4.7.2",

File diff suppressed because it is too large Load Diff