From 7200f31fad4cc59cf1be1216620bb3787712abdb Mon Sep 17 00:00:00 2001 From: bunsenstraat Date: Tue, 14 Jan 2025 16:57:36 +0100 Subject: [PATCH 1/6] flaky --- .circleci/config.yml | 2 +- apps/remix-ide-e2e/src/tests/terminal.test.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 4ac8815bdf..e47c15c363 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -3,7 +3,7 @@ version: 2.1 parameters: run_flaky_tests: type: boolean - default: false + default: true orbs: browser-tools: circleci/browser-tools@1.4.4 win: circleci/windows@5.0 diff --git a/apps/remix-ide-e2e/src/tests/terminal.test.ts b/apps/remix-ide-e2e/src/tests/terminal.test.ts index 8aa15f221c..2916e55a15 100644 --- a/apps/remix-ide-e2e/src/tests/terminal.test.ts +++ b/apps/remix-ide-e2e/src/tests/terminal.test.ts @@ -195,7 +195,7 @@ module.exports = { .journalChildIncludes('inside getOwner', { shouldHaveOnlyOneOccurrence: true }) }, - 'Emit 2 similar events and check the filtering is done properly #group4': function (browser: NightwatchBrowser) { + 'Emit 2 similar events and check the filtering is done properly #group4 #flaky': function (browser: NightwatchBrowser) { let addressRef: string browser .addFile('contracts/contract_with_event.sol', { content: contract_with_event }) From 43084d19b631be3a06e84fa766d0d58aa7c011eb Mon Sep 17 00:00:00 2001 From: filip mertens Date: Wed, 15 Jan 2025 07:18:55 +0100 Subject: [PATCH 2/6] flaky test --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index e47c15c363..47c92c6777 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -785,7 +785,7 @@ workflows: browser: ["chrome", "firefox"] script: ["flaky.sh"] job: ["nogroup"] - jobsize: ["1"] + jobsize: ["10"] parallelism: [1] build_all: unless: << pipeline.parameters.run_flaky_tests >> From 71a86d57566e772dbdccd22599de99e9cb5e1852 Mon Sep 17 00:00:00 2001 From: filip mertens Date: Wed, 15 Jan 2025 07:42:16 +0100 Subject: [PATCH 3/6] more asserting --- .../src/commands/selectContract.ts | 27 ++++++++----------- apps/remix-ide-e2e/src/tests/terminal.test.ts | 18 ++++++------- 2 files changed, 19 insertions(+), 26 deletions(-) diff --git a/apps/remix-ide-e2e/src/commands/selectContract.ts b/apps/remix-ide-e2e/src/commands/selectContract.ts index d270f8949d..5db4c506f1 100644 --- a/apps/remix-ide-e2e/src/commands/selectContract.ts +++ b/apps/remix-ide-e2e/src/commands/selectContract.ts @@ -1,22 +1,17 @@ -import { NightwatchBrowser } from 'nightwatch' -import EventEmitter from 'events' +import { NightwatchBrowser } from 'nightwatch'; +import EventEmitter from 'events'; -const selector = '.udapp_contractNames' +const selector = '.udapp_contractNames'; class SelectContract extends EventEmitter { - command (this: NightwatchBrowser, contractName: string): NightwatchBrowser { - this.api.waitForElementVisible(selector).perform((done) => { - selectContract(this.api, contractName, () => { - done() - this.emit('complete') - }) - }) - return this + command(this: NightwatchBrowser, contractName: string): NightwatchBrowser { + this.api + .waitForElementVisible(selector) + .waitForElementPresent(`${selector} option[value="${contractName}"]`) + .click(`${selector} option[value="${contractName}"]`) + .perform(() => this.emit('complete')); + return this; } } -function selectContract (browser: NightwatchBrowser, contractName: string, callback: VoidFunction) { - browser.click(`${selector} option[value="${contractName}"]`).perform(() => callback()) -} - -module.exports = SelectContract +module.exports = SelectContract; diff --git a/apps/remix-ide-e2e/src/tests/terminal.test.ts b/apps/remix-ide-e2e/src/tests/terminal.test.ts index 2916e55a15..add4ee2c6b 100644 --- a/apps/remix-ide-e2e/src/tests/terminal.test.ts +++ b/apps/remix-ide-e2e/src/tests/terminal.test.ts @@ -209,18 +209,16 @@ module.exports = { .createContract('') .getAddressAtPosition(0, (address) => { addressRef = address - }) - .perform((done) => { browser.addFile('scripts/test_filtering_event.ts', { content: test_filtering_event.replace('
', addressRef) }) - .perform(() => done()) + .executeScriptInTerminal('remix.execute(\'scripts/test_filtering_event.ts\')') + .pause(1000) + .waitForElementContainsText('*[data-id="terminalJournal"]', '1') + .waitForElementContainsText('*[data-id="terminalJournal"]', 'true') + .executeScriptInTerminal('remix.execute(\'scripts/test_filtering_event.ts\')') // re-emit the event + .waitForElementContainsText('*[data-id="terminalJournal"]', '2') + .waitForElementContainsText('*[data-id="terminalJournal"]', 'false') }) - .executeScriptInTerminal('remix.execute(\'scripts/test_filtering_event.ts\')') - .pause(1000) - .waitForElementContainsText('*[data-id="terminalJournal"]', '1') - .waitForElementContainsText('*[data-id="terminalJournal"]', 'true') - .executeScriptInTerminal('remix.execute(\'scripts/test_filtering_event.ts\')') // re-emit the event - .waitForElementContainsText('*[data-id="terminalJournal"]', '2') - .waitForElementContainsText('*[data-id="terminalJournal"]', 'false') + }, 'Should display auto-complete menu #group4': function (browser: NightwatchBrowser) { From 8bc48959dad584d83884b750fa8fbb9c4703e45a Mon Sep 17 00:00:00 2001 From: filip mertens Date: Wed, 15 Jan 2025 08:07:20 +0100 Subject: [PATCH 4/6] turn off flaky --- .circleci/config.yml | 2 +- apps/remix-ide-e2e/src/tests/terminal.test.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 47c92c6777..1d7985eeb7 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -3,7 +3,7 @@ version: 2.1 parameters: run_flaky_tests: type: boolean - default: true + default: false orbs: browser-tools: circleci/browser-tools@1.4.4 win: circleci/windows@5.0 diff --git a/apps/remix-ide-e2e/src/tests/terminal.test.ts b/apps/remix-ide-e2e/src/tests/terminal.test.ts index add4ee2c6b..77bb44f548 100644 --- a/apps/remix-ide-e2e/src/tests/terminal.test.ts +++ b/apps/remix-ide-e2e/src/tests/terminal.test.ts @@ -195,7 +195,7 @@ module.exports = { .journalChildIncludes('inside getOwner', { shouldHaveOnlyOneOccurrence: true }) }, - 'Emit 2 similar events and check the filtering is done properly #group4 #flaky': function (browser: NightwatchBrowser) { + 'Emit 2 similar events and check the filtering is done properly #group4': function (browser: NightwatchBrowser) { let addressRef: string browser .addFile('contracts/contract_with_event.sol', { content: contract_with_event }) From 195212fb679259ca43a56b07bc327dd50eb321c4 Mon Sep 17 00:00:00 2001 From: filip mertens Date: Wed, 15 Jan 2025 08:08:14 +0100 Subject: [PATCH 5/6] turn off flaky --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 1d7985eeb7..4ac8815bdf 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -785,7 +785,7 @@ workflows: browser: ["chrome", "firefox"] script: ["flaky.sh"] job: ["nogroup"] - jobsize: ["10"] + jobsize: ["1"] parallelism: [1] build_all: unless: << pipeline.parameters.run_flaky_tests >> From 52946ddb2cd6ec307f832d701ff6f496060d7f1b Mon Sep 17 00:00:00 2001 From: filip mertens Date: Wed, 15 Jan 2025 08:08:48 +0100 Subject: [PATCH 6/6] lint --- apps/remix-ide-e2e/src/commands/selectContract.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/apps/remix-ide-e2e/src/commands/selectContract.ts b/apps/remix-ide-e2e/src/commands/selectContract.ts index 5db4c506f1..87bbc40c30 100644 --- a/apps/remix-ide-e2e/src/commands/selectContract.ts +++ b/apps/remix-ide-e2e/src/commands/selectContract.ts @@ -1,7 +1,7 @@ -import { NightwatchBrowser } from 'nightwatch'; -import EventEmitter from 'events'; +import { NightwatchBrowser } from 'nightwatch' +import EventEmitter from 'events' -const selector = '.udapp_contractNames'; +const selector = '.udapp_contractNames' class SelectContract extends EventEmitter { command(this: NightwatchBrowser, contractName: string): NightwatchBrowser { @@ -9,9 +9,9 @@ class SelectContract extends EventEmitter { .waitForElementVisible(selector) .waitForElementPresent(`${selector} option[value="${contractName}"]`) .click(`${selector} option[value="${contractName}"]`) - .perform(() => this.emit('complete')); - return this; + .perform(() => this.emit('complete')) + return this } } -module.exports = SelectContract; +module.exports = SelectContract