Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Speed up and improve tests #5088

Merged
merged 33 commits into from
Jun 29, 2023
Merged

Conversation

rrrooommmaaa
Copy link
Contributor

@rrrooommmaaa rrrooommmaaa commented Apr 16, 2023

This PR speeds up live gmail tests by testing iframes directly,
also makes more strict checks that no leftover original attachment remain

close #4929 (pattern getFramesUrls and then browser.newPage was removed except where necessary) -- main bulk was updated in #5069


Tests (delete all except exactly one):

  • Internal test improvements

To be filled by reviewers

I have reviewed that this PR... (tick whichever items you personally focused on during this review):

  • addresses the issue it closes (if any)
  • code is readable and understandable
  • is accompanied with tests, or tests are not needed
  • is free of vulnerabilities
  • is documented clearly and usefully, or doesn't need documentation

@rrrooommmaaa rrrooommmaaa marked this pull request as ready for review April 17, 2023 11:46
@rrrooommmaaa
Copy link
Contributor Author

@sosnovsky Why sometimes there is only one artefact when 2 tests are failed?
image

image

It generally looks as if gmail live tests run in parallel (with another instance of test suite?)
Strange interference that never happens when a single test is run.
This primarily concerns drafts, as drafts are deleted at the beginning of almost each test

@sosnovsky
Copy link
Collaborator

@sosnovsky Why sometimes there is only one artefact when 2 tests are failed?

Looks like we're storing only 1 file in Artifacts folder even when multiple are written:
Screenshot 2023-04-25 at 10 33 03

Should be fixed too, here is code in semaphore.yml - https://github.com/FlowCrypt/flowcrypt-browser/blob/master/.semaphore/semaphore.yml#L90

@sosnovsky
Copy link
Collaborator

It generally looks as if gmail live tests run in parallel (with another instance of test suite?)

It shouldn't be possible, I think, as live tests run only in master and they can't interfere.
What about running drafts test first and then all other tests?

@rrrooommmaaa
Copy link
Contributor Author

It shouldn't be possible, I think, as live tests run only in master and they can't interfere.

Do you know why we have pool of 3 browsers for gmail live tests? Does this make sense?

@sosnovsky
Copy link
Collaborator

Do you know why we have pool of 3 browsers for gmail live tests? Does this make sense?

Not sure, maybe previously we ran live tests simultaneously, but for now we don't need these 3 browsers, just 1 will be enough.
There is a related task, where pool size should equal to --concurrency param value - #4955

@rrrooommmaaa
Copy link
Contributor Author

Not sure, maybe previously we ran live tests simultaneously, but for now we don't need these 3 browsers, just 1 will be enough.

Changing this value to 1 dramatically increased the run time to over an hour

@rrrooommmaaa
Copy link
Contributor Author

I think most of the updates are already incorporated into PR #5069.
After completion of it, I'll review this one, yes.

@sosnovsky
Copy link
Collaborator

@rrrooommmaaa probably now you can work on this one, as live tests are still failing

@rrrooommmaaa
Copy link
Contributor Author

We can also use getFrame directly (#4929) here if we don't need debug flag

const urls = await gmailPage.getFramesUrls(['/chrome/elements/compose.htm'], { sleep: 1 });
expect(urls.length).to.equal(1);
return await browser.newPage(t, `${urls[0]}&debug=___cu_true___`);

@@ -433,7 +457,8 @@ export const defineGmailTests = (testVariant: TestVariant, testWithBrowser: Test
})
);

test(
// convo-sensitive, draft-sensitive test
test.serial(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'll be run serially anyway. I can leave this serial as precaution or delete it

@rrrooommmaaa rrrooommmaaa changed the title Speed up and improve live tests Speed up and improve tests Jun 28, 2023
@sosnovsky
Copy link
Collaborator

We can also use getFrame directly (#4929) here if we don't need debug flag

const urls = await gmailPage.getFramesUrls(['/chrome/elements/compose.htm'], { sleep: 1 });
expect(urls.length).to.equal(1);
return await browser.newPage(t, `${urls[0]}&debug=___cu_true___`);

Is this debug flag used somewhere in tests or we can remove it without breaking tests? It'll be better to switch to using direct getFrame in #4929

@rrrooommmaaa
Copy link
Contributor Author

Is this debug flag used somewhere in tests or we can remove it without breaking tests?

Actually, as richtext option is disabled in Chrome, the debug flag is used to allow it in the test environment.
So I renamed the method to more descriptive openSecureComposeWithRichTextWorkaround

@sosnovsky
Copy link
Collaborator

Actually, as richtext option is disabled in Chrome, the debug flag is used to allow it in the test environment. So I renamed the method to more descriptive openSecureComposeWithRichTextWorkaround

Then let's leave it for now, until we'll find another way to enable richtext option on Chrome for tests (or it'll be ready to be enabled by default on Chrome too)

@rrrooommmaaa rrrooommmaaa marked this pull request as ready for review June 29, 2023 14:08
@rrrooommmaaa rrrooommmaaa enabled auto-merge (squash) June 29, 2023 14:21
@rrrooommmaaa rrrooommmaaa enabled auto-merge (squash) June 29, 2023 14:21
Copy link
Collaborator

@sosnovsky sosnovsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good 👍

@rrrooommmaaa rrrooommmaaa merged commit 5c38567 into master Jun 29, 2023
14 checks passed
@rrrooommmaaa rrrooommmaaa deleted the issue-4929-speed-up-tests-live-test branch June 29, 2023 18:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve tests performance by testing iframes directly
3 participants