fix(ci): flakiness due to onboarding tour in add user test (#6734)

This commit is contained in:
Aseem Bansal 2022-12-12 22:02:19 +05:30 committed by GitHub
parent 65ba13d9aa
commit 3099bd1486
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 5 deletions

View File

@ -25,6 +25,10 @@ export const OnboardingTour = ({ stepIds }: Props) => {
setReshow(true);
setIsOpen(true);
}
if (e.metaKey && e.ctrlKey && e.key === 'h') {
setReshow(false);
setIsOpen(false);
}
}
document.addEventListener('keydown', handleKeyDown);
}, []);

View File

@ -130,4 +130,5 @@ dmypy.json
# Pyre type checker
.pyre/
junit*
junit*
tests/cypress/onboarding.json

View File

@ -1,6 +1,8 @@
const tryToSignUp = () => {
cy.enterTextInTestId("email", "example@example.com")
cy.enterTextInTestId("name", "Example Name")
let number = Math.floor(Math.random() * 100000);
let name = `Example Name ${number}`;
cy.enterTextInTestId("email", `example${number}@example.com`)
cy.enterTextInTestId("name", name)
cy.enterTextInTestId("password", "Example password")
cy.enterTextInTestId("confirmPassword", "Example password")
@ -8,6 +10,7 @@ const tryToSignUp = () => {
cy.waitTextVisible("Other").click()
cy.get("[type=submit]").click()
return name;
};
describe("add_user", () => {
@ -23,8 +26,10 @@ describe("add_user", () => {
const inviteLink = $elem.text();
cy.logout();
cy.visit(inviteLink);
tryToSignUp();
cy.waitTextVisible("Accepted invite!")
let name = tryToSignUp();
cy.waitTextVisible("Welcome to DataHub");
cy.hideOnboardingTour();
cy.waitTextVisible(name);
}).then(() => {
cy.logout();
cy.visit("/signup?invite_token=bad_token");

View File

@ -136,6 +136,10 @@ Cypress.Commands.add("clickOptionWithTestId", (id) => {
});
})
Cypress.Commands.add("hideOnboardingTour", () => {
cy.get('body').type("{ctrl} {meta} h");
});
Cypress.Commands.add('addTermToDataset', (urn, dataset_name, term) => {
cy.goToDataset(urn, dataset_name);
cy.clickOptionWithText("Add Term");