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

test(update): improve typing methods on files tests #573

Merged
merged 4 commits into from
Dec 15, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 28 additions & 6 deletions tests/screenobjects/chats/SendFiles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,13 +226,23 @@ export default class SendFiles extends UplinkMainScreen {
async typeOnFileNameInput(name: string) {
const inputFileName = await this.inputFileName;
await inputFileName.waitForExist();
await inputFileName.clearValue();
await inputFileName.setValue(name);
const inputFileNameValue = await inputFileName.getText();
if (inputFileNameValue !== name) {
await this.typeOnFileNameInput(name);
}
}

async typeOnFolderNameInput(name: string) {
const inputFolderName = await this.inputFolderName;
await inputFolderName.waitForExist();
await inputFolderName.clearValue();
await inputFolderName.setValue(name);
const inputFolderNameValue = await inputFolderName.getText();
if (inputFolderNameValue !== name) {
await this.typeOnFolderNameInput(name);
}
}

async getCurrentFolder() {
Expand Down Expand Up @@ -278,19 +288,31 @@ export default class SendFiles extends UplinkMainScreen {
async updateNameFile(newName: string, extension: string = "") {
const inputFileName = await this.inputFileName;
await inputFileName.waitForExist();
await inputFileName.clearValue();
await inputFileName.setValue(newName);
const newFile = await this.getLocatorOfFolderFile(newName + extension);
const newFileElement = await this.instance.$(newFile);
await newFileElement.waitForExist();
const inputFileNameValue = await inputFileName.getText();
if (inputFileNameValue !== newName) {
await this.updateNameFile(newName, extension);
} else {
const newFile = await this.getLocatorOfFolderFile(newName + extension);
const newFileElement = await this.instance.$(newFile);
await newFileElement.waitForExist();
}
}

async updateNameFolder(newName: string) {
const inputFolderName = await this.inputFolderName;
await inputFolderName.waitForExist();
await inputFolderName.clearValue();
await inputFolderName.setValue(newName);
const newFolder = await this.getLocatorOfFolderFile(newName);
const newFolderElement = await this.instance.$(newFolder);
await newFolderElement.waitForExist();
const inputFolderNameValue = await inputFolderName.getText();
if (inputFolderNameValue !== newName) {
await this.updateNameFolder(newName);
} else {
const newFolder = await this.getLocatorOfFolderFile(newName);
const newFolderElement = await this.instance.$(newFolder);
await newFolderElement.waitForExist();
}
}

async validateFileOrFolderExist(locator: string) {
Expand Down
Loading