test(reconnection): use an iptable rule to keep browser with no connection for a second
This commit is contained in:
parent
6173d2205d
commit
da43baca18
@ -19,7 +19,7 @@ class Reconnection extends MultiUsers {
|
||||
killConnection();
|
||||
|
||||
// chat disabled and notification bar displayed
|
||||
Promise.all([
|
||||
await Promise.all([
|
||||
expect(chatBoxLocator).toBeDisabled({ timeout: ELEMENT_WAIT_TIME }),
|
||||
this.modPage.hasElement(e.reconnectingBar),
|
||||
]);
|
||||
|
@ -1,10 +1,7 @@
|
||||
const { test } = require('@playwright/test');
|
||||
const e = require('../core/elements');
|
||||
const notificationsUtil = require('../notifications/util');
|
||||
const { expect } = require('@playwright/test');
|
||||
const { Reconnection } = require('./reconnection');
|
||||
|
||||
test.describe.parallel('Reconnection', () => {
|
||||
test.describe.serial('Reconnection', () => {
|
||||
test('Chat', async ({ browser, context, page }) => {
|
||||
const reconnection = new Reconnection(browser, context);
|
||||
await reconnection.checkRootPermission(); // check sudo permission before starting test
|
||||
|
@ -5,7 +5,13 @@ const parameters = require('../core/parameters.js');
|
||||
const hostname = new URL(parameters.server).hostname;
|
||||
|
||||
async function killConnection() {
|
||||
await exec('sudo ss -K dst ' + hostname + ' dport https');
|
||||
await exec(`
|
||||
sudo ss -K dst ${hostname} dport https;
|
||||
sudo iptables -A OUTPUT -p tcp -d ${hostname} --dport 443 -j DROP;
|
||||
sleep 1;
|
||||
sudo iptables -D OUTPUT -p tcp -d ${hostname} --dport 443 -j DROP;
|
||||
`);
|
||||
|
||||
}
|
||||
|
||||
exports.killConnection = killConnection;
|
||||
|
Loading…
Reference in New Issue
Block a user